Smart Home modes trait not show in UI - actions-on-google

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.

Related

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

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.

Ionic Mapbox GeolocateControl: trackUserLocation?

I can't figure out how to track the User Location via GPS.
This code can I add in my Mapbox:
const geolocate = (new mapboxgl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
trackUserLocation: true
}));
map.addControl(geolocate)
But it doesn't show it in iOS. What to do? Maybe add some Ionic/Cordova tricks?
Maybe this helps:
Not all browsers support geolocation, and some users may disable the
feature. Geolocation support for modern browsers including Chrome
requires sites to be served over HTTPS. If geolocation support is not
available, the GeolocateControl will not be visible.
from:
https://docs.mapbox.com/mapbox-gl-js/api/#geolocatecontrol
Are you loading the mapbox-gl css? Without the css files the markers and controls are invisible.
You might need to add this line in angular.json:
{
...
"projects": {
"app": {
...
"architect": {
"build": {
...
"options": {
...
"styles": [
...
},
{
"input": "node_modules/mapbox-gl/dist/mapbox-gl.css"
}

how to initialize primeng tree component

Given a tree how to initialize it in such way that the nodes are expanded at will?
I already tried to get a reference with #ViewChildren(Tree) tree but is resulting in undefined references when trying to access his children
This is a hack that basically simulates clicks along the tree. I add this solution but I really hope someone could find something better.
Given a component with a tree we can get a reference to the treenodes and then "click" them as necessary:
#Component({
selector: 'filemanager',
templateUrl: './filemanager.html',
directives: [Tree]
})
export class FileManagerComponent implements AfterViewInit {
constructor(private renderer:Renderer) {}
ngAfterViewInit() {
setTimeout(() => { // a timeout is necessary otherwise won't find the elements
// get the first "p-tree" tag and find his first "toggler"
let element = document.getElementsByTagName("p-tree")[0].getElementsByClassName("ui-tree-toggler fa fa-fw fa-caret-right")[0];
//"click" the toggler using the angular2 renderer
let event = new MouseEvent('click', {bubbles: true});
this.renderer.invokeElementMethod(element, 'dispatchEvent', [event]);
}, 200);
}
// more methods and state...
}
In case you need to initialize deeper nodes in the tree you will need to nest setTimeout functions.
For initialize your tree component expanded you only need set in you json format the property expanded as true.
Sample:
{
"data":
[
{
"label": "Pictures",
"data": "Pictures Folder",
"expandedIcon": "fa-folder-open",
"collapsedIcon": "fa-folder",
"expanded": true, // this flag shoud be true
"children": [
{"label": "barcelona.jpg", "icon": "fa-file-image-o", "data": "Barcelona Photo"},
{"label": "logo.jpg", "icon": "fa-file-image-o", "data": "PrimeFaces Logo"},
{"label": "primeui.png", "icon": "fa-file-image-o", "data": "PrimeUI Logo"}]
},
]
}
You can handle this with a function that put all the expanded attributes to true.
expandAll(toggle: boolean) {
this.tree.map(node => {
node.expanded = toggle;
});
}
ngOnInit() {
setTimeout(()=>{
this.expandAll(true);
}, 0);
}

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.

How can I show a highstock graph with a linear timeline

I have generated a graph inside highstock (see example - http://jsfiddle.net/szFQa/),
however, by default, it groups data that is chronologically close together, and stops the timeline from showing time in a linear form.
I've tried using the following options, there seems to be no change though.
plotOptions : {
series : {
dataGrouping : {
enabled : false
},
}
},
What options need to be set to stop the grouping and show the timeline as linear?
In case when you disable dataGrouping like this http://jsfiddle.net/szFQa/1/ then points are not grouped, because in your data you have 16 points and on the chart is also 16 points.
plotOptions: {
series: {
dataGrouping:{
enabled:false
},
marker: {
enabled: true
}
}
},