add the FOR AFTER RANDOM command to the API

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
jmleglise
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

Post by jmleglise »

Complete the switch command API with the FOR, RANDOM, AFTER keyword.

Today whe have :
/json.htm?type=command&param=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.
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
User avatar
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

Post by Egregius »

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.
jmleglise
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

Post by jmleglise »

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".
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
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: add the FOR AFTER RANDOM command to the API

Post by stlaha2007 »

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

Who is online

Users browsing this forum: No registered users and 1 guest