Updating the status of Domoticz switches without triggering?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

User avatar
LumKitty
Posts: 8
Joined: Sunday 11 October 2015 12:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: South Wales, UK
Contact:

Updating the status of Domoticz switches without triggering?

Post 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?
SweetPants

Re: Updating the status of Domoticz switches without trigger

Post 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
User avatar
moomey
Posts: 4
Joined: Monday 07 September 2015 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Updating the status of Domoticz switches without trigger

Post by moomey »

Agree, it will be a very usefull thing
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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.
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Updating the status of Domoticz switches without trigger

Post by gizmocuz »

i think if you use the json udevice call it will not trigger the on/off actions ?
Quality outlives Quantity!
Sappien
Posts: 114
Joined: Saturday 24 August 2013 9:59
Target OS: Linux
Domoticz version: beta
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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
User avatar
moomey
Posts: 4
Joined: Monday 07 September 2015 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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
Last edited by moomey on Monday 28 December 2015 19:59, edited 1 time in total.
Sappien
Posts: 114
Joined: Saturday 24 August 2013 9:59
Target OS: Linux
Domoticz version: beta
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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)
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Clemen
Posts: 75
Joined: Saturday 05 December 2015 15:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Europe
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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
SweetPants

Re: Updating the status of Domoticz switches without trigger

Post by SweetPants »

Yep, still triggers On/Off action (2.4015)
Sappien
Posts: 114
Joined: Saturday 24 August 2013 9:59
Target OS: Linux
Domoticz version: beta
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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)
Clemen
Posts: 75
Joined: Saturday 05 December 2015 15:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Europe
Contact:

Re: Updating the status of Domoticz switches without trigger

Post by Clemen »

Any news on this?
lrybak
Posts: 40
Joined: Thursday 18 December 2014 20:12
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Poland
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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?
Last edited by lrybak on Sunday 24 January 2016 13:32, edited 1 time in total.
HW: HP dc7900 USD running ESXi, RaspberryPi (few of it), AEON S2 USB stick, Fibaro modules (Dimmers, switches), 1-wire (DS18B20, DS2423), DSC Alarm with Envisalink ethernet module, MySensors, RFLink
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Holland
Posts: 179
Joined: Friday 12 July 2013 13:53
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta Ch
Location: The Netherlands
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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.
Attachments
Knipsel1.JPG
Knipsel1.JPG (16.91 KiB) Viewed 10167 times
tequila
Posts: 60
Joined: Tuesday 02 August 2016 17:08
Target OS: -
Domoticz version:
Contact:

Re: Updating the status of Domoticz switches without triggering?

Post 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.
Andrex
Posts: 92
Joined: Thursday 18 February 2016 9:11
Target OS: Linux
Domoticz version:
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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!
shkaff
Posts: 16
Joined: Friday 11 December 2015 10:29
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Contact:

Re: Updating the status of Domoticz switches without triggering?

Post 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
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Updating the status of Domoticz switches without trigger

Post 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
Not using Domoticz anymore
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest