Logic Machine Forum
Access to tags field from Mosaic js - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Access to tags field from Mosaic js (/showthread.php?tid=775)



Access to tags field from Mosaic js - Anton Voskresenskiy - 06.05.2017

Hi,

Is it possible to use grp.gettags(alias) directive in Mosaic custom widgets?

I've modified original "light-switch" widget with the following code, but it does not seem to work:

Code:
readTags : function(i) {
    var value = false;
    var o = "object-"+i;
    if(grp.gettags(o)) value = grp.gettags(o);  
    return value;
},

Then I insert this string in _.template section:

Code:
<%=readTags(i)%>

But I get an error 'TypeError: this.grp is undefined'.

The idea is to use tags from group addresses to display custom images on switch buttons instead of ON/OFF text, corresponding to the type of lamp its is associated with. Each room has different set of lamps, eg wall lamp, ceiling lamps, table lamp, down lights etc... If we could read tags associated with these lamps (group addresses)  - it will be possible to put corresponding images automaticaly.

Thanks for any help.


RE: Access to tags field from Mosaic js - admin - 08.05.2017

grp functions are only available in main/touch visualizaion, but not in Mosaic