Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Newbie question : how to toggle a led with MQTT

Newbie question : how to toggle a led with MQTT

Scheduled Pinned Locked Moved Troubleshooting
2 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • scalzS Offline
    scalzS Offline
    scalz
    Hardware Contributor
    wrote on last edited by scalz
    #1

    Hello.

    I am newbie with Mysensors and iot world. So I am reading a lot actually. I am trying to do basics tests for learning. So my confiuration is

    • MySensors lib 1.4, all arduino nano, nrf24
    • Gateway : I use the MQTT broker gateway
    • for debugging MQTT, I use MQTTLens (maybe there is a better tool)

    My first test was using just one node with a DHT11. I am able to read the infos in MQTTLens.

    Now I am trying to toggle a led with MQTT.
    So, I removed the DHT11, and connected a led. I verified that hardware is ok by using a simple blink led sketch.
    I am using the MySensors relay example.

    1. I added this line in Setup(). Is it ok?
      gw.request(sensor, V_LIGHT,0);

    2. Here is my problem, maybe a silly question, but I am learning so
      in MQTTLens, what command must I send ?? Is it in the subscribe or publish field? I thought that subscribe was just for receiving and publish for sending info. Maybe not?

    In subscribe field, if I do MyMQTT/20/1/V_LIGHT my Led toggle on. But How to toggle off?
    I think I do not understand how MQTT works yet but I will get it!

    Thanks for your help I hope my english is not too bad...
    Have a good day.

    1 Reply Last reply
    0
    • XanderX Offline
      XanderX Offline
      Xander
      wrote on last edited by
      #2

      at 1) The RelaisActor sketch works out of the box. There is nothing to add. (I think :-) )
      at 2) You are right. I don't know "MQTTLens" (I use MQTTfx) but it should be another Input Field for the payload. "1" means Relais on, "0" means off.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      19

      Online

      11.7k

      Users

      11.2k

      Topics

      113.1k

      Posts


      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • MySensors
      • OpenHardware.io
      • Categories
      • Recent
      • Tags
      • Popular