action.devices.traits.Modes - anyone implemented this? - actions-on-google

i've implemented a Smart Home app on Google, and now want to implement the n-way Modes trait for some switch types.
my JSON response seems to mirror that of the example, and discovery works, but i can't interact with the switch using the mode examples (JSON not complete) - anyone got any idea what i'm missing?
"attributes": {
"availableModes": [{
"name": "Control",
"name_values": [{
"name_synonym": ["control", "mode"],
"lang": "en"
}],
"settings": [{
"setting_name": "Off",
"setting_values": [{
"setting_synonym": [ "Off"],
"lang": "en"
}]
},{
"setting_name": "Level1",
"setting_values": [{
"setting_synonym": ["Level1"],
"lang": "en"
}]
}],
"ordered": false
}]
}

From the documentation, custom names for modes and toggles do not work yet.
"Currently, you must submit names to us so we can add support for them."

Related

Azure DevOps API - how to discover link between field and picklist

I'm trying to replicate an Azure DevOps process from one organization to another via the AZDO REST Api. I'm working on replicating the layout and am stuck because I can't discover the relationship between a custom field and a picklist when querying the source AZDO instance.
In my scenario I have a test work item type which I've called Issue. On the Issue interface I've created a custom field which is a picklist. While I can retrieve a list of lists via the Rest API and examine the field as well, I can't figure out how the two are related.
Here is a partial payload from the field:
{
"count": 39,
"value": [
...
{
"referenceName": "Custom.IssueSource",
"name": "Issue Source",
"type": "string",
"description": "Who is this attributed to",
"required": true,
"url": "https://dev.azure.com/MYORG/_apis/work/processes/f390103e-7097-4f19-b5b5-f9dbcf92bb6f/behaviors",
"customization": "custom"
},
... ]
}
and here is a partial payload from the lists get query which I used trial and error to determine was the picklist I've assigned:
{
"count": 10,
"value": [
...
{
"id": "2998d4e4-2bec-4935-98a1-b67a0b0b6d5d",
"name": "picklist_e854661e-8620-4ad9-be28-b974c5cb3a5d",
"type": "String",
"isSuggested": false,
"url": "https://dev.azure.com/MYORG/_apis/work/processes/lists/2998d4e4-2bec-4935-98a1-b67a0b0b6d5d"
},
...
]
}
Here is a partial layout response for the WIT:
{
"pages": [
{
"id": "d0171d51-ff84-4038-afc1-8800ab613160.System.WorkItemType.Details",
"inherited": true,
"label": "Details",
"pageType": "custom",
"visible": true,
"isContribution": false,
"sections": [
{
"id": "Section1",
"groups": [
...
{
"id": "bf03e049-5062-4d82-b91d-4396541fbed2",
"label": "Custom",
"isContribution": false,
"visible": true,
"controls": [
{
"id": "Custom.IssueSource",
"label": "Issue Source",
"controlType": "FieldControl",
"readOnly": false,
"visible": true,
"isContribution": false
}
]
}
]
},
... ]
}
Using fiddler against the AZDO web interface, the only time I see a reference to the picklist is from another non-AZDO API to https://dev.azure.com/MYORG/_apis/Contribution/dataProviders/query
Is there a way to discover the link via the AZDO Rest API? I saw this question which was similar but was about creating the link
Figured it out. Turns out you need to query from a different scope - work item tracking rather than work item tracking process:
https://dev.azure.com/MYORG/_apis/wit/fields/Custom.IssueSource?api-version=5.0-preview.2
returns
{
"name": "Issue Source",
"referenceName": "Custom.IssueSource",
"description": "Who is this attributed to",
"type": "string",
"usage": "workItem",
"readOnly": false,
"canSortBy": true,
"isQueryable": true,
...
"isIdentity": false,
--> "isPicklist": true,
"isPicklistSuggested": false,
--> "picklistId": "2998d4e4-2bec-4935-98a1-b67a0b0b6d5d",
"url": "https://dev.azure.com/MYORG/_apis/wit/fields/Custom.IssueSource"
}

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.

How to change HERE maps type in SAP Visual Business GeoMap?

According to this Map Provider Configuration Changes, I use this configuration to add HERE maps in GeoMap:
var oMapConfig = {
"MapProvider": [{
"name": "HEREMAPS",
"type": "HERETerrainMap",
"description": "",
"tileX": "256",
"tileY": "256",
"maxLOD": "20",
"copyright": "Tiles Courtesy of HERE Maps",
"Source": [{
"id": "s1",
"url": "https://1.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/reduced.day/{LOD}/{X}/{Y}/256/png8?app_id=MY_ID&app_code=MY_CODE"
}, {
"id": "s2",
"url": "https://2.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/reduced.day/{LOD}/{X}/{Y}/256/png8?app_id=MY_ID&app_code=MY_CODE"
}
]
}],
"MapLayerStacks": [{
"name": "DEFAULT",
"MapLayer": {
"name": "layer1",
"refMapProvider": "HEREMAPS",
"opacity": "1.0",
"colBkgnd": "RGB(255,255,255)"
}
}]
};
this.oMap.setMapConfiguration(oMapConfig);
this.oMap.setRefMapLayerStack("DEFAULT");
But my map is in black and white style:
What I want is standard map:
In Configuring HERE (formerly Nokia, NAVTEQ) maps, new server URL is provided, I've tried this, but not working.
{
"id": "s1",
"url": http://1.maps.nlp.nokia.com/maptile/2.1/maptile/newest/normal.day/{LOD}/{X}/{Y}/256/png?app_id=YOUR_APP_ID&app_code=YOUR_APP_CODE"
}, {
"id": "s2",
"url": "http://2.maps.nlp.nokia.com/maptile/2.1/maptile/newest/normal.day/{LOD}/{X}/{Y}/256/png?app_id=MY_APP_ID&app_code=MY_APP_CODE"
}
And failed to find MapProvider configuration documentation in setMapConfiguration of GeoMap
Just change reduced.day to normal.day in your map URL, and you'll get colored map:)
edit:
Please refer to https://developer.here.com/documentation/map-tile/topics/examples.html for detailed APIs

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'
}]
}

How to get list of all technologies

If you look at the 'Tags' option when you post a question, it gives an auto-complete/intellisense-assist when we type a tag, say SQL Server, for example. I need to get the whole list of technologies, the itemsSource, of this intellisense-assist. You may see a similar use-case in LinkedIn when we try to add a technology/skill that we learnt, to our profile. Can someone please tell me the source from which we may get this whole list of technolgies?
You mean like
http://api.stackoverflow.com/1.1/tags
which gives:
{
"total": 35690,
"page": 1,
"pagesize": 70,
"tags": [
{
"name": "c#",
"count": 576794,
"fulfills_required": false
},
{
"name": "java",
"count": 554383,
"fulfills_required": false
},
{
"name": "javascript",
"count": 523194,
"fulfills_required": false
},
...
Have a look at Stack Exchange API