Open muchcodesuchwow opened 2 weeks ago
Try this:
>D
sw=0
>B
=>switchmode 1
=>switchtopic 0
>S
>E
sw=sw[0]
if chg[sw]>0 {
=>publish stat/%topic%/PIR1 %sw%
}
need to declare sw in the >D section. Switch1 as configured in GUI is sw[0], not sw[1]. Need to preface console commands with =>. switchmode 1 and switchtopic 0 can be entered into the console one time, not necessary to do every time in the script.
Hello, i am trying to add a switch to a esp8266 which has no rules but scripts enabled. (i also want to use SML on this esp, which requiers scripts).
The documentation is missing a simple example of a switch and i am struggeling hard to get this working. There is no real intro into the scripts. Please add a example script to read a switch, which also shows up in Home Assistant and give an easy introduction, how to get scripts working. I.e. i just discovered, that i need to write "Weblog 2" into the console, to see print output of the script after long struggle to understand the scripts.
My not working switch script is:
In the doc one can find this, but this does not help me:
Thank you very much
PROBLEM DESCRIPTION
A clear and concise description of what the problem is.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Status 0
:TO REPRODUCE
Steps to reproduce the behavior:
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
ADDITIONAL CONTEXT
Add any other context about the problem here.
(Please, remember to close the issue when the problem has been addressed)