Newbie question : how to toggle a led with MQTT
-
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.-
I added this line in Setup(). Is it ok?
gw.request(sensor, V_LIGHT,0); -
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.
-
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.
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
Getting system time from the controller
Troubleshooting • 30 days ago • dpcons 26 days ago -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22 -
JSN-SR04T-V3.0 Coax cable extended
Troubleshooting • 9 days ago • bocalexandru 8 days ago -
Echo request is not set
Troubleshooting • 12 Aug 2024, 15:36 • kamilb85 3 Sept 2024, 08:58 -
Raspberry Pi 5: invalid GPIO 9
Troubleshooting • 27 Aug 2024, 13:20 • igo 27 Aug 2024, 13:20