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.