in short my question are:
how to change an openHAB button state (active/inactive) from a rules file? What is the syntax?
and the full story…
I built my own home control system hardware and software, based on two Beaglebone Greens.
Theres a board for input (switches) and one for output (relays or lights basically).
The input board reads the switches and sends a command to the output board.
The output board then sends a status of all outputs back. Like this
switch number 4 pressed -> INPUTBOARD -> send command ‘P4’ -> OUTPUTBOARD -> toggle some light -> return string “0,1,0,1,0,1,1,0,0,1,1,0,0,0,1,0,0”
The return string are comma seperated 0’s or 1’s reflecting the state of the lights in a numbered order.
It works nice, but I’d like to have a nice GUI/dashboards, so that’s why I started looking at openHAB.
I used the exec binding and button widget in the HABPanel.
When I click that button, I pass the value P4 to the control item of the exec binding, and with %2$s in the command line, the P4 is passed to my command that sends P4 to my output board.
The button is configured with the Action type as : “send a fixed command to an item” and the Command value is whatever P-number needed
Cool! that works
I like to get the return value from the command, which tells the actual status of the lights and set the active/inactie state of the button widget accordingly.
I can’t find how to address these button properties.
I figure it must be a rule like
Item setswitch_output received update
if setswitch_output==0 ; then panel.button1.state=inactive; else panel.button1.state=inactive
if setswitch_output==0 ; then panel.button2.state=inactive; else panel.button1.state=inactive
thing is… I don’t know how to control the state of the button
but the logs always show
Rule ‘statusupdate’: The name ‘button1’ cannot be resolved to an item or type;