Thank you for your reply! That does explain it, I must miss the point when I read the documentation. Assume the “expected state” also checks for each action?
So in my case if I’d like to run multiple actions before check retry, is it even possible without using another script?
It’s just because the Tesla Fleet API isn’t very responsive so need to refresh the state with a timeout before checking the result. I can’t check the result by just waking up the car, as the polling interval is very long and the car will go back to sleep if I don’t get the right status (connected), and if the statues is not correct all sub-sequent calls will fail (despite that the car is already awake).
I think it’s all covered by the example in my original response.
Hi @amitfin : thank you for your reply! Just to be sure I didn’t miss anything I have read through the sample code again, so my understanding is that the retry runs button.press action and check the status without delay. However it misses an important step to refresh the state of the sensor:
- action: homeassistant.update_entity
data:
entity_id:
- binary_sensor.model3_status
That’s exactly the reason why I need to run multiple actions before checking the state. So basically what I need to do:
- Wake up the car by button.press action
- Wait for some period of time (2 minutes) because wake up usually takes 1-2 minutes
- Force to refresh the binary_sensor.model3_status
- Check the result and before another attempt
The reason why step 3 is needed is due to poll interval of the integration (I think 10 minutes?), so if I don’t have step 3 it will not work:
- Wake up the car by button.press action
- The car wakes up after 1-2 minutes wait for next command
- The value binary_sensor.model3_status stays offline until next update of binary_sensor.model3_status in 10 minutes
- The car sleeps again after 5 minutes
- Automation fails because despite the car is woken up but marked “offline” in Home Assistant
So in short, I need a way to run 2 actions with a delay in-between before validation of the result.
Is it possible?
actions:
- action: retry.actions
data:
sequence:
- action: button.press
target:
entity_id: button.model3_wake
- delay:
minutes: 2
- action: retry.actions
data:
sequence:
- action: homeassistant.update_entity
data:
entity_id: binary_sensor.model3_status
expected_state: "on"
- condition: state
entity_id: sensor.model3_shift_state
state: parked
- action: retry.actions
data:
sequence:
- action: climate.set_hvac_mode
data:
hvac_mode: heat_cool
target:
entity_id: climate.model3_climate
expected_state: heat_cool
Dear readers,
How do have the retry thing make sure the lights aren’t only turning on, but also in fact the wanted colour and brightness too.
And is this also possible with scenes?
Thanks!
Joshua
