Using the following API endpoint I turn one of my lights on: json.htm?type=command¶m=switchlight&idx1&switchcmd=On
Is it possible to turn it on for x minutes using the API?
turn on for x minutes
Moderator: leecollings
-
- Posts: 638
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.2
- Location: Geleen
- Contact:
Re: turn on for x minutes
If you call it form a script, a simple wait or sleep or (depending on the language) coud do the trick.
ie
ON
sleep (xxx)
Off
ie
ON
sleep (xxx)
Off
Re: turn on for x minutes
Yes that is what I'm doing now, but there's no way to do it using the API then?
- waltervl
- Posts: 5378
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: turn on for x minutes
The application that sends that Domoticz API call should handle that....
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- waltervl
- Posts: 5378
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: turn on for x minutes
Never use a sleep in Domoticz scripts.
in dzvents use command options https://wiki.domoticz.com/DzVents:_next ... riggering)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Re: turn on for x minutes
I'm using PHP so it's easy to wait the number of seconds I want, but it requires an extra call to the API that's why I was hoping it was an option in the API but if not I'm gonna go with that. Cheers.
- waltervl
- Posts: 5378
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: turn on for x minutes
The Api is developed as interface between the Web User interface and the Domoticz Core application. So every action you do on the web UI results in one or more API calls. So Domoticz core is ready to handle multiple API calls 

Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Who is online
Users browsing this forum: No registered users and 1 guest