This code is usable only if you are on Home Assistant 0.114 or older
For Home Assistant 0.115 and newer please go to: https://github.com/AdamNaj/ZWaveGraphHA
| let switchId = 1; | |
| let checkPeriod = 60 * 1000; // in ms | |
| let haUrl = 'http://192.168.50.10:8123'; | |
| let mode = "detached"; // Could be "detached", "flip", "follow" or "momentary". Use "detached" when HA is in control | |
| function updateConfig(oldConfig) { | |
| //Apply the new config only if the switch is not already working in the desired mode | |
| if (oldConfig.in_mode !== mode) { | |
| print("switching it up"); | |
| Shelly.call("Switch.SetConfig", { id: switchId, config: { in_mode: mode } }); |
This code is usable only if you are on Home Assistant 0.114 or older
For Home Assistant 0.115 and newer please go to: https://github.com/AdamNaj/ZWaveGraphHA