As you surmise, MyTempProxy is linked to the MQTT Thing and any changes to it get published and picked up by the UI.
MyTemp is linked to the Exec binding Thing that calls the script to get the current readings locally.
Honestly, doing away with the proxies and using Units of Measurement to handle the C to F conversions is high on my list of things I want to do. It’s really complicated and makes doing what you are trying to do right now more complicated than it needs to be.
Before getting into your problem, you can move all of the process stuff to the “but only if…” clause of the rule instead of making it part of the rule. So this code above would just be skipped if the triggeringItem is Anavi but ThermometerSwitch isn’t. You can do the same for the “My” sensors when ThermometerSwitch isn’t “My”.
But if I understand correctly, what you really want is that the LCD on the HestiaPi always shows it’s own sensor readings but the decisions on whether to turn on/off the heat/cooling would be based on the Anavi device readings when the TermometerSwitch is set to Anavi.
Unfortunately this is going to be a little tough to implement. The problem is that all the rest of the rules depend on MyTempProxy when deciding whether to turn on/off the devices. And MyTempProxy is the one that is linked to the MQTT channel that drives the LCD. So I think there are two choices:
- modify all the rules to use some other Item instead of MyTempProxy when making it’s decisions
- create another Item and move the channel from MyTempProxy to this new Item. Then modify the rule above to sendCommand to both MyTempProxy and the new Item , but only if the reading is from the local sensor, with the new temperature reading. The command to the new Item will drive what’s displayed on the LCD and the command to MyTempProxy will drive the rules.
I think 2 will be less work over all, but there may be some side effects that I’m not aware of off the top of my head that might crop up.
To further elaborate on 2, the rule will need to trigger on MyTemp and on AnaviTemp. You will process the reading for both sensors. Where there is a difference is your if statement that checks ThermometerSwitch will control whether or not to send the command to the new Item that’s linked to the LCD. Only command that Item when ThermometerSwitch is “My”. For commanding MyTempProxy, only command it when the triggering Item is MyTemp and ThermometerSwitch is “My” or when AnaviTemp is the triggeringItem and ThermometerSwitch is “Anavi”. If the new Item is called LocalTemp it’s look something like…
Over all I think you are on the right track.