MQTT Dimmer



  • I have set up an led dimmer.
    It somehow works when i send an mqtt command like this
    $ mosquitto_pub -t mygateway1-in/88/0/0/0/3 -m "10"

    This is what i have in my items

    Dimmer  Dimmed_Light    "Dimmer Light [%d %%]"  <slider> { mqtt=">[mymosquitto:mygateway1-in/88/0/0/3:state:*:default]" }
    

    Then a rule

    /**
     * This is a demo rule which simulates a real dimmer by reacting to increase/decrease commands
     * and posting an updated state on the bus
     */
    rule "Dimmed Light"
        when
            Item Dimmed_Light received command
        then
            var Number percent = 100
            if(Dimmed_Light.state instanceof DecimalType) percent = Dimmed_Light.state as DecimalType
    
            if(receivedCommand==INCREASE) percent = percent + 5
            if(receivedCommand==DECREASE) percent = percent - 5
    
            if(percent<0)   percent = 0
            if(percent>100) percent = 100
    
            postUpdate(Dimmed_Light, percent);
    end
    

    Sitemap Slider item=Dimmed_Light

    Somehow clicking on slider buttons does nothing. I don'e even see the messages when i subscribe to the mymosquitto:mygateway1-in channel. So seems the problem i have misconfiguration in the items string.
    At the same time relay module works defined in items like this

    Switch vent_vsr_high "Vent High" { mqtt=">[mymosquitto:mygateway1-in/55/3/1/0/2:command:ON:1],>[mymosquitto:mygateway1-in/55/3/1/0/2:command:OFF:0]" }```


  • @moskovskiy82

    Looking for an answer on this too? Did you happen to figure this out?




Log in to reply
 

Suggested Topics

  • 22
  • 1
  • 4
  • 7
  • 5
  • 10

12
Online

11.4k
Users

11.1k
Topics

112.7k
Posts