Created
March 10, 2020 19:26
-
-
Save daringer/9200cbd60421710e98c1c425771aae5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# License: BSD | |
# | |
# !! ATTENTION !! | |
# Do not spam the zwave network with too many set-config at once, it will | |
# bring the communication & network down. Best case is increasing the sleep below again by | |
# the factor of 2! | |
# | |
### replace with your homeassistant ip/hostname + port | |
URL="http://192.168.99.100:8123" | |
# set arbitrary configuration param: | |
# | |
# $ set_config_param <node_id> <config_id> <config_value> | |
# | |
function set_config_param { | |
curl -X POST "${URL}/api/services/zwave/set_config_parameter" -H "Content-Type: application/json" --data "{ \"node_id\": ${1}, \"parameter\": ${2}, \"value\": ${3} }" | |
} | |
# set wake-up configuration param (bat devices only) | |
# | |
# $ set_wakeup <node_id> <wakeup-time-in-secs> | |
# | |
function set_wakeup { | |
curl -X POST "${URL}/api/services/zwave/set_wakeup" -H "Content-Type: application/json" --data "{\"node_id\": ${1}, \"value\": ${2}}" | |
} | |
# get arbitrary configuration | |
# | |
# $ get_config <node_id> <config_id> | |
# | |
function get_config { | |
curl -X POST "${URL}/api/services/zwave/print_config_parameter" -H "Content-Type: application/json" --data "{ \"node_id\": ${1}, \"parameter\": ${2} }" | |
} | |
# print node information | |
# | |
# $ print_node <node_id> | |
# | |
function print_node { | |
curl -X POST "${URL}/api/services/zwave/print_node" -H "Content-Type: application/json" --data "{ \"node_id\": ${1} }" | |
} | |
# replace with the nodes you would like to set the config | |
nodes="60 66 56 61 58 59 65 57 62" | |
for node in $nodes | |
do | |
# set wakeup here (applicable with battery devices only) | |
set_wakeup $node 26100 | |
sleep 5 | |
# set config param: 20 to value: 1 | |
set_config_param $node 20 1 | |
sleep 5 | |
# set config param: 21 to value: 2 | |
set_config_param $node 21 2 | |
sleep 5 | |
## copy the lines above to set more configuration values | |
echo "done node id: $node" | |
sleep 20 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment