Page 1 of 1
Keep push button pressed in Domoticz
Posted: Friday 29 November 2024 15:07
by Korrel
Hi guys,
I have a VEVOR diesel heater with a 4 button chinese remote control... When i want to switch the heater on or off i have te keep the button on that remote pressed for 3 seconds before the heater responds...
The remote control is 433 Mhz and i have learned the remote control buttons to push on/off buttons in Domoticz using RFXCOM ...
How do i keep the buttons pressed in domoticz UI or script ??
Re: Keep push button pressed in Domoticz
Posted: Friday 29 November 2024 19:46
by waltervl
In a dzvents script use the .switchOn().forSec(3) command.
Re: Keep push button pressed in Domoticz
Posted: Friday 29 November 2024 20:03
by HvdW
waltervl wrote: ↑Friday 29 November 2024 19:46
In a dzvents script use the .switchOn().forSec(3) command.
and put that in a loop.
Here's another to try:
Code: Select all
return {
active = true,
on = {
devices = { 'JouwSchakelaar' }
},
execute = function(domoticz, device)
if device.state == 'On' then
local startTime = os.time()
while os.time() - startTime < 3 do
domoticz.devices('JouwSchakelaar').switchOn()
end
domoticz.devices('JouwSchakelaar').switchOff()
end
end
}
Re: Keep push button pressed in Domoticz
Posted: Friday 29 November 2024 21:51
by waltervl
Or use device setting off delay? But I am always confused on that setting. You better try it out.
Edit: should indeed work. From wiki
The Off delay on switch device causes a device to switch Off with a delay of the set amount of seconds after the device switched to On
Re: Keep push button pressed in Domoticz
Posted: Friday 29 November 2024 23:03
by HvdW
Don't try the loop, it'll end up into an endless loop.
Walters'solution domoticz.devices('YourSwitch').switchOn.forSec(3) is the one.
Re: Keep push button pressed in Domoticz
Posted: Saturday 30 November 2024 11:41
by PierreT
HvdW wrote: ↑Friday 29 November 2024 23:03
Don't try the loop, it'll end up into an endless loop.
Walters'solution domoticz.devices('YourSwitch').switchOn.forSec(3) is the one.
I actually think your approach is the correct one, though it requires additional thinking. The challenge here is not to switch on and then switch off after some amount of time, but to keep sending the "on" signal for 3 seconds.
Valuable information in this case is whether you actually need to keep the key on the remote pressed for three seconds or that it will also work if you press it three (or more) times in rapid succession. Note that if you add the repeated "on" signal to the actual linked switch that this will also eliminate the hold for 3 seconds on the original remote as Domoticz will trigger on the first signal sent and take over to complete the sequence. You may actually find that switching the device on with the original remote no longer functions because of interference between the two signals.
Re: Keep push button pressed in Domoticz
Posted: Saturday 30 November 2024 15:58
by waltervl
For RF long press signal you better check this topic:
viewtopic.php?t=41057
Re: Keep push button pressed in Domoticz
Posted: Saturday 30 November 2024 16:32
by Korrel
PierreT wrote: ↑Saturday 30 November 2024 11:41
HvdW wrote: ↑Friday 29 November 2024 23:03
Don't try the loop, it'll end up into an endless loop.
Walters'solution domoticz.devices('YourSwitch').switchOn.forSec(3) is the one.
I actually think your approach is the correct one, though it requires additional thinking. The challenge here is not to switch on and then switch off after some amount of time, but to keep sending the "on" signal for 3 seconds.
Valuable information in this case is whether you actually need to keep the key on the remote pressed for three seconds or that it will also work if you press it three (or more) times in rapid succession. Note that if you add the repeated "on" signal to the actual linked switch that this will also eliminate the hold for 3 seconds on the original remote as Domoticz will trigger on the first signal sent and take over to complete the sequence. You may actually find that switching the device on with the original remote no longer functions because of interference between the two signals.
U were right on both, the hold didn't work and i got an endless loop so i created a dummy on/off switch that sends the push on button repeatedly and and the push off repeatedly...
The three seconds loop will however create >100 switchon commands (got errors on scripts too many lines and lasting too long), so i adjusted the scripts to send approx 40 rf commands ....
Works fine now...
With a rf temp sensor and a dummy setpoint i have working thermostate on the diesel heating and "SIRI" is controlling the temperature
Thanks to all for your valuable feedback !
Re: Keep push button pressed in Domoticz
Posted: Saturday 30 November 2024 22:09
by HvdW
@Korrel can you show us your script?
Plus I guess that just the 40 switchOn() commands will give you the same result.
Re: Keep push button pressed in Domoticz
Posted: Sunday 01 December 2024 0:25
by waltervl
Re: Keep push button pressed in Domoticz
Posted: Tuesday 03 December 2024 15:59
by Korrel
HvdW wrote: ↑Saturday 30 November 2024 22:09
@Korrel can you show us your script?
Plus I guess that just the 40 switchOn() commands will give you the same result.
The code :
Code: Select all
return {
on = {
devices = {
'Tuinhuisje - Verwarming'
}
},
execute = function(domoticz, device)
if device.state == 'On' then
local startTime = os.time()
while os.time() - startTime < 2 do
domoticz.devices('Tuinhuisje - Verwarming Vevor - Aan').switchOn()
end
end
if device.state == 'Off' then
local startTime = os.time()
while os.time() - startTime < 2 do
domoticz.devices('Tuinhuisje - Verwarming Vevor - Uit').switchOn()
end
end
end
}
The result...
Code: Select all
2024-12-03 15:47:57.838 Status: User: bas (IP: 192.168.1.76) initiated a switch command (12402/Tuinhuisje - Verwarming/On)
2024-12-03 15:47:57.897 Status: dzVents: Info: Handling events for: "Tuinhuisje - Verwarming", value: "On"
2024-12-03 15:47:57.897 Status: dzVents: Info: ------ Start internal script: Tuinhuisje - Verwarming Vevor: Device: "Tuinhuisje - Verwarming (Dummy)", Index: 12402
2024-12-03 15:47:58.994 RFXCOM: Temp + Humidity (Zwembadwater)
2024-12-03 15:47:59.096 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:47:59.172 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:47:59.247 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:47:59.322 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:47:59.397 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:47:59.472 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:47:59.547 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:47:59.623 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:47:59.698 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:47:59.004 Status: dzVents: Info: ------ Finished Tuinhuisje - Verwarming Vevor
2024-12-03 15:48:00.075 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.149 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.224 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.305 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.375 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.450 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.526 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.600 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.676 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.751 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.826 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.901 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:00.977 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.052 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.127 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.211 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.279 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.354 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.430 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.505 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.581 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.656 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.733 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.807 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.882 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:01.958 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.033 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.107 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.184 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.259 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.336 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.456 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.517 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.591 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.667 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.769 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.846 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.919 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:02.995 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.070 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.145 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.220 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.295 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.370 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.446 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.521 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.596 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.671 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.746 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.821 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.897 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:03.972 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:04.050 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:04.125 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:04.201 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:04.276 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:04.348 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:04.427 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:04.505 RFXCOM: Lighting 4 (Tuinhuisje - Verwarming Vevor - Aan)
2024-12-03 15:48:04.414 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
approx 40 RF commands in about 5 seconds
but still the heater is not always picking up the on command :S
Re: Keep push button pressed in Domoticz
Posted: Tuesday 03 December 2024 16:02
by Korrel
waltervl wrote: ↑Sunday 01 December 2024 0:25
I read it, which part of this topic is a key to the solution ?
Re: Keep push button pressed in Domoticz
Posted: Tuesday 03 December 2024 16:49
by waltervl
The part were the rfxcom expert (and owner) b_weijenberg advises to use the RAW data. See also the topic he refered to
viewtopic.php?t=27260
Sending 40 commands in 3 seconds is potentially not OK for Domoticz (depending on your hardware). It could miss some events now.