i have wall switch with mqtt. Switch send into topic “Dum/Vypinac7/sv1” ON/OFF.
Light is conected on modbus.
can mqtt command be combined with modbus in one item?
2019-09-13 17:27:50.573 [GroupItemStateChangedEvent] - gLight changed from OFF to ON through Light14
2019-09-13 17:28:08.893 [GroupItemStateChangedEvent] - gLight changed from ON to OFF through Light14
In paperUI, the switch switches but the light is off.
If I switch the switch manually, the light comes on.
if I use rules, it works.
I don’t want to use rules for switches, it has about 100 lines (15 switch functions) and if I have 5-10 switches, the rules respond slowly.
If you were using MQTT and Modbus version 2 bindings, you could use a follow profile.
The modbus binding is only going to respond to a command, not a state change, so you need to find out how to get MQTTv1 to produce a command on input.
Something else wrong there. This is not a difficult job. You might need to think about if really you want both devices updating to the same Item. Remember Modbus polls regularly.
I use modbus 1.x
I also tried modbus 2.4, I tried [profile = “follow”] but it doesn’t work.
Still change state from mqtt does not create a command for modbus.
You can’t use the follow profile with the modbus 1.x
You can’t tell MQTT to use the topic inbound as a command as it is the same outbound topic so you’ll end up with an MQTT infinite loop.
You are going to have to bite the bullet and either use modbus 2.x or MQTTv2
For now I would advise you go for modbusv2. I am not sure if you’ll end up with an infinite loop in MQTTv2 just the same.
Perhaps you can get rid of that to prevent loops. What is your purpose in sending openHAB commands to a wall switch, is this controlling a light as well?
Maybe pointless, I’m sending a state of light.
If the light is ON, the wall switch sends OFF, if the light is OFF the wall switch sends ON
A better solution would be if the wall switch would send a “change” and openhab would switch the item.
How to configure an item in openhab for “change” from MQTT?
can the item be set that the wall switch will only send “CHANGE” to the topic “Dum / Switch1 / sv1” and openhab would switch the item (switch) to the opposite value?
Any transform? Without rules…
No, because the value sent into openhab is CHANGE, not the switch payload,
The binding is replacing EVERY payload, with CHANGE
Set the item definition as it was before, when it was working
I am not sure I understand what you want to do