Complete the switch command API with the FOR, RANDOM, AFTER keyword.
Today whe have :
/json.htm?type=command¶m=switchlight&idx=99&switchcmd=On
I need switchcmd=On FOR xxx
This is available in LUA commandArray. but not in the API. (It's a rare case where the API is less complete than LUA).
Why is it important ?
For some accurate timer, (Ex : alarm system triggered in 30 sec) I need the AFTER 30 sec keyword to trigger some switches. But I can't use LUA because "by design" LUA, doesn't trigger the eventSystem for the virtual switch. Only the use of API / GUI trigger the event.
So I'm fucked.
add the FOR AFTER RANDOM command to the API
Moderators: leecollings, remb0
-
- Posts: 192
- Joined: Monday 12 January 2015 23:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: FRANCE
- Contact:
add the FOR AFTER RANDOM command to the API
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: add the FOR AFTER RANDOM command to the API
How about php?
sleep(30)
But maybe first better explain why it has to be exactly after 30 seconds. Aren't there cases when you don't want to fire after 30 seconds and thus break the wait time?
If I understand correctly if you sent a ON AFTER 30 it will switch on after 30 seconds, no mather what you do in that time.
Therefore I always use a evalutation after the 30 seconds time to see if the action is still nescessary.
sleep(30)
But maybe first better explain why it has to be exactly after 30 seconds. Aren't there cases when you don't want to fire after 30 seconds and thus break the wait time?
If I understand correctly if you sent a ON AFTER 30 it will switch on after 30 seconds, no mather what you do in that time.
Therefore I always use a evalutation after the 30 seconds time to see if the action is still nescessary.
-
- Posts: 192
- Joined: Monday 12 January 2015 23:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: FRANCE
- Contact:
Re: add the FOR AFTER RANDOM command to the API
Hi egregus,
Sorry, I know you are looking for some friends on php
but, I use LUA and python and that's enough for me.
My point seems just an "evidence". Domoticz offers the feature to switch FOR x , AFTER x, but not by the API. I report a "shortage".
Sorry, I know you are looking for some friends on php

My point seems just an "evidence". Domoticz offers the feature to switch FOR x , AFTER x, but not by the API. I report a "shortage".
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
-
- Posts: 370
- Joined: Monday 05 October 2015 10:16
- Target OS: -
- Domoticz version:
- Contact:
Re: add the FOR AFTER RANDOM command to the API
Would be handy, however scenes/groups have this buildin, so to say slave switches with delayed on or off. Using this to switch on/off lights with predefined delays from 2 to 10 seconds.
Perhaps create a scene/group with that 'delayed' switch with on delay of 30 seconds and toggle or on/off that scene/group?
Perhaps create a scene/group with that 'delayed' switch with on delay of 30 seconds and toggle or on/off that scene/group?
Who is online
Users browsing this forum: No registered users and 1 guest