A Time Pattern Trigger can trigger “every x minutes” but it’s a trigger and you stated you want to achieve your goal “without a traditional trigger”. How do you intend to do that without a trigger?
Hi Taras,
The once a day mqtt.publish works fine for now.
Let me explain the bigger picture what I am trying to achieve.
I have an ESP32 pool controller that I have developed. It currently sends MQTT messages at predefined intervals that are hardcoded in firmware. If I want to change this I have to re-flash the device. I want the ESP32 device to now reply to MQTT commands from from HA using the mqtt.publish.
Here is the automation I currently use to monitor the pool filter pressure.
- alias: Pool Filter Cleaning
trigger:
- platform: numeric_state
entity_id: sensor.pool_pressure
above: 8
for:
#hours: 4
#seconds: 10
action:
service: notify.mobile_app_keith
data:
message: Pool filter needs to be cleaned
data:
push:
sound: Pool filter needs to be cleaned.wav
Here is the new automation that you helped me with…
- alias: Check Pool Filter Pressure
trigger:
- platform: time
at: '09:00:00'
condition: []
action:
- service: mqtt.publish
data:
topic: /pool/adc/pressure
payload: '/pool/adc/read1'
mode: single
I need to combine these into a single automation as to trigger based off the psi value received from the controller.
Thanks, Keith
Have you already reprogrammed the ESP32 to behave like this? It now publishes the pool pressure whenever it receives /pool/adc/read1 on /pool/adc/pressure?
It suggests you want an automation that triggers when it receives a PSI value from the sensor and then sends an MQTT command to make the sensor send a PSI value.
However, my interpretation must be incorrect because that seems like a needless automation. Can you clarify the automation’s purpose?
HA needs to initiat the MQTT conversation based on platform: time. The pool controller receives this and sends the psi payload back to HA (the way it is working now). Now I need HA to do a platform numeric state and do a test if > than, send a push notification to my iphone. I still think I need to combine the two automations that I posted earlier…
It seems to me that what you just described is exactly what the two automations you posted already do. One automation tells the device to reply with a value and the other automation notifies you if the received value is above a threshold.
If you want this process to occur on a periodic basis, change the Time Trigger to a Time Pattern Trigger.
BTW, wouldn’t it be more efficient for the ESP32 to report changes, to the measured PSI value, whenever they occur?
A Numeric State Trigger will trigger at the moment when the value increases above the threshold. If the value continues to increase, it won’t trigger again. It triggers only at the moment the value crosses the threshold.
It won’t trigger until the value first decreases below the threshold, then increases and crosses the threshold again.