Page 1 of 2

Updating the status of Domoticz switches without triggering?

Posted: Tuesday 20 October 2015 3:02
by LumKitty
Firstly apologies for dumping this in the general forum, none of the subforums seemed appropriate.

I have a few virtual switches in my setup that fire off bash scripts using script:/// this is because I have milight/applight bulbs but need them to do a soft fade in/out as sudden changes in light levels trigger my partner's migraines.

The problem comes when other events fire that also affect these bulbs and change their status in some way.

I was wondering if there's a JSON call or similar that I can use to update Domoticz without causing the on/off scripts to fire?

Re: Updating the status of Domoticz switches without trigger

Posted: Sunday 13 December 2015 12:01
by SweetPants
LumKitty wrote:I was wondering if there's a JSON call or similar that I can use to update Domoticz without causing the on/off scripts to fire?
I would love to see this implemented too

Re: Updating the status of Domoticz switches without trigger

Posted: Sunday 13 December 2015 22:31
by moomey
Agree, it will be a very usefull thing

Re: Updating the status of Domoticz switches without trigger

Posted: Monday 14 December 2015 7:21
by jannl
You could use a virtual switch for the switches where you need sometimes not to execute the scripts. Connect the scripts to the virtual switch and operate the actual script when you do not want the scripts fired.

Re: Updating the status of Domoticz switches without trigger

Posted: Friday 18 December 2015 19:14
by gizmocuz
i think if you use the json udevice call it will not trigger the on/off actions ?

Re: Updating the status of Domoticz switches without trigger

Posted: Sunday 20 December 2015 14:26
by Sappien
last time I had a issue with that ( posting.php?mode=quote&f=6&p=64357 )

Didn't tested it again, just moved to my new home, next week I'm going to install Domoticz again

Re: Updating the status of Domoticz switches without trigger

Posted: Saturday 26 December 2015 23:17
by moomey
gizmocuz wrote:i think if you use the json udevice call it will not trigger the on/off actions ?

/json.htm?type=command&param=udevice&idx=42&nvalue=0&svalue=Off

/json.htm?type=command&param=udevice&idx=42&nvalue=1&svalue=On

Re: Updating the status of Domoticz switches without trigger

Posted: Sunday 27 December 2015 18:08
by Sappien
Try

/json.htm?type=command&param=udevice&idx=42&nvalue=0&svalue=

/json.htm?type=command&param=udevice&idx=42&nvalue=1&svalue=

