Hi everyone,
Im trying to automate the charge power based on the excess solar production at home. So far I have attempted to achieve this via the UI, however while inspecting the yaml output does this look fine? Thanks for any pointers in making it cleaner.
alias: charge power
description: ""
trigger:
- platform: state
entity_id:
- sensor.dsmr_reading_electricity_currently_returned
condition:
- condition: device
device_id: 101a76a54dbacf224d0dc5c162c6b282
domain: device_tracker
entity_id: c243994ef91d5e1bb1db9a238cb642d2
type: is_home
enabled: true
- type: is_charging
condition: device
device_id: 101a76a54dbacf224d0dc5c162c6b282
entity_id: 8e906bbbff159a56ff8e19560f1b6fba
domain: binary_sensor
enabled: true
action:
- if:
- condition: numeric_state
entity_id: sensor.dsmr_reading_electricity_currently_returned
above: 7
then:
- device_id: 101a76a54dbacf224d0dc5c162c6b282
domain: number
entity_id: 219001a6b1d453519e627d6d7d044a3b
type: set_value
value: 10
else:
- if:
- condition: numeric_state
entity_id: sensor.dsmr_reading_electricity_currently_returned
above: 6
below: 7
then:
- device_id: 101a76a54dbacf224d0dc5c162c6b282
domain: number
entity_id: 219001a6b1d453519e627d6d7d044a3b
type: set_value
value: 9
- if:
- condition: numeric_state
entity_id: sensor.dsmr_reading_electricity_currently_returned
above: 5
below: 6
then:
- device_id: 101a76a54dbacf224d0dc5c162c6b282
domain: number
entity_id: 219001a6b1d453519e627d6d7d044a3b
type: set_value
value: 7
- if:
- condition: numeric_state
entity_id: sensor.dsmr_reading_electricity_currently_returned
above: 4
below: 5
then:
- device_id: 101a76a54dbacf224d0dc5c162c6b282
domain: number
entity_id: 219001a6b1d453519e627d6d7d044a3b
type: set_value
value: 6
- if:
- condition: numeric_state
entity_id: sensor.dsmr_reading_electricity_currently_returned
above: 3
below: 4
then:
- device_id: 101a76a54dbacf224d0dc5c162c6b282
domain: number
entity_id: 219001a6b1d453519e627d6d7d044a3b
type: set_value
value: 5
else:
- device_id: 101a76a54dbacf224d0dc5c162c6b282
domain: number
entity_id: 219001a6b1d453519e627d6d7d044a3b
type: set_value
value: 0
mode: single
In the first If what I’m doing is that if the solar production is more than 7kW then adjust the charge amps to 10, the second if block is if the solar production is between 6-7kW adjust the charge amps to 9amps and I have the same until the ‘else’ where it set the amps to 0.