Page 1 of 1

Blocky add show hide switch

Posted: Monday 05 December 2016 23:50
by devros
hello,
It would be very nice to add roomplan support to blocky, or way to show hide switches (maybe only add hidden/visible operator).
I have few switches that are usefull only in some condition and this would be great way to make stuff clean.

Re: Blocky add show hide switch

Posted: Friday 23 December 2016 9:16
by cjb75
I have the same question (I think), can I hide/show switches depending on their status (e.g. on -> show)? I know that if I add $ to the beginning of the switch name is will become hidden but how can I do that from a script?

For me it's find using lua (preferably dzVents).

Re: Blocky add show hide switch

Posted: Friday 23 December 2016 9:26
by Egregius
Use the developer console of a good browser to find the url.
You can change the name with a url like this (from Switches tab):

Code: Select all

http://192.168.2.10:8084/json.htm?type=setused&idx=5&name=NAMEOFSWITCH&description=&strparam1=&strparam2=&protected=false&switchtype=0&customimage=5&used=true&addjvalue=0&addjvalue2=0&options=
From the device table the url is even cleaner:

Code: Select all

http://192.168.2.10:8084/json.htm?type=command&param=renamedevice&idx=5&name=NAMEOFSWITCH
Attention: renaming a device requires that your scripts work with both NAMEOFSWITCH and $NAMEOFSWITCH
Could be a difficult way to go...

Re: Blocky add show hide switch

Posted: Friday 23 December 2016 15:37
by cjb75
Great - thanks!

In my script (dzVents) I'm using the ID to identify the switch and hopefully avoid problems with different names...

Code: Select all

return {
..
        on = {
                --'Test_Switch',
                --'$Test_Switch',
                3
        },
        execute = function(domoticz,switch)
..