I am currently writing an automation to use
grocy.consume_product_from_stock when a physical (
zigbee2mqtt) button is pressed.
This action is supposed to happen each and every time the button is pressed.
However, I would also like to use
notify.alexa_media if certain conditions are met. Is this possible without using templates?
- alias: "Button Aqara Küche Mate Plus 1" trigger: - platform: state entity_id: sensor.button_aqara_kueche_kuehlschrank_action to: button_4_single # this ALWAYS happens action: - service: grocy.add_product_to_stock data: product_id: 3 amount: 1 # THEN a condition AFTER the first action... condition: condition: numeric_state entity_id: input_number.helper_mate_kuehlschrank below: 3 # ...and an action that only fires if the condition above is met action: - service: notify.alexa_media target: media_player.ben message: "You will die soon if you don't buy more Mate!" data: type: tts
There are two workarounds I can think off:
use a complex template that checks the condition first, then triggers the actions accordingly
create two separate automations =>
2.1. One to only fire
grocy.add_product_to_stock(each time the button is pressed) and
2.2. One to only check the condition and, if it is met, fire
While both these options should work fine, I’d prefer the example yaml I posted above, if this is somehow possible (or, perhaps, planned for future releases of Home Assistant??).
Thank you for your ideas