Hi,
I am beginner at openhab2.
I have 2 pieces arduino. ¨
1x - for switches of lights.
1x - for relays.
If I press any switch arduino will send mqtt message to topic house/switch/PIN_NUMBER in format:
{"info":{"id":37,"status":"ON","intensity":"0","step":2}}
id - PIN NUMBER … in this example 37
status - status of switch
intensity - it for dimmable light
step - number of pressing
My idea:
When received MQTT message at topic house/switch/37
I would like to change status in Openhab2 and send MQTT message to control relay.
I need read original MQTT message in rules because I have to edit new MQTT message.
For example if received msq {“id”:37,“status”:“ON”,“intensity”:“0”,“step”:1}} with step 1 I will switch on/off just one relay. But if I received msg with step 2 I would like to switch on/off more relays.
I dont know how to do it
Thank you for your help
Items:
Switch Boiler_Light "Light" <light> (Boiler, gLight) ["Lighting"] {mqtt="<[mosquitto:house/switch/37:state:JSONPATH($.info.stav)]"}
Rules:
rule "TEST"
when
Item Boiler_Light received command
then
logInfo("Recived command",receivedCommand.toString)
end