Hi all,
I have a Domoticz server running on Windows 10 with an MQTT broker for my Sonoff Tasmota switches.
Now I would like to activate a scene from a remote windows computer using command line/batch file.
Anybody any idea how to do this?
Cheers,
Arco
activate a scene from a remote computer CL
Moderator: leecollings
Re: activate a scene from a remote computer CL
curl -s 'http://<server>:<port>/json.htm?type=command¶m=switchscene&idx=&switchcmd="<On or Off>"' where idx is the ID of the scene.
See: https://www.domoticz.com/wiki/Domoticz_ ... _on_or_off
See: https://www.domoticz.com/wiki/Domoticz_ ... _on_or_off
-
- Posts: 3
- Joined: Tuesday 11 September 2018 20:17
- Target OS: Windows
- Domoticz version:
- Contact:
Re: activate a scene from a remote computer CL
@SweetPants, cURL and JSON don't mix in that way but you've given me some more leads to explore, many thanks!
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: activate a scene from a remote computer CL
curl does not like the ? and & so they need to be escaped or put the whole http string between double quotes.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 3
- Joined: Tuesday 11 September 2018 20:17
- Target OS: Windows
- Domoticz version:
- Contact:
Re: activate a scene from a remote computer CL
I've been reading that POST would need to be used but the double quotes work wonders, many thanks lads!
-
- Posts: 132
- Joined: Monday 07 August 2017 17:17
- Target OS: Linux
- Domoticz version: Latest β
- Location: Near London (Saaarf!)
- Contact:
Re: activate a scene from a remote computer CL
A bit late but this could be used as an alternative:
Or you could use one of these which will update the status of a device without triggering any script that is associated with that device:
Will switch device on
Will switch device off (not for scenes as they can only be switched on this way)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Edit:Just realised I didn't read the original post properly and the examples that I have given are for use in a lua script, not on a command line. Still they could be useful for someone.
FURTHER EDIT: These methods only change the status of a device and not actually trigger the device's action, I have only used them for dummy devices so didn't realise that this was the case until I did some proper testing.
Code: Select all
commandArray[#commandArray+1] = {['OpenURL']='http://<domoticzIP>:<port>/json.htm?type=command¶m=switchscene&idx=<sceneidx>&switchcmd=On'}
Code: Select all
commandArray[#commandArray+1] = {['UpdateDevice'] = '<deviceidx>|1|1'}
Code: Select all
commandArray[#commandArray+1] = {['UpdateDevice'] = '<deviceidx>|0|0'}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Edit:Just realised I didn't read the original post properly and the examples that I have given are for use in a lua script, not on a command line. Still they could be useful for someone.
FURTHER EDIT: These methods only change the status of a device and not actually trigger the device's action, I have only used them for dummy devices so didn't realise that this was the case until I did some proper testing.
Domoticz Latest β, RPi 4B with 110Gb SSD for Domoticz, RPi 4B with 110Gb SSD for Node-Red & a RPi 2B for logging / IP addressing. RFXCOM, PiZiGate, Z-Wave, Harmony, Hue lamps and a bit of Broadlink.
Who is online
Users browsing this forum: No registered users and 1 guest