Google Assistant Increase/Lower Fan speed - actions-on-google

I am not managing to get the intent "lower the AC unit speed..." or "increase the AC unit speed" working. I am getting the answer AC unit does not support that functionality.
The traits action.devices.traits.FanSpeed works fine if calling explicitly the speed: "set the AC unit speed to low" ,"set the AC unit speed to medium" , "set the AC unit speed to high".
My understanding is that "ordered":True should do the trick, am I missing something ? Here under the attributes (Python):
"attributes": {
"availableFanSpeeds": {
"speeds": [
{ "speed_name": "low", "speed_values": [{"speed_synonym": ["low", "speed 1", "min", "minimum"], "lang": "en" }] },
{ "speed_name": "medium", "speed_values": [{"speed_synonym": ["medium", "average", "speed 2"],"lang": "en" }] },
{ "speed_name": "high", "speed_values": [{"speed_synonym": "high","max", "maximum", "speed 3"],"lang": "en" }] }
],
"ordered": True
},
"reversible": False,

Related

When creating a template in whatsapp cloud api it is always rejected

I am trying to create a template from postman by sending this object:
{
"name": "listado_productos",
"language": "es",
"category": "TRANSACTIONAL",
"components": [
{
"type" : "HEADER",
"format": "document",
"example": {
"header_handle": [
"https://drive.google.com/file/d/1CcTpDZL3p0ltMFhIKU9Vhz1LWG0bQFpN/view?usp=share_link"
]}
},
{
"type": "BODY",
"text": "Buenas tardes, acá le enviamos el nuevo listado de precios. Muchas gracias"
},
{
"type": "FOOTER",
"text": "ABS."
}
]
}
If I try an example from the official business-management-api guide, it also rejects it for non-compliance with terms and conditions.
"name": "promotional_message",
"language": "en_US",
"category": "TRANSACTIONAL",
"components": [{
"type":"BODY",
"text":"Hi {{1}}, get an extra 10% off every order above $300.",
"example":{"body_text":[["Sonia"]]}
},
{
"type":"HEADER",
"format":"TEXT",
"text": "Bonus Tuesday starts now!"
},
{
"type":"FOOTER",
"text":"Not interested? Tap Stop promotions"
},
{
"type":"BUTTONS",
"buttons":[{"type":"QUICK_REPLY", "text": "Shop now"},
{"type":"QUICK_REPLY", "text": "Stop promotions"}]
}]
The response is that it is rejected for being duplicate or not complying with WhatsApp Busiess Api terms and services but it is not true, I read the terms and conditions and the file / message format complies. Does anyone identify the problem?

How to use count and where function in MongoDB?

