I tried to use search, but couldn’t find solution to the problem.
I replaced Z-Wave dimmer (died after 3 years) with Tasmota flashed MJ dimmer. Using OH dimmer item with Z-Wave is straight forward. ON = Dimmer state 100 or last known value, OFF = dimmer state 0.
Tasmota is different:
ON/OFF channel is separate from Dimmer state. So if Switch is OFF dimmer still will have last known dimming value. F.e - {“POWER”:“OFF”,“Dimmer”:40}. So we have to create rule to update Dimmer state for OH to 0 every time when Power OFF.
Problem with posting 0 to OH dimmer item is that : updating OH dimmer value also updates Tasmota with {“POWER”:“OFF”,“Dimmer”:0}. You have to understand that OH Dimmer and Tasmota bidirectionally synchronized. Otherwise you will not be able to control Tasmota dimmer from OH.
If {“POWER”:“OFF”,“Dimmer”:0}, then manually powering switch will result {“POWER”:“ON”,“Dimmer”:0}. This means, that we have to adjust dimming after POWER ON, because Tasmota doesn’t remember last dimming state, it is using current dimm level 0.
If we create rule to adjust dimming value to 100%, then we can’t use restore last known dimm value, because it is gonna be 0.
Posting ON to Tasmota/Dimmer gives us 1, when ON on OH side equals to 100. So this is another problem.
I am using NodeRed and I ended up with very complex rule to solve these problems. I am curious may be someone else has better solution? I don’t want to separate Switch and Dimmer functionality in OH for the same light. It makes other automations more complex including my voice assistant.
When I adjust the slider either from the software, or the physical switch, the Dimmer item updates, and the Switch item updates to on. If I turn off the physical switch, the Switch item updates as well.
The one thing I couldn’t figure out is how to change “embedded-mqtt-broker” to something else. Whenever I tried, it would break. No big deal though.