Adding a light switch to Openhab/MQTT gateway



  • I am currently running Openhab with Mysensor MQTT gateway and it reads the sensors fine. I have added a light switch to a node and Openhab. When I switch the light on, I see in the Openhab log state "received command on", but nothing shows up in the MQTT output, which I monitor with MQTT-spy. The item line in Openhab is :Switch node2_sw2 "sw2" {mqtt=">[mysensor:MyMQTT/2/5/V_LIGHT:command:ON:1],>[mysensor:MyMQTT/2/5/V_LIGHT:command:OFF:0]"}, where the node is 2 and the child_ID is 5. I do not know what to check next. Any help will be appreciated.
    John



  • Hello,
    I'm using exact the same statement. In addition I have a mapping statement. Don't ask if this is necessary.
    My line:
    {mqtt=">[mysensor:MyMQTT/1/1/V_LIGHT:command:ON:1],>[mysensor:MyMQTT/1/1/V_LIGHT:command:OFF:0],<[mysensor:MyMQTT/1/1/V_LIGHT:command:MAP(1on0off.map)]"}

    The content of file 1on0off.map in folder /configurations/transform:
    1=ON
    0=OFF



  • I had also tried adding the mapping statement, but it had no effect. I have no idea what to try next.? Do you think it could be a problem with the node sketch up?
    Thanks



    1. I noticed that MQTT server can only accept 1 client connection at a time. So when testing - do not use another client to "listen" when Openhab talks to Mysensors.

    2. Try testing Openhab and MQTT Mysensors gateways separately, by connecting to them with outside clients and checking if the right commands come out and if these command cause right kind of reaction at MQTT Mysensors gateway.



  • The statements from jmmorgan and Xander both look OK to me.
    mine is:

    Switch node1_sw1 "sw1" {mqtt=">[mysensors:MyMQTT/1/1/V_LIGHT:command:ON:1],>[mysensors:MyMQTT/1/1/V_LIGHT:command:OFF:0],<[mysensors:MyMQTT/1/1/V_LIGHT:command:MAP(1on0off.map)]"}
    

Log in to reply
 

Suggested Topics

  • 22
  • 10
  • 19
  • 1
  • 5
  • 132

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts