Files
OpenBK7231T_App/docs/commandExamples.md
openshwprojects 92072aae51 docs
2023-04-17 09:55:03 +02:00

55 lines
2.8 KiB
Markdown

# Console command examples
This file was autogenerated by running 'node scripts/getcommands.js' in the repository.
All command examples were taken from json file.
This will send a Tasmota HTTP Toggle command every 15 seconds to given device. Repeats value here is '-1' because we want this event to stay forever.
<br>```addRepeatingEvent 15 -1 SendGet http://192.168.0.112/cm?cmnd=Power0%20Toggle```<br>
This will send a Tasmota HTTP Toggle command to given device when a button on pin 8 is clicked (pin 8, NOT channel 8)
<br>```addEventHandler OnClick 8 SendGet http://192.168.0.112/cm?cmnd=Power0%20Toggle```<br>
This will set a Tasmota HTTP Power0 ON command when a channel 1 value become non-zero
<br>```addChangeHandler Channel1 != 0 SendGet http://192.168.0.112/cm?cmnd=Power0%20On```<br>
This will set a Tasmota HTTP Power0 OFF command when a channel 1 value become zero
<br>```addChangeHandler Channel1 == 0 SendGet http://192.168.0.112/cm?cmnd=Power0%20Off```<br>
This will create a new repeating events with 1 repeat count and 60 seconds delay everytime Channel1 becomes 1. Basically, it will automatically turn off the light 60 seconds after you turn it on. TODO: clear previous event instance?
<br>```addChangeHandler Channel1 == 1 addRepeatingEvent 60 1 setChannel 1 0```<br>
This is another approach to sending GET for change. As you can see, it's using addEventHandler instead of addChangeHandler. This will fire with every change. The index 1 here is a channel index. The $CH1 macro in URL will get expended to current channel value, usually 1 or 0
<br>```addEventHandler OnChannelChange 1 http://192.168.0.112/cm?cmnd=Power0%20$CH1```<br>
This will execute console command when IR event is received. Keep in mind it's using addEventHandler2, which is like addEventHandler, but takes two arguments.
<br>```addEventHandler2 IR_Samsung 0x707 0x61 led_enableAll 0```<br>
This will turn on LED with 500 temperature 500, dimmer 100 at 8:00:00 every Sunday (0x01 is a bit flag for Sunday, bit 0 means sunday, bit 1 monday, etc etc), 234 here is unique ID of clock event so you can remove it later. You MUST START NTP driver for it to work.
<br>```addClockEvent 8:00:00 0x01 234 backlog led_temperature 500; led_dimmer 100; led_enableAll 1;```<br>
This will turn on POWER at 12:00:00 every Sunday and Monday (0x01 is a bit flag for Sunday, bit 0 means sunday, bit 1 monday, etc etc), 567 here is unique ID of clock event so you can remove it later. You MUST START NTP driver for it to work.
<br>```addClockEvent 12:00:00 0x03 567 POWER ON```<br>
This simple timer will toggle LED state every 5 seconds. -1 hear means infinite repeats. The ! stands for negation and $led_enableAll is a constant that you can read to get 0 or 1. It works like $CH11, $CH4 etc (any number) for accessing channel value
<br>```addRepeatingEvent 5 -1 led_enableAll !$led_enableAll```<br>