I am attempting to use http request to turn a light on/off but no success thus far. Is there any example code available?
I am new to Zwave and any information would be appreciated.
Thanks,
http commands
Re: http commands
Just use some of the APIs, like e.g.:
http://HOST:8083/ZAutomation/api/v1/dev ... command/on
http://HOST:8083/ZAutomation/api/v1/dev ... ommand/off
http://HOST:8083/ZAutomation/api/v1/dev ... command/on
http://HOST:8083/ZAutomation/api/v1/dev ... ommand/off
Re: http commands
Multiple ways to skin a cat. I think it's better to use /ZwaveAPI rather than /ZAutomation, unless you want to control a automation group or something. In my example I am using device #5.
The command for a single switch on / off, once authenticated from a web browser.
To do this from the command line you need to authenticate first and save a session cookie...
Then you use that session cookie for all subsequent requests with --load-cookies.
From my testing the session cookie will at last about 24 hours, or a z-way-server restart, which ever is first.
The command for a single switch on / off, once authenticated from a web browser.
Code: Select all
#on
http://127.0.0.1:8083/ZWaveAPI/Run/devices[5].instances[0].commandClasses[25].Set(255)
#off
http://127.0.0.1:8083/ZWaveAPI/Run/devices[5].instances[0].commandClasses[25].Set(0)
Code: Select all
wget -q --header "Accept: application/json" --header "Content-Type: application/json" --post-data '{"form":true,"login":"admin","password":"admin","keepme":false,"default_ui":1}' http://127.0.0.1:8083/ZAutomation/api/v1/login --keep-session-cookie --save-cookie /tmp/zway-cookie.txt -O - 1>&2 >/dev/null
Code: Select all
wget --load-cookies /tmp/zway-cookie.txt "http://127.0.0.1:8083/ZWaveAPI/Run/devices[5].instances[0].commandClasses[25].Set(255)" - O - 1>&2 >/dev/null
Re: http commands
Thanks for the swift reply, I will try this.
Re: http commands
Define "better"viper384 wrote:Multiple ways to skin a cat. I think it's better to use /ZwaveAPI rather than /ZAutomation, unless you want to control a automation group or something.
