Automation mode restart = not restarting

Hi everyone,

I have created two simple automations based on (dynamic energy) price levels, for below and above a threshold, that should trigger my EV charger on/off by changing it’s allowed currents in HA.

SInce this sometimes did not work fluently with a simple automation (see below), e.g. not at once, I was happy to find out about the ‘restart’ automation mode. However, this somehow does not restart at all, probably because the dynamic price changes only once from A to B (for example from above the threshold to below the threshold), and therefore does not ‘trigger’ the automation again, unless it goes above and then below once again afterwards. Is that correct? I first thought it would just re-check the condition automatically after it had run the automation the first time, but I guess I’m wrong.

Also, I would like to know what the reason is why my automation sometimes gets triggered, but approx. 8 out of 10 times the value of the current of the EV charger does not get changed at all by the automation. Is this normal for HA, that actions are just sometimes working and sometimes not? I’m relatively new to HA.
So it seems to be based purely on luck, and that’s why I thought I should use the ‘restart automation mode’, which apparently also does not fix the problem for me.

The EV charger is integrated in HA through the Alfen wallbox integration. That might give you a clue.

Thanks a lot in advance for trying to help!! I would really appreciate some help because this gave me multiple headaches already. :slight_smile:

/ EDIT / it happened just now, again: energy price dropped below the given threshold (condition), but the current of the EV charger did not change.

Here is the automation I’m using:

id: '1758037055355'
alias: 'Alleen laden bij lage prijs '
description: ''
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.rammazeynhoek_2_elektriciteitsprijs
    below: 0.24
conditions:
  - condition: numeric_state
    entity_id: number.alfen_eve_single_pro_power_connector_max_current_socket_1
    below: 5
    enabled: false
actions:
  - action: number.set_value
    metadata: {}
    data:
      value: '16'
    target:
      entity_id: number.alfen_eve_single_pro_power_connector_max_current_socket_1
mode: restart

and this is the action that does often not happen:

Correct, you are wrong

You realise that condition does nothing ?

1 Like

@francisp Yes, that part (an additional AND IF) was disabled by myself on purpose, so you can disregard that. The automation still gets triggered and action should be performed.

More importantly, I found out that it seems to be a (common) problem of the integration (or the data servers/API that it uses: Changing entity "power_connector_external_max_current_socket_1" has no effect · Issue #198 · leeyuentuen/alfen_wallbox · GitHub

Please help with a temporary fix, for example to check if the automation’s action has been performed succesfully, and if not, to do it again. Is that possible?

See the repeat until example here:

1 Like

thank you, I’ll give it a try

@francisp wouldn’t it be sufficient if I would only have an extra condition added inside the automation (in restart mode), for example by adding the following condition (And if):
If Alfen Eve Single Pro laadpaal Power Connector Max Current Socket 1 is below 10

alias: "Alleen laden bij lage prijs "
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.rammazeynhoek_2_elektriciteitsprijs
    below: 0.24
conditions:
  - condition: numeric_state
    entity_id: number.alfen_eve_single_pro_power_connector_max_current_socket_1
    below: 10
    enabled: true
actions:
  - action: number.set_value
    metadata: {}
    data:
      value: "16"
    target:
      entity_id: number.alfen_eve_single_pro_power_connector_max_current_socket_1
mode: restart

won’t this also restart until the trigger + conditions are finally met? because that’s how I understood the “restart” automation mode

mode: restart = if you receive the trigger again while the automation is still running, it will stop the running automation and start a new one.

2 Likes

To trigger every time it changes and run when the condition is met…

triggers:
  - trigger: state
    entity_id:
      - sensor.rammazeynhoek_2_elektriciteitsprijs
1 Like

@francisp @Sir_Goodenough can a repeat until script run alone (without the automation)?? I believe so, but just checking.

And does it also automatically gets triggered, like an automation? It didn’t seem to work (trigger) right away for me, until I manually clicked on ‘run’.
I’ll try to embed it in my automation. Maybe that’s how to do it.

L’ll spoonfeed you

alias: "Alleen laden bij lage prijs "
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.rammazeynhoek_2_elektriciteitsprijs
    below: 0.24
conditions:
  - condition: numeric_state
    entity_id: number.alfen_eve_single_pro_power_connector_max_current_socket_1
    below: 10
    enabled: true
actions:
  - repeat:
      sequence:
        - action: number.set_value
          data:
            value: "16"
          target:
            entity_id: number.alfen_eve_single_pro_power_connector_max_current_socket_1			
        - delay:
            seconds: 1
      until:
        - condition: state
          entity_id: alfen_eve_single_pro_power_connector_max_current_socket_1
          state: "16"
mode: restart

1 Like