Context
I am building an irrigation controller (ESP32) which uses MQTT to communicate with Home assistant. The entities on the device include a series of switches and associated timer (in this case 12 of each) for turning zones on and off.
Solution overview
I am using the MQTT switch for the switches as this allows the use of the Node-red call service “switch” domain and all the functionality that comes with it.
Problem
I am unable to find an equivalent for the timer although the Node-red “call service” node does have a “Timer” domain. The key difference is that I need to pass the “duration” to the MQTT entity. The node has a property of duration which can be used to set the duration, but I’m not sure how the integration works with HA, and hence, how I should configure the MQTT entity to pick it up. Effectively the timer is a switch with a property of duration. The MQTT switch does not have properties/functions (like the MQTT light).
Options I’ve considered
One option is to use the MQTT domain in the node-red “call service” node and communicate directly with the device. But I’m sure there is a simple solution to pass a property to the MQTT switch.
I had a quick look at the Timer helper, but I’m not sure I can use it to send messages to the ESP32(via mqtt).
Any suggestions would be much appreciated.
Thanking you in advance.