(It's working for me now)

Re: Updating the status of Domoticz switches without trigger

Posted: Sunday 27 December 2015 23:14
by nayr
sweet thanks for that.. was just needing that functionality.

What Ive been doing is creating a uservariable and lua to help my devices from getting stuck in a loop..

for example, I monitor my surround sound system for manual input changes.. so if someone changes an input with a remote it updates domoticz instantly.. Well this has a problem that it then triggers a lua to turn it on like the button was pressed manually and then it starts a loop.

Code: Select all

if (devicechanged['Nexus Player'] == 'Off') and (uservariables['nexusloop'] == 1) then
        commandArray['Variable:nexusloop'] = tostring(0)
end
if (devicechanged['Nexus Player'] == 'On') and (uservariables['nexusloop'] == 0) then
        commandArray['Variable:nexusloop'] = tostring(1)
        print("Nexus Player Turned on, setting up home theatre system..")
        if (otherdevices['TV'] == 'Off') then
                commandArray['Surround Sound']='On'
                commandArray['TV']='On'
        elseif (otherdevices['TV'] == 'On') then
                commandArray['PlayStation 3']='Off'
                commandArray['PlayStation 4']='Off'
                commandArray['Mute']='Off'
        end
        commandArray['OpenURL']='localhost:8090/nexus'
end
but it'd of been much easier to just have my external app monitoring the avr to update the status without triggering anything, however sometimes I may want to trigger events.. only once.

Re: Updating the status of Domoticz switches without trigger

Posted: Monday 28 December 2015 16:37
by Clemen
Sappien wrote:Try

/json.htm?type=command&param=udevice&idx=42&nvalue=0&svalue=

/json.htm?type=command&param=udevice&idx=42&nvalue=1&svalue=

(It's working for me now)

Is still triggering the on and off action i am on version 2.3867

Re: Updating the status of Domoticz switches without trigger

Posted: Monday 28 December 2015 19:28
by SweetPants
Yep, still triggers On/Off action (2.4015)

Re: Updating the status of Domoticz switches without trigger

Posted: Monday 28 December 2015 20:37
by Sappien
Strange, on my test Pi (2.3530) it's working fine now. I will try it on my other Domoticz server (which is running latest beta)

Re: Updating the status of Domoticz switches without trigger

Posted: Saturday 23 January 2016 19:30
by Clemen
Any news on this?

Re: Updating the status of Domoticz switches without trigger

Posted: Sunday 24 January 2016 2:13
by lrybak
For me the same (2.4269)
I'd like to change only status of virtual switch (Door lock) without triggering On/Off script
I've checked all possible json api combinations but always On/Off scripts are triggered
/json.htm?type=command&param=udevice&idx=219&nvalue=1&svalue=1
It sets state: Open and triggers On script

/json.htm?type=command&param=udevice&idx=219&nvalue=1&svalue=0
It sets state: Open and triggers On script

/json.htm?type=command&param=udevice&idx=219&nvalue=0&svalue=1
It sets state: Closed and triggers Off script

/json.htm?type=command&param=udevice&idx=219&nvalue=0&svalue=0
It sets state: Closed and triggers Off script
Is it bug or feature?

Re: Updating the status of Domoticz switches without trigger

Posted: Sunday 24 January 2016 3:05
by nayr
This is by design, when you press a button on the UI it makes that same JSON call.. This is an event, and it triggers them as such.

I can see the need for updating without an event, but this functionality does not exist currently.. perhaps an &silent feature can be added to it so it does not trigger an event.

Until then the easiest way to prevent your event/script from firing is use a uservariable, set that variable to disable your event and then use it any time you dont want it triggered.

Re: Updating the status of Domoticz switches without trigger

Posted: Sunday 24 January 2016 14:30
by Holland
Also proponent for such a silent future. In my case, the Sonos switch status used in Domoticz should always follow the state of the Sonos player, even when the player is controlled outside of Domoticz

Will try the workaround via the uservar

See screenshot below, these buttons should always follow the actual state of my Sonos player.

Re: Updating the status of Domoticz switches without triggering?

Posted: Wednesday 24 August 2016 8:26
by tequila
I guess no news on this, right? I also failed with updating just the state of the switch via the above json call with latest stable, but no success.
It always triggers the on/off action of the switch.

Re: Updating the status of Domoticz switches without trigger

Posted: Wednesday 02 November 2016 10:39
by Andrex
nayr wrote:I can see the need for updating without an event, but this functionality does not exist currently.. perhaps an &silent feature can be added to it so it does not trigger an event.
Any news on this It would be so much useful!
nayr wrote:Until then the easiest way to prevent your event/script from firing is use a uservariable, set that variable to disable your event and then use it any time you dont want it triggered.
I don't know how it can works, is there anybody that can try to explain it?
Thanks!

Re: Updating the status of Domoticz switches without triggering?

Posted: Wednesday 02 November 2016 12:44
by shkaff
it's a development platform so you have to develop any deviation from the functionality you are given...

In my case, i use MQTT Client Gateway with LAN interface so any changes in switches are dumped in MQTT topic domoticz/out where I can catch them using Node-Red and process as I want. Some people prefer using internal scripting mechanism based on LUA or Python.

If I want to change a switch and avoid effect of loop triggering, then I need to ignore triggering happened just after I change the switch.
In my case I change the switch via MQTT topic domoticz/in (or via HTTP JSON interface) with a little mark (a kind of user variable) by specifying SVALUE special mark like "1;_pass_"
So when I have it back because of unwanted triggering then my Node-Red script scans SVALUE for this mark "_pass_" and does nothing if it's found

That's my way to ignore unwanted triggering

If you prefer to play with LUA scripts then you need to remember something unique for the switch you are going to change in a user variable, and when you have a resulting triggering event then you can check if it matches to the unique mark stored previously in the user variable = and does nothing if it matches

Re: Updating the status of Domoticz switches without trigger

Posted: Tuesday 08 November 2016 0:35
by G3rard
You can update the status of a switch without triggering any actions with commandArray['UpdateDevice'].
The following code lets you update a selector switch to level 10 without any triggering:

Code: Select all

commandArray['UpdateDevice'] = '263|10|10'
263 = idx
10 = level