#Help with automations to automate battery charge at cheap power

1 messages · Page 1 of 1 (latest)

solemn veldt
#

Hi All,

So to make an educated purchase for a home battery next year, I am simulating various battery types and sizes via the battery_sim HACS integration.

However, on cloudy days, I want to boost the efficiency of the batteries by changing the battery mode to "Force charge" when;

  • *The current energyprice is at the lowest 10% of the day *AND the predicted solar power rest of the day is lower than 7

It needs to put the battery mode back to default if;
-- *The current energyprice is at higher than 10% of the day *OR the predicted solar power rest of the day is higher than 7

Now, I have tried in a few ways, but it never works, not returning to default mode, or changing to force charge if only 1 of the 2 requirements are met.

Question;
Any tips on how to use the AND and OR stattements correctly??

#
description: Switches batteries to Default mode if price > 10% OR remaining production > 6
triggers:
  - entity_id: sensor.percentage_energieprijs_vandaag
    above: 10
    trigger: numeric_state
  - entity_id: sensor.energy_production_today_remaining
    above: 6
    trigger: numeric_state
conditions: []
actions:
  - device_id: 804f5267d738ddbd8ab7d3b4d9b27098
    domain: select
    entity_id: 3480d8f18fddec9207e7ce0d4ebd7d7e
    type: select_option
    option: Default mode
  - device_id: acd51e6dfdf2521674b3011f7750f715
    domain: select
    entity_id: 2799a98621a4d3b43ec69e29ed91e574
    type: select_option
    option: Default mode
  - device_id: 0c61cd333a144f090239074a316197b4
    domain: select
    entity_id: 8a5dd7cc059897073b2a42adc84270a9
    type: select_option
    option: Default mode
  - device_id: 5d05700ffd7affc5ba3db403b20f2aa8
    domain: select
    entity_id: 565a1601a573f20cecf3f7ed01d14d2e
    type: select_option
    option: Default mode
  - device_id: 05fad3432b5c7a9ef1071b8c179e29f1
    domain: select
    entity_id: e0e487753a216615f5765c854dcd3e3b
    type: select_option
    option: Default mode
  - device_id: 5096e2edc89ba82f405a066f44f44e5f
    domain: select
    entity_id: 082508715438a53e790a28062a6df044
    type: select_option
    option: Default mode
  - device_id: 85b9cedb969abab0ba957f8fd9f1a59d
    domain: select
    entity_id: 441321eda2b7f2c93d6bc9b9a07ee78d
    type: select_option
    option: Default mode
mode: single
#
description: Force charge if price < 10 AND production < 6
triggers:
  - entity_id: sensor.percentage_energieprijs_vandaag
    below: 10
    trigger: numeric_state
  - entity_id: sensor.energy_production_today_remaining
    below: 7
    trigger: numeric_state
conditions:
  - condition: numeric_state
    entity_id: sensor.percentage_energieprijs_vandaag
    below: 10
  - condition: numeric_state
    entity_id: sensor.energy_production_today_remaining
    below: 7
actions:
  - device_id: 804f5267d738ddbd8ab7d3b4d9b27098
    domain: select
    entity_id: 3480d8f18fddec9207e7ce0d4ebd7d7e
    type: select_option
    option: Force charge
  - device_id: acd51e6dfdf2521674b3011f7750f715
    domain: select
    entity_id: 2799a98621a4d3b43ec69e29ed91e574
    type: select_option
    option: Force charge
  - device_id: 5d05700ffd7affc5ba3db403b20f2aa8
    domain: select
    entity_id: 565a1601a573f20cecf3f7ed01d14d2e
    type: select_option
    option: Force charge
  - device_id: 0c61cd333a144f090239074a316197b4
    domain: select
    entity_id: 8a5dd7cc059897073b2a42adc84270a9
    type: select_option
    option: Force charge
  - device_id: 05fad3432b5c7a9ef1071b8c179e29f1
    domain: select
    entity_id: e0e487753a216615f5765c854dcd3e3b
    type: select_option
    option: Force charge
  - device_id: 5096e2edc89ba82f405a066f44f44e5f
    domain: select
    entity_id: 082508715438a53e790a28062a6df044
    type: select_option
    option: Force charge
  - device_id: 85b9cedb969abab0ba957f8fd9f1a59d
    domain: select
    entity_id: 441321eda2b7f2c93d6bc9b9a07ee78d
    type: select_option
    option: Force charge
mode: single
stoic moon
#

Just make a template helper that does the comparisons for you and merges cost low and generation low into a single entity and uses that, it's much simpler imo
That said you just want
If cost low and generation low - force charge
Else - default

#

You might also want to look at the predbat add on, been playing with it myself for the last few months and pretty happy with it

solemn veldt
solemn veldt
#

@stoic moon

Can I make A bnary sensor tmeplate with this as the state;

   and states('sensor.energy_production_today_remaining') | float(0) < 7 }}