Need some help here..have been stuck for awhile.
List all Name, Company Name of clients who have applied more than 2 loans which has a yearly repayment plan.
I should get 3 outputs:
John Tan, Happy Food Industry Pte Ltd
Mary Lee, Nice Man Advertising Pte Ltd
Yuyu Lee, NAGM Tuition Centre
My dataset:
[
{
"name": "John Tan",
"contact_number": [
"81726351",
"92019283",
"90192837"
],
"company_name": "Happy Food Industry Pte Ltd",
"company_registration_number": 950001819,
"type_of_ownership": "owner",
"last_roll_call": "16-06-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "01-12-21",
"financial_year_ended": "30-06-21",
"profit_and_lost_as_on_last_closing": 8000,
"cumulative_profit_and_lost_as_on_last_closing": 50000,
"loan_applied": [
"Purchase of delivery lorry",
"Renovation of tuition centre"
],
"commission_date": "01-12-19",
"loan_duration_in_mths": 24,
"interest_rate": 3,
"repayment_plan": "yearly",
"loan_amount": 138058298,
"status": "Requesting for delay payments",
"other_notes": null
},
{
"name": "Mary Lee",
"contact_number": [
"95213355"
],
"company_name": "Nice Man Advertising Pte Ltd",
"company_registration_number": 960087657,
"type_of_ownership": "Partner with 50% holding",
"last_roll_call": "15-06-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "Dec 21",
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 9000,
"cumulative_profit_and_lost_as_on_last_closing": 40000,
"loan_applied": [
"Purchase of crane",
"Purchase of machinery from USA"
],
"commission_date": "01-11-19",
"loan_duration_in_mths": 23,
"interest_rate": 4,
"repayment_plan": "yearly",
"loan_amount": 1237162,
"status": "Healthy",
"other_notes": null
},
{
"name": "Yuyu Lee",
"contact_number": [
"928371623"
],
"company_name": "NAGM Tuition Centre",
"type_of_ownership": "Partner with 20% holding",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "12-12-21",
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 1000000,
"cumulative_profit_and_lost_as_on_last_closing": 3002000,
"loan_applied": [
"Purchase of raw material from China",
"Renovation of shopping mall"
],
"commission_date": "01-11-19",
"loan_duration_in_mths": 11,
"interest_rate": 4,
"repayment_plan": "yearly",
"loan_amount": 918272,
"status": "Completed",
"other_notes": null
},
{
"name": "Joseph Lee",
"contact_number": [
"918273615",
"0192837176",
"1827361923"
],
"company_name": "Akaka Tuition Centre",
"company_registration_number": 929381782,
"type_of_ownership": "Director",
"last_roll_call": "15-11-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "No",
"plan_next_call": null,
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 999999,
"cumulative_profit_and_lost_as_on_last_closing": 9000,
"loan_applied": "Purchase of delivery lorry",
"commission_date": "01-11-19",
"loan_duration_in_mths": 11,
"interest_rate": 4,
"repayment_plan": "monthly",
"loan_amount": 918272,
"status": "Completed",
"other_notes": null
},
{
"name": "Tan Meh Meh",
"contact_number": [
"92837162",
"9189278371"
],
"company_name": "Target Pte Ltd",
"company_registration_number": 293891823,
"type_of_ownership": "Director",
"last_roll_call": "15-12-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "09-12-21",
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 12500000,
"cumulative_profit_and_lost_as_on_last_closing": 1500000,
"loan_applied": "Purchase of delivery lorry",
"commission_date": "01-11-19",
"loan_duration_in_mths": 55,
"interest_rate": 4,
"repayment_plan": "monthly",
"loan_amount": 918272,
"status": "Completed",
"other_notes": null
},
{
"name": "Teo Bee Bee",
"contact_number": [
"92039189278",
"192838182",
"192837172"
],
"company_name": "Hello Kitty Pte Ltd",
"company_registration_number": 102039192,
"type_of_ownership": "Owner",
"last_roll_call": "13-11-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "09-01-21",
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 6000,
"cumulative_profit_and_lost_as_on_last_closing": 24000000,
"loan_applied": "Purchase of delivery lorry",
"commission_date": "01-11-19",
"loan_duration_in_mths": 33,
"interest_rate": 4,
"repayment_plan": "monthly",
"loan_amount": 2312333,
"status": "Requesting for delay payments",
"other_notes": null
}
]
The following query will get you what is needed.
db.collection.find( { "loan_applied.1": { "$exists": true }, "repayment_plan": "yearly" } , {"name":1, "company_name": 1} );
Explanation:
Since loan_applied is an array field, we can use the dot notation to see if any element exist after the index 1, which means more than 1 element. We add one more filter for repayment_plan.
In the second part of the query, we use projection to return back only name and company_name.

How get total distance and time from waypoints in HERE REST API

I need to get the total distance and time from waypoints in HERE REST API.
Now i use the routing api:
https://route.api.here.com/routing/7.2/calculateroute.json
"app_id=" + API_ID
"&app_code=" + APP_CODE
"&waypoint0=geo!" + fromCoordsLocation
"&waypoint1=geo!" + toCoordsLocation
"&mode=fastest;car"
and read them from json summary object (Response->Route->Summary). This method returns all the maneuvers and for long distances the callback is slow. there is something that allows only the summary (or the total distance and time) to be received?
Check out these additional properties so you can customize the request as you want. In this case I used representation = overview, your request will be
https://route.api.here.com/routing/7.2/calculateroute.json
"app_id=" + API_ID
"&app_code=" + APP_CODE
"&waypoint0=geo!" + fromCoordsLocation
"&waypoint1=geo!" + toCoordsLocation
"&mode=fastest;car&representation=overview"
The response will be decreased to 78 lines with default 232 lines:
{
"response": {
"metaInfo": {
"timestamp": "2019-11-14T10:03:16Z",
"mapVersion": "8.30.102.151",
"moduleVersion": "7.2.201945-5699",
"interfaceVersion": "2.6.74",
"availableMapVersion": [
"8.30.102.151"
]
},
"route": [
{
"waypoint": [
{
"linkId": "-53623477",
"mappedPosition": {
"latitude": 52.4999825,
"longitude": 13.3999652
},
"originalPosition": {
"latitude": 52.5,
"longitude": 13.4
},
"type": "stopOver",
"spot": 0.3538462,
"sideOfStreet": "left",
"mappedRoadName": "Neuenburger Straße",
"label": "Neuenburger Straße",
"shapeIndex": 0,
"source": "user"
},
{
"linkId": "+1215312511",
"mappedPosition": {
"latitude": 52.4992955,
"longitude": 13.4491968
},
"originalPosition": {
"latitude": 52.5,
"longitude": 13.45
},
"type": "stopOver",
"spot": 1.0,
"sideOfStreet": "left",
"mappedRoadName": "Schlesische Straße",
"label": "Schlesische Straße",
"shapeIndex": 56,
"source": "user"
}
],
"mode": {
"type": "fastest",
"transportModes": [
"car"
],
"trafficMode": "disabled",
"feature": []
},
"summary": {
"distance": 3847,
"trafficTime": 869,
"baseTime": 667,
"flags": [
"noThroughRoad",
"builtUpArea",
"park",
"privateRoad"
],
"text": "The trip takes <span class=\"length\">3.8 km</span> and <span class=\"time\">11 mins</span>.",
"travelTime": 667,
"_type": "RouteSummaryType"
}
}
],
"language": "en-us"
}
}

