Zigbee2mqtt revisited: No more ugly transformations

I solved this via min/max-Definition in the channel-config.

         Thing topic light_tradfri "light_tradfri" {
             Channels:
                   Type switch : state           "state" [ stateTopic = "zigbee2mqtt/light_tradfri/state", commandTopic = "zigbee2mqtt/light_tradfri/set/state", on = "ON", off = "OFF" ]
                   Type dimmer : brightness      "brightness" [ stateTopic = "zigbee2mqtt/light_tradfri/brightness", commandTopic = "zigbee2mqtt/light_tradfri/set/brightness", min = 0, max = 254 ]
                   Type dimmer : color_temp      "color_temp" [ stateTopic = "zigbee2mqtt/light_tradfri/color_temp", commandTopic = "zigbee2mqtt/light_tradfri/set/color_temp", min = 250, max = 454 ]
                   Type string : effect          "effect" [ stateTopic = "zigbee2mqtt/light_tradfri/effect" ]
                   Type string : power_on_behavior "power_on_behavior" [ stateTopic = "zigbee2mqtt/light_tradfri/power_on_behavior" ]
                   Type number : linkquality     "linkquality" [ stateTopic = "zigbee2mqtt/light_tradfri/linkquality" ]
         }

BTW, I’v made a groovy script to convert zigbee2mqtt-devices to Things. (see attachement)
mqtt2things.groovy (4.3 KB)

I switched from deconz to zigbee2mqtt today and i didn’t want to waste my time with copy/paste and repetetive typing :wink:

  1. rename it to mqtt2things.groovy
  2. pipe topic zigbee2mqtt/bridge/devices in to it. This generates above output.
mosquitto_sub -t zigbee2mqtt/bridge/devices -C 1 |  groovy ./mqtt2things.groovy  -n light_tradfri

Then -n parameter is optional. It restricts procession to the given device-name