OH Dimmer and Tasmota

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

Did you ever figure this out? I have the same issue.

How is your MQTT configured?
This part of the original post -

puzzles me, it doesn’t have to be that way.

Hahah! I had a big, long winded write up about this. In writing it, I did a bunch of testing and finally figured out how to set it up to work!

Thanks for responding, It pushed me to figure it out!

Craig

Could you share for the benefit of others?

Of Course. Sorry bout that. I was so excited to get it working…

.things

Bridge  mqtt:systemBroker:embedded-mqtt-broker  "Moquette System Embedded MQTT Broker"  [host="localhost", secure=false, retain=false, url="localhost:1883" ] {

Thing topic LivingRoomDimmer "Living Room Dimmer" @ "Living Room" {
    Channels:
        Type switch   : power      "Power"      [ stateTopic="sonoff/stat/LivingRoomDimmer/RESULT", transformationPattern="JSONPATH:$.POWER" , commandTopic="sonoff/cmnd/LivingRoomDimmer/POWER"]
        Type dimmer   : dimmer     "Dimmer"     [ stateTopic="sonoff/stat/LivingRoomDimmer/RESULT", commandTopic="sonoff/cmnd/LivingRoomDimmer/DIMMER", transformationPattern="JSONPATH:$.Dimmer" ]
    }

.items

Switch	Light_GF_LivingRoom_Lights_Power	"Living Room Lights"					<light>			(gGF_LivingRoom, gLights,gAll)	{channel="mqtt:topic:embedded-mqtt-broker:LivingRoomDimmer:power"}
Dimmer	Light_GF_LivingRoom_Lights_Dimmer	"Living Room Lights Dimmer [%d %%]"		<brightness>	(gGF_LivingRoom, gAll)			{channel="mqtt:topic:embedded-mqtt-broker:LivingRoomDimmer:dimmer"}

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.

Craig

2 Likes