How to update switch status ?

Moderator: leecollings

Galoula
Posts: 1
Joined: Wednesday 09 July 2014 19:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

How to update switch status ?

Post by Galoula »

Hi !

How I can update a switch status througth JSON ?

I use a dummy button with URL action for On and Off click (the URL point to other host to real ligth on or off).

If I use JSON "type=command&param=switchlight&idx=1&switchcmd=On" tu Action URL is called too, I can use this method, because I have a LOOP.

I need to update the ligth status with URL, but without action, but need when I click in GUI, the action.

Yes, I can turn off or turn on my ligths with an REAL button :D

How ?
pafs
Posts: 4
Joined: Thursday 10 July 2014 15:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by pafs »

I have a requirement for the exact same functionality.

I have a script that gets the real states of the devices. I want to update the domoticz switches and dimmers status accordingly, without issuing a command.

The param=udevice parameter of the json api doesn't seem to help either.
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: How to update switch status ?

Post by gizmocuz »

have you looked at the 'udevice' json command ? (use the search)
Quality outlives Quantity!
pafs
Posts: 4
Joined: Thursday 10 July 2014 15:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by pafs »

Thanks.

with 1.1940:
/json.htm?type=command&param=udevice&idx=8&svalue=Off works
/json.htm?type=command&param=udevice&idx=8&svalue=On does not work

plus I cannot find the correct command to update virtual dimmers.
Nath
Posts: 2
Joined: Sunday 01 March 2015 19:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by Nath »

Any update on this ?

Neither json command works
cherowley
Posts: 65
Joined: Tuesday 24 February 2015 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by cherowley »

I need this too.

Seems strange that something so basic isn't obvious :)
dijkdj
Posts: 63
Joined: Saturday 07 March 2015 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by dijkdj »

pafs wrote:Thanks.

with 1.1940:
/json.htm?type=command&param=udevice&idx=8&svalue=Off works
/json.htm?type=command&param=udevice&idx=8&svalue=On does not work

plus I cannot find the correct command to update virtual dimmers.
The problem is still the same. I also want to update my switches according to the status.
mrf68

Re: How to update switch status ?

Post by mrf68 »

Galoula wrote:....

I need to update the ligth status with URL, but without action, but need when I click in GUI, the action.
I think you can do this by using a dummy switch that is a slave to the original switch. A slave will update the status of the original switch without sending a code which would trigger the switch. Then you can use the URL to switch the slave.
dijkdj
Posts: 63
Joined: Saturday 07 March 2015 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by dijkdj »

The Hue and Zwave lights in Domoticz do exactly the same. They dont need dummy switches, do they?
Nath
Posts: 2
Joined: Sunday 01 March 2015 19:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by Nath »

No update ?
Raspberry Piet
Posts: 158
Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: How to update switch status ?

Post by Raspberry Piet »

pafs wrote: /json.htm?type=command&param=udevice&idx=8&svalue=Off works
/json.htm?type=command&param=udevice&idx=8&svalue=On does not work
Update your switch status without action:

Code: Select all

/json.htm?type=command&param=udevice&idx=8&nvalue=0
/json.htm?type=command&param=udevice&idx=8&nvalue=1
Edit:
I didn't read the question well. Now the question is clear, i don't have a usefull answer, sorry. (would like to know the solution too now)
Last edited by Raspberry Piet on Saturday 16 May 2015 23:27, edited 1 time in total.
Holland
Posts: 179
Joined: Friday 12 July 2013 13:53
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta Ch
Location: The Netherlands
Contact:

Re: How to update switch status ?

Post by Holland »

Hi tried the above, but apparently scripts attached to on a off action are still executed. Is it maybe possible to also exclude the script when updating the (dummy) switch to the current status?

Code: Select all
/json.htm?type=command&param=udevice&idx=8&nvalue=0
/json.htm?type=command&param=udevice&idx=8&nvalue=1
Holland
Posts: 179
Joined: Friday 12 July 2013 13:53
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta Ch
Location: The Netherlands
Contact:

Re: How to update switch status ?

Post by Holland »

Hi, just bumping it upwards, maybe has a solution.

Maybe to clarify a bit more.

1. A device (in this example a tv switch on or off demand) can be switched manually via the remote control. In this situation the virtual on/off switch should be updated accordingly, but the underlying script should not be executed. (otherwise you would fire the same action twise, or you fire the opposite action).

