In reportState of the Google SmartHome API, temperatureK & spectrumRgb doesn't seem to work together - actions-on-google

I'm trying to make the Google Smart Home API work on Gladys Assistant (it's an open-source home automation software), and I struggle to make Google Integrations tests pass.
This is my onSync:
onSync
{
"requestId": "9164924531720238290",
"payload": {
"agentUserId": "9aba8230-9e8d-47b7-9d1c-f4dd8725aad3",
"devices": [
{
"id": "mqtt-lamp-temperature",
"type": "action.devices.types.LIGHT",
"traits": [
"action.devices.traits.ColorSetting",
"action.devices.traits.Brightness",
"action.devices.traits.OnOff"
],
"name": {
"name": "Lampe Temperature"
},
"attributes": {
"colorModel": "rgb",
"colorTemperatureRange": {
"temperatureMinK": 2000,
"temperatureMaxK": 9000
}
},
"deviceInfo": {
"model": null
},
"roomHint": "Grand Salon",
"willReportState": true
}
]
}
}
This is what I'm sending to reportState:
reportState
{
online: true,
color: { temperatureK: 3000, spectrumRgb: 8388863 },
on: true
}
This is what the onQuery is returning to the Google API:
onQuery
{
'mqtt-lamp-temperature': {
online: true,
color: { temperatureK: 3000, spectrumRgb: 8388863 },
on: true
}
}
But this is what Google sees in the integrations tests:
AssertionError: Expected state to include:
{"color":{"temperatureK":{"xRange":[2600,3200]}}},
actual state: {"color":{"spectrumRGB":8388863},"on":true,"online":true}: expected false to be true
It seems Google completely ignores the temperatureK attribute when the spectrumRgb attribute is here.
To confirm my theory, I tried to create a lamp that has only spectrumRgb and a light that has only temperatureK, and then it works perfectly. The problem is, in that case, some tests are skipped and I think I won't get validated by Google with that.
My question is:
Why does those attributes do not work together? Can't a light be controlled by its temperature and by it's RGB ?
Do you see anything weird in my implementation?
Thanks a lot for your help!

From the docs:
Color temperature is a linear scale and a subset of the RGB/HSV full spectrum color models.
You're currently trying to send two different color settings to your light (orange-ish in kelvin, deep pink in rgb), which is part of the issue you're running into.
You have set your device up in your SYNC to support both RGB and temperature, but in your QUERY/EXECUTE intents, you need to send either temperatureK or rgb spectrum values, not both.

Hi Your JSON format of Query and ReportState is different, include the device id in the ReportState as well, read the google report state docs for more info.

Related

How can I set a background image to vs code?

I am currently using Vs Code. But I don't know much about the IDE. I want to set a background image to IDE. Is it possible?
I've been searching for weeks.
I installed an extension named background from shalldie. I have changed the json code with this:
{
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs":"active",
"background.enabled": true,
"background.loop": false,
"background.useDefault": false,
"background.useFront": false,
"background.style": {
"content": "''",
"pointer-events": "none",
"position": "absolute",
"z-index": "99999",
"width": "70%",
"height": "100%",
"margin-left":"30%",
"background-position": "right",
"background-size": "cover",
"background-repeat": "no-repeat",
"opacity": 0.1
},
"background.customImages": [
"file//C:/madara.jpg",
]
}
after this, vs code wanted me to reload the IDE and I did. but nothing have changed.
After all this, I got another notification that says "Bracket Pair Colorizer is no longer being maintained.". But I don't know what does it mean.
I am using windows 10.
what do I need to do now?
file:///C:/madara.jpg
your path should add a '/' before drive letter

Smart Home modes trait not show in UI

I add the Modes trait and some settings to my device, but the UI doesn't show any option. Also I have tried with Toogle trait and it doesn't show it either.
(I have my assistant in Spanish, and when I select the supported language in the SYNC, I specified 'es' tag).
This is my SYNC response:
{
"requestId":"8280087254750701149",
"payload":{
"agentUserId":2,
"devices":[{
"id":"34",
"type":"action.devices.types.OUTLET",
"traits":["action.devices.traits.OnOff","action.devices.traits.Modes"],
"attributes":{
"availableModes":[{
"name":"auxiliar",
"name_values":[{
"name_synonym":["auxiliar"],
"lang":"es"
}],
"settings":[{
"setting_name":"encendido",
"setting_values":[{
"setting_synonym":["encendido"],
"lang":"es"
}]
},
{
"setting_name":"apagado",
"setting_values":[{
"setting_synonym":["apagado"],
"lang":"es"
}]
},
{
"setting_name":"suspendido",
"setting_values":[{
"setting_synonym":["suspendido"],
"lang":"es"
}]
}],
"ordered":true
}]
},
"name":{
"defaultNames":["EVVC200000091"],
"name":"Cargador laboratorio",
"nicknames":["cargador_labo"]
},
"willReportState":true,
"deviceInfo":{
"manufacturer":"Orbis",
"swVersion":"00.01.31"
},
"customData":{
"serial":"EVVC200000091",
"fooValue":74,
"barValue":true,
"bazValue":"foo"
}
}]
}
}
This is my QUERY response:
{"requestId":"15972376619501000208","payload":{"devices":{"34":{"currentModeSettings":{"auxiliar":"encendido"},"on":true}}}}
And the UI not show any option:
enter image description here
Not every device trait is supported on every surface with touch controls. You should look at the documentation for touch controls. Note that Modes and Toggles are not on the list for supported traits.

facebook messaging templates - text and background color

is there any option to set color of background or text in list messaging template. I have this element in payload:
{
"title":"priority #2: and this is clickable title",
"subtitle":"And here’s some text, makes no sense, but I need it here",
"default_action": {
"type": "web_url",
"url": "http://google.com",
"messenger_extensions": false,
"webview_height_ratio": "tall"
}
}
but unfortunely I wasn't able to find in docs the info how to set these colors. Maybe somebody have already done this, and could tell me what I have to add.
Nope, background and text color is not supported.

Constant heat map with mapbox

The new mapbox heatmap api looks awesome.
I want to achieve a constant heat map while zooming someone posted on github: https://cloud.githubusercontent.com/assets/186834/26474453/068dbd00-4166-11e7-996d-ec1756eb7355.gif
Looking at the official api example (https://www.mapbox.com/mapbox-gl-js/example/heatmap-layer/), how can I achieve this?
I believe the gif you posted is from a development prototype. This "constant heat map" effect is not the intended/default behavior of heat maps in GL.
That said, this behavior can be simulated using expressions! You'll need to use an expression that double heatmap-radius at each zoom level with a base of 2.
{
"id": "heatmap",
"type": "heatmap",
"source": "heatmap-source",
"paint": {
"heatmap-radius": {
"base": 2,
"stops": [
[
10,
2
],
[
19,
512
]
]
}
}
}

ZingChart - Alter Properties of ValueBox

I am using ZingChart to create a simple Pie Chart. I am using ColdFusion tags and a json file to style the chart. In the example below, my "target" series (the one I want to “highlight”) is 2, and I manipulating that slice by offsetting it and putting a border around it (see example). The problem with this is if the pie slice is very small, the border isn’t distinguishable.
My goal is to highlight the single valuebox associated with my target slice/series. I’ve research and experimented with the “rules”. The example below is hard-coded for the %v = 17.1 (which happens to be the value for series 2). The valuebox in this example has a border underneath it, which is great. But I can’t use the value token (%v) because there might be more than one series with the same value. I’ve tried many of the available tokens, and I can’t seem to get to find one that represents the “target” series that I identify. I thought it might be straightforward to highlight based on the text of the plot (%t) but I tried and that isn’t working either.
I tried playing around with the “custom token” feature, but won’t go into that at the moment as that didn’t work either.
How can I “highlight” the valuebox for series 2, presumably using a rule (hopefully using an available token)?
{
"graphset":[
{
"type":"pie",
"scale":{ "size-factor":"69%"},
"plot":{
"valueBox":{
"rules":[
{
"rule":"%v==17.1",
"fontSize":18,
"fontColor":"black",
"font-family":"Arial",
"border-bottom":"2px solid black"
}
],
"placement":"out",
"text":"%t:%v",
"fontSize":16,
"fontColor":"black",
"font-family":"Arial"
}
},
"series":[
{
"values":[ 1 ]
},
{
"values":[ 2 ],
"offset-r":"5%",
"border-color":"black",
"border-width":"3"
},
{
"values":[ 3 ]
},
{
"values":[ 4 ]
}
]
}
]
}
Thanks
It sounds like you are looking for the %p or %plot-index token (they are the same). This will allow you to modify the valueBox based on the index of your series.
I have included a demo here:
http://demos.zingchart.com/view/NRSRN7VT
{
type: "pie",
plot:{
valueBox:{
text: "%t: %v",
placement: "out",
rules:[
{
rule: "%p == 1",
color: "black",
fontStyle: "italic",
borderColor: "red",
borderWidth: 2,
shadow: 0,
padding: 10
}
]
}
},
series : [
{
values : [35]
},
{
values : [20]
},
{
values : [15]
}
]
}
I am on the ZingChart team. Hopefully this solves your problem.