Hi,
I am trying to automate my newly made sprinklers using HA.
It is absolutely important that the sprinklers turn off even the HA server hangs. Fortunately cc2530 and wonderful https://ptvo.info/ support the feature to automatically turn off the relay in hardware independent of HA.
I only need to send a command like this:
mosquitto_pub -t zigbee2mqtt/device_entity_id/l1/set -m ‘{“trigger”: 10000}’
I was not able to find any possible way to use that feature in Home assistant.
If it is not already there I am willing to create a pull request probably to add the feature to the ‘switch’ or any other other proper component.
You could add a timed automation that sends a mqtt_publish service call to that topic with the specific payload.
You might also be able to modify your MQTT switch to use a payload_on that passes the {“trigger”: 10000} as part of the command. I’ve not dealt with Zigbee2MQTT, so I’m not sure how it would work if you have discovery turned on.
You could create a template switch and for the turn on service call a script that contains the services you need. which could include a mosquitto publish command.
Or if that command above actually turns on the relay too then you can call the mosquitto publish service directly from the “turn_on:” section.
Actually I need the feature as an assurance in case something happens to the ha server or its connection to the device. Any feature in HA will not be useful in this case.
sets the output to the HIGH state for N milliseconds, then resets to LOW.
Topic: z2m/[friedly_name]/[channel]/set
Channel: l1, l2, l3 … l8
Payload: {trigger: 5000}
yes, exactly like that. I am working on the the hardware so I cannot test it now and 100% confirm it, but it should work. As far as I know home assistant does not support the feature directly and you have to use a service to send mqtt message directly
With: payload_on: ‘{“trigger”: 10000}’, then I get this when switching on and off:
Zigbee2MQTT:debug 2020-11-06 21:02:49: Received MQTT message on 'zigbee2mqtt/0x00124b00097331f3/l1/set' with data '{“trigger”: 10000}'
Zigbee2MQTT:error 2020-11-06 21:02:49: Invalid JSON '{“trigger”: 10000}', skipping...
Zigbee2MQTT:info 2020-11-06 21:02:49: MQTT publish: topic 'zigbee2mqtt/0x00124b00097331f3', payload '{"linkquality":60,"state_l1":"OFF","state_l2":"OFF","state_l3":"OFF","state_l4":"OFF"}'
Zigbee2MQTT:debug 2020-11-06 21:02:49: Received MQTT message on 'zigbee2mqtt/0x00124b00097331f3/l1/set' with data 'OFF'