2. This device can also switched via Domoticz. In this situation the underlying script should be executed. The status of the device already updates as expected.

Maybe it's possible to add a commandline option, to ignore On action and Off action scripts when only the status is updated to the correct state.

Thanks
dewagt
Posts: 10
Joined: Thursday 19 February 2015 10:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by dewagt »

I was also searching for this feature. But the LUA scripts will use the status to determine if it is changed. So if the action would be disabled, the lua-scripts still will be started. So I think it's not easy to change this.
1x RPi B+
1x RFXcom433e
KAKU: 1x APA3-1500R (3 switches), 4x AMST-606, 1x ASUN-650, 1x AFR-060, 1x AFR-100
ELRO: 4x AB400
ELRO: 4x COCO GDR2-1000R
Wether: 3x Xiron outdoormeters, Alecto 4500, Alecto 1700
Doorbells: 2x action
LG-tv, Yamaha-receiver
Maartenc
Posts: 6
Joined: Wednesday 16 September 2015 22:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by Maartenc »

I'm also looking for this.

My lights are controlled by teleruptors (sort of relais).
If I toggle a dummy switch in domoticz, I want the action scripts to be executed, so I can actually toggle the teleruptor via a python script.
When I toggle a light with an actual physical button, I want to update the status of the switch in domoticz without executing the scripts. Otherwise I have an infinite loop:

-manually push a button toggles a teleruptor to turn on the light
-PI detects the push of the button and updates the status of the switch in domoticz via json
-Action script is executed and toggles a GPIO which turns the light off
-PI detects the toggle and updates the status of the switch in domoticz via json
-Action script is exec....

I tried working with temporary lock files, but this doesn't always work well, which causes the status of the switch in domoticz and the actual teleruptor out of sync.

I don't want to change any wiring. My physical buttons should work without domoticz.

So, a desperate call for a "do not execute action" option for json requests.
Maartenc
Posts: 6
Joined: Wednesday 16 September 2015 22:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by Maartenc »

As previous posted in this topic:

/json.htm?type=command&param=udevice&idx=8&svalue=Off works
/json.htm?type=command&param=udevice&idx=8&svalue=On does not work

Is this a bug? It would really be great if the on command would work in the same way as the off command works. The on command doesn't do anything, despite it returns a status:ok
mrf68

Re: How to update switch status ?

Post by mrf68 »

Maartenc wrote: ... When I toggle a light with an actual physical button, I want to update the status of the switch in domoticz without executing the scripts. ...
I suggest adding a new dummy switch and use that switch as a slave to the original dummy switch. Let me be a bit more specific.

I have dummy switch 1 and dummy switch 2. Dummy switch 1 is configured with an On Action and an Off Action, it turns dummy switch 2 On and Off with a json command. So when you press this dummy switch 1 On, the On Action script is executed and dummy switch 2 is set to On also.
Create a dummy switch 3. Then go back to dummy switch 1 and under Sub/Slaves add the dummy switch 3. Now when you switch dummy switch 3 to On, also dummy switch 1 will be set to On but the On Action script is NOT executed, so dummy switch 2 is NOT set to On.
Update your second step "PI detects the push of the button and updates the status of the switch in domoticz via json" by changing the IDX to the new dummy switch 3.

Could this be a solution?
yfaykya
Posts: 8
Joined: Wednesday 07 January 2015 19:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by yfaykya »

This seems very convoluted. Does anyone know if this is a bug (ie off works but on does not) and if there is an intention to look at it or is the fact that off works the bug!

I have added logic into my home heating controller (arduino) to work around this by ignoring the domoticz action if the controller had set the switch direct but I don't like having that workaround in there.
Ideally one could pass an extra flag with the api that says do not do any actions on update. Is gizmocuz interested in this? I could take a stab if not a waste of time.
Sappien
Posts: 114
Joined: Saturday 24 August 2013 9:59
Target OS: Linux
Domoticz version: beta
Contact:

Re: How to update switch status ?

Post by Sappien »

I've got the same issue..

Setting Off works, but On not!

Code: Select all

# curl "http://localhost:8080/json.htm?type=command&param=udevice&idx=1&svalue=Off"
{
   "status" : "OK",
   "title" : "Update Device"
}
-----

I did a bug "report" viewtopic.php?f=6&t=8717
Averell
Posts: 5
Joined: Monday 22 September 2014 13:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to update switch status ?

Post by Averell »

Set the nvalue to 1
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests