Send message from gateway MQTT to controller
I have an MQTT gateway that dialogs with a controller that I developed.
This works very well.
I would like the gateway to give additional information to the controller when it connects to the network.
For example, its IP address on the local network or its subscription topic.
Is it possible to send information from an MQTT gateway to the controller during a presentation phase?
Do you mean on the same topics as mysensors uses or on different ones?
On the same publish topic as mysensors gateway.
Just when the gateway is on the network.
During the presentation phase of the gateway mqtt, there is little information sent and I would like to complete it.
@miclane adding a "virtual" sensor locally on the gateway should work. Present the local sensor in the presentation() function, just like you would on any node. If you want to, you can send values the first time loop() is run. Use S_INFO or S_CUSTOM as sensor type and the corresponding V_ variables. Details on S_ and V_ types: https://www.mysensors.org/download/serial_api_20#sensor-types
Thank you for this quick response.
I test this solution which seems to me a bypass and I will make a return.
Perhaps consider an evolution to allow directly the sending of information by the gateway like the nodes ...
For other sensors I already use V_variables.
I tested the solution proposed above.
It works very well.
I can send to the controller the subscription topic of the gateway, its IP address, etc. during the presentation phase of the gateway.
@miclane great! Thanks for reporting back.