I'm trying to publish the state of the device, as
Code: Select all
On System#Boot do
let,1,0
// gpio 2 -> relay state high = relay off
GPIO,2,1
Publish,%sysname%/status,Light Off
endon
on pb01#value do
gpiotoggle,2
if [VAR#1]=0
let,1,1 // state on
Publish,%sysname%/status,Light On
else
let,1,0 // state off
Publish,%sysname%/status,Light Off
endif
endon
on pb01on do
GPIO,2,0
let,1,1
Publish,%sysname%/status,Light On
endon
on pb01off do
GPIO,2,1
let,1,0
Publish,%sysname%/status,Light Off
endon
on pb01sw do
gpiotoggle,2
if [VAR#1]=0
let,1,1 // state on
Publish,%sysname%/status,Light On
else
let,1,0 // state off
Publish,%sysname%/status,Light Off
endif
endon
but by mqtt-explorer, the publish of on system#boot is not presented, showing:
192.168.1.6 > > Lamp-0101> status LWT = Connected
By Controller, i have:
openhab mqtt
ip: 192.168.1.6
Controller Subscribe: /%sysname%/#
Controller Publish: /%sysname%/%tskname%/%valname%
enabled: yes
But none of those is published either.
Any hint?
THX in advance