Google Assistant Smarthome: Query for fan speed always fail

Developing fan trait for Google Actions, query for the status of the fan always returns fail. Here is my step:
Sync
{
"id": "d25dde36-76cb-44aa-a649-b1f61bb3bebb",
"type": "action.devices.types.FAN",
"traits": ["action.devices.traits.OnOff", "action.devices.traits.FanSpeed"],
"name": {
"name": "living room fan"
},
"willReportState": false,
"attributes": {
"availableFanSpeeds": {
"ordered": true,
"speeds": [{
"speed_name": "low",
"speed_values": [{
"lang": "en",
"speed_synonym": ["low"]
}]
}, {
"speed_name": "medium",
"speed_values": [{
"lang": "en",
"speed_synonym": ["medium"]
}]
}, {
"speed_name": "high",
"speed_values": [{
"lang": "en",
"speed_synonym": ["high"]
}]
}]
}
},
"deviceInfo": {
"manufacturer": "XYZ"
},
"customData": {
"serialID": "001D10010334",
"type": "resource"
}
}
Query
{"inputs":[{"intent":"action.devices.QUERY","payload":{"devices":[{"customData":{"serialID":"001D10010334","type":"resource"},"id":"d25dde36-76cb-44aa-a649-b1f61bb3bebb"}]}}],"requestId":"16727804366400067692"}
Skill response
{"requestId":"16727804366400067692","payload":{"devices":{"d25dde36-76cb-44aa-a649-b1f61bb3bebb":{"online":true,"currentFanSpeedSetting":"medium","on":true}}}}
Google home speaker
Sorry, I am unable to reach the living room fan right now. Please try again.
Although the message returned back is compatible with the doc https://developers.google.com/actions/smarthome/traits/fanspeed#device-states, why the speaker doesn't return the "correct" message.
Thought the query for Fan OnOff is ok.
Any ideas?
Thanks.
reversible trait is mandatory. If attributes are incomplete, the trait is not active.
If 'reversible' trait set to true, this device supports blowing the fan in both directions and can accept the command to reverse fan direction.

Country dimension in Analytics Reporting API v4

I want to get a report from Google Analytics v4 for pageviews by country. Since my website is targeting a specific region, I'm filtering by countries I'm most interested in using ga:countryIsoCode dimension so I don't have to type complete country name in the filter.
Now I'd be also interested in getting pageviews for all other countries combined into 'other' entry. What would be the easiest way to achieve that?
I've tried dynamic segments so far adding ga:segment to dimensions and a NOT filter in the segment with the same rule I used for filtering counties (except ga:countryIsoCode isn't allowed in segments, so I used ga:country). This produced 3 rows of data with each of three countries appearing along with 'other' every time.
I'd appreciate an advice on this as it seems like a common use case to me. Thanks in advance!
I was able to achieve that by using segments. This approach doesn't allow to batch requests though unless all of them have the same segment definition. Also, there're limitations on the number of segments to include in the report request. Very surprised this functionality is so hard to achieve. For interested, there's an example request:
{
"reportRequests": [{
"viewId": "ga:XXXXXXXXX",
"dateRanges": [{
"startDate": "YYYY-MM-DD",
"endDate": "YYYY-MM-DD"
}],
"metrics": [{
"expression": "ga:pageviews"
}, {
"expression": "ga:sessions"
}],
"dimensions": [{
"name": "ga:segment"
}],
"segments": [{
"dynamicSegment": {
"name": "Other",
"sessionSegment": {
"segmentFilters": [{
"not": "True",
"simpleSegment": {
"orFiltersForSegment": [{
"segmentFilterClauses": [{
"dimensionFilter": {
"dimensionName": "ga:country",
"operator": "IN_LIST",
"expressions": ["United States", "United Kingdom"]
}
}]
}]
}
}]
}
}
},
{
"dynamicSegment": {
"name": "United States",
"sessionSegment": {
"segmentFilters": [{
"simpleSegment": {
"orFiltersForSegment": [{
"segmentFilterClauses": [{
"dimensionFilter": {
"dimensionName": "ga:country",
"operator": "EXACT",
"expressions": "United States"
}
}]
}]
}
}]
}
}
},
{
"dynamicSegment": {
"name": "United Kingdom",
"sessionSegment": {
"segmentFilters": [{
"simpleSegment": {
"orFiltersForSegment": [{
"segmentFilterClauses": [{
"dimensionFilter": {
"dimensionName": "ga:country",
"operator": "EXACT",
"expressions": "United Kingdom"
}
}]
}]
}
}]
}
}
}],
'hideTotals': 'true',
'hideValueRanges': 'true'
}]
}