Hi,
I have a switch, operated by Domoticz, and this switch also has a manual knob.
(so the switch can be turned on/off automatically and by hand)
My question: if the switch is turned on or off, is there a way to find out who operated the switch, Domoticz or someone manually ?
(would like to use it in a script 'script-device-xxx.lua')
Who operated the switch: Domoticz or manually ?
Moderator: leecollings
-
- Posts: 550
- Joined: Tuesday 17 June 2014 22:14
- Target OS: NAS (Synology & others)
- Domoticz version: 4.10538
- Location: NL
- Contact:
Re: Who operated the switch: Domoticz or manually ?
This is also a nice to have in the logging
Synology NAS, slave PI3, ZWave (Fibaro), Xiaomi zigbee devices, BTLE plant sensor, DzVents, Dashticz on tablet, Logitech Media Server
-
- Posts: 63
- Joined: Sunday 14 July 2013 11:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Ipswich, UK
- Contact:
Re: Who operated the switch: Domoticz or manually ?
You'll need a switch that reports its new state when someone changes it or some way of monitoring the state of whatever is being switched. In the first instance, domoticz would get to know if someone changed the switch manually promptly. If you were polling the switch state, the second scenario, you might not get to discover the state had been changed for up to a minute, the polling interval. You would also miss intermediate switch stare changes.
- Marq
- Posts: 17
- Joined: Sunday 26 April 2015 12:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: Who operated the switch: Domoticz or manually ?
Solved it.
a. make a new uservariable
b. for each line of code where an On/Off command is sent to the switch, also write the new On/Off status to the uservariable
c. in the file 'script_device_***.lua' file, check if the switch was changed ('if devicechanged['yourswitch'] then ...'), and if so:
c1. check if the new On/Off status is different from the uservariable, and if so,
c1a. the switch was operated manually --> do your thing
c1b. write the new On/Off status to the uservariable
a. make a new uservariable
b. for each line of code where an On/Off command is sent to the switch, also write the new On/Off status to the uservariable
c. in the file 'script_device_***.lua' file, check if the switch was changed ('if devicechanged['yourswitch'] then ...'), and if so:
c1. check if the new On/Off status is different from the uservariable, and if so,
c1a. the switch was operated manually --> do your thing
c1b. write the new On/Off status to the uservariable
Who is online
Users browsing this forum: No registered users and 1 guest