Hi, I am on the way to build a motorized waterspray device, to control the spray on a plant remotely via homeassistant and mqtt.
What I want to do is let the NodeMCU device to subscribe to the mqtt message published via HA, so that for example, if the device get the payload as “spray” the motor sprays water.
What I am stuck now is the way I publish a mqtt on HA in a timely and a correct manner.
The device will go deep sleep to save battery and will only connect to Wifi, say every 10minutes and can be set to be active for 1minute, meant for the duration for the spray, and disconnects from Wifi, and goes deep sleep again, and so the cycle continues.
During the above 1 minute timeframe, I want to have the device to check for a mqtt payload, and determine whether the water should be sprayed or not, accordingly
to the published message from HA. To accomplish this, the arduino sketch on the device I have a clue, but for the HA part, I am kind of lost.
Ultimately, I want to use a switch on ios’s Home app, so that when I press a Spray button,
the device will spray during the next 10 minute interval, and the Spray button automatically, grays out after finishing the spray.
This is basically my first project on Mqtt. I understand the concept of Mqtt,
the above device I made is equipped with a temperature sensor, and is publishing
a temperature payload so that HA can monitor.
What I have problem now is controlling from HA, so If someone can point me
to a good source of publishing mqtt from HA, that will be appreciative.
Thank you in advance.