[SOLVED] Link A dimmer to MQTT

Hello folks, I have an Insteon dimmer. I have created an Item for it. However I would like to convert it to mqtt Dimmer. Where I want to broadcast it sates to my mqtt server and from other platform I be able to control it through mqtt. Any idea how I can go about this?

You would use the mqtt binding and create a generic thing with the dimmer type.

Have you got the dimmer working in openhab?

Well I could get around this few minutes ago by getting the node red to work. Now my question is different how can I adjust the brightness through item commands. For example when I pass on β€œON” it will turn the light on. How can I pass on the brightness level?

I am unsure of th arcitecture you have setup in you system.

I have an item

Dimmer Kitchen_Light "Dimmer" [ "Lighting" ] {channel="mqtt:topic:myMQTTBroker:Kitchen:dimmer"}

In a sitemap to change the brigtness I have

Default item=Kitchen_Light icon="light" 

This is setup by using my generic mqtt thing

//Broker Setup
    Thing topic Kitchen "Bench Light" @ "Kitchen" {
    Channels:
        Type dimmer : dimmer  [ stateTopic="Kitchen_Bench_Light/stat/DIMMER", transformationPattern="JSONPATH:$.Dimmer", commandTopic="Kitchen_Bench_Light/cmnd/Dimmer" ]
      }

I use the vscode extention to edit config files here

1 Like

Thanks for the examples, I got that. However, how can I use Item command to control a dimmer Item. Like how can I set its brightness to specific value through command?

LOL sorry I think I am not clear enough. You know the RESTapi page on your openhab instant lets say if you want to go to item list and command your dimmer to 50%. What kind of command do you put on the command field. The rules due it through local java variables.

Found it out, All I have to do is just pass on the value as integer with nothing else added. ie: post:items/{itemname}/ example 50

1 Like