Zigbee2mqtt revisited: No more ugly transformations

Hi, I think I have this working.

I have the TRÅDFRI LED bulb E14 400 lumen which was paired with zigbee2mqtt and appeared as 0x086bd7fffe210efc

zigbee2mqtt configuration.yaml

homeassistant: false
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://localhost'
serial:
  port: /dev/ttyACM0
  disable_led: true
advanced:
  log_level: error
devices:
  '0x086bd7fffe210efc':
    friendly_name: 'swUpstairsHallwayLight'
experimental:
  output: attribute

lights.things

Bridge mqtt:broker:MosquittoMqttBroker "Mosquitto MQTT Broker" [host="192.168.1.92", secure=false]
{

	//Upstairs hallway
	Thing mqtt:topic:swUpstairsHallwayLight "Upstairs Hallway Light" {
	  	Channels:
	    		Type switch:switch "Power Switch" [
				stateTopic="zigbee2mqtt/swUpstairsHallwayLight/state", 
				commandTopic="zigbee2mqtt/swUpstairsHallwayLight/set",
				on="ON",
				off="OFF"  
			]
	    		Type dimmer:dimmer "Dimmer" [
				stateTopic="zigbee2mqtt/swUpstairsHallwayLight/brightness",
				commandTopic="zigbee2mqtt/swUpstairsHallwayLight/set/brightness", 
				min=1, 
				max=255, 
				step=1
			]
	}
}

lights.items

Switch sUpstairsHallwayLight "Upstairs Hallway Light"  { channel="mqtt:topic:swUpstairsHallwayLight:switch" }
Dimmer dUpstairsHallwayLight "Upstairs Hallway Light" { channel="mqtt:topic:swUpstairsHallwayLight:dimmer", autoupdate="false" }

Sitemap

Switch item=sUpstairsHallwayLight label="Upstairs hallway" icon="light"
Slider item=dUpstairsHallwayLight label="Upstairs hallway [%d %%]" sendFrequency=500

I have no idea why this all works, because the slider is 0-100%, but the bulb seems to receive 0-255 via MQTT - something somewhere is transforming the 0-100 from the slider to 0-255 for the bulb, but I don’t know what.

Let me know if this works out for you!

Edit: tagging @Brignoud as they also asked about the same thing

2 Likes