[Solved] Noob question: How to set value to actuator via mqtt



  • I'm using the Gatewayesp8266MQTTClient from the Development repository.
    I'm reading 3 temperature sensors without problem.
    I have now positioned a relay in my network using the default RelayActuator. I only set the node id manually to 15.
    I'm using mosquitto on my RaspberryPi and view the messages with mosquitto_sub -v -t 'mygateway1-out/#'
    When I start the node (on a arduino mini pro) I see the following in mosquitto

    mygateway1-out/15/255/0/0/18 1.5.4
    mygateway1-out/15/255/3/0/6 0
    mygateway1-out/15/255/3/0/11 My Relay
    mygateway1-out/15/255/3/0/12 1.0
    mygateway1-out/15/1/0/0/3 (null)
    mygateway1-out/15/255/0/0/18 1.5.4
    mygateway1-out/15/255/3/0/6 0
    mygateway1-out/15/255/3/0/11 My Relay
    mygateway1-out/15/255/3/0/12 1.0
    mygateway1-out/15/1/0/0/3 (null)
    

    Edit (sorry, forgotten)
    The serial output is:

    read: 0-0-15 s=255,c=3,t=15,pt=0,l=2,sg=0:
    repeater started, id=15, parent=0, distance=1
    send: 15-15-0-0 s=255,c=3,t=11,pt=0,l=8,sg=0,st=ok:My Relay
    send: 15-15-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
    send: 15-15-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
    

    From mosquitto I can give commands as well with mosquitto_pub. Based on the example in https://www.mysensors.org/download/serial_api_15 (last line actually) I used the following commands to switch off/on
    mosquitto_pub -t 'mygateway1-out/15/1/2/0/2' -m 0 and mosquitto_pub -t 'mygateway1-out/15/1/2/0/2' -m 1
    This doesn't work. Unfortunately, not one single combination I try works. sensor=1? sensor=255?

    What am I doing wrong?


  • Plugin Developer

    @Harry-van-der-Wolf

    Hi!

    There should be two different topic prefixes in the client sketch. One for outgoing messages to which the gateway publishes, and one for incoming messages to which the client gateway subscribes. The last topic prefix is the one you should use to publish updates to the gateway.

    The prefix is called mygateway1-in or similar as default.





  • @martinhjelmare and @rollercontainer

    There are days that I feel less intelligent. 😉
    That mygateway1-in is indeed the reason and exactly as specified in the GatewayESP8266MQTTClient.ino sketch for incoming subscribe messages.

    mosquitto_pub -t 'mygateway1-in/15/1/2/0/2' -m 0 and mosquitto_pub -t 'mygateway1-in/15/1/2/0/2' -m 1 does switch the relay off and on.

    Thanks.


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 5
  • 1

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts