I am using the profile=follow function for two of my items, but this isn´t working as expected.
These are two sonoff tasmota wall switches which don´t switch anything physically.
I only switch a “dummy switch” for activating an alarm rule.
What I cannot get working is that these two switches are working in both directions - meaning when A is switched B is following and vice versa. Currently A is activating/deactivating B but not in the opposite direction.
Hi, I just tried this but unfortunately it doesn´t work.
Now only the command from PaperUI gets reflected on both switches. But the switches are ignored when I use the switch it doesn´t switch the other switch nor in OH.
Maybe creating a rule is the better thing for this purpose as rosko57 is stating below.
Basically these are three masters the two switches and the OH App. Each is master.
Don’t use follow at all!
Please use instead the “Is Command” feature in mqtt.
Please keep in mind, that under normal circumstances, each incomming message through a binding is a status and not a command. To use an external switch to control other hardware (i.e. of another binding), you have to change the status to a command, either by using a rule (ItemA received update → ItemB.sendCommand) or by changing the behavior of the channel itself.
You can find the option by selecting “SHOW MORE” and scrolling down to the very end. You have to do this on each Channel, which should be treated as a command.
Maybe a bit more background.
I am using this command in an alarm rule
if(E_Touch10_2.state == OFF)
in order to activate the rule or not. No physical switch just the state of these switches.
I am using two sonoff T3 (3 items and 3 channels) which are located on two floors and of course I would like to use both of them to control the Alarm.
Switch E_Touch10_2 and Switch S_Touch90_2
The current setup with profile=follow works “almost” correct:-)
When I press the second button on E_Touch10_2 the alarm gets activated and the profile=follow
takes care to activate the second switch S_Touch90_2 as well and of course the light is reflecting the state.
This is the current item setup for the first switch whereby I don´t have the second switch defined individually this seems not to be necessary.
The only problem I do face is that physically using the second switch on S_Touch90_2 will not deactivate the first switch.
Therefore I thought the usage of that profile=follow is somehow wrong and I would need to add a second item just the other way arround. Unfortunatelly that doesn´t work it creates a kind of a loop for both devices
BTW. I can´t see the usage of “is command” in MQTT to solve this issue
First, create a Switch group for all Alarm Switches (is gAlarmSwitch here)
Second, group all Alarm switches with that group.
Third, use a Rule:
var Boolean bLock = false // global var has to be defined first (no rules ahead)
rule "update other switches"
Member of gAlarmSwitch changed
if(bLock) // check if rule already started
return; // and break if true
bLock = true // lock rule
gAlarmSwitch.members.filter[j|j.name != triggeringItem.name].forEach[i| // get a list of Alarm Switch Items without the triggering one.
i.sendCommand(triggeringItem.state.toString) // and send the command to switch state
Thread::sleep(500) // give some time to rest
bLock = false // Unlöock rule
Just to confirm, this is a separate additional synchronization rule, and the current usage of e.g. the state of one of these switches in another rule (e.g. my alarm rule) stays untouched?
Cause I would setup that rule as a separate file, I don´t need to take care for defining that global var first, as you mentioned?
And this is a generic way to synchronize two switches (or more) belonging to the same group?
Of course this doesn´t make sense in all cases but absolutely required when you use e.g. two sonoff touch switches visualizing per LED if ON or OFF.