On my battery automation I just change the modes not change the values, if I get some time tomorrow I’ll have a look at changing values in automations.
You could do the same, switch to Backup mode to charge and switch to Self-Powered mode for normal operation.
alias: p_batt automation
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.p_batt_forecast
below: -3000
- platform: numeric_state
entity_id: sensor.p_batt_forecast
above: -3000
below: 4000
- platform: numeric_state
entity_id: sensor.p_batt_forecast
above: 4000
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.p_batt_forecast
below: -3000
sequence:
- service: select.select_option
data:
option: Backup
target:
entity_id: select.home_energy_gateway_operation_mode
- service: notify.mobile_app_pixel_6
data:
title: p_batt alert {{states('sensor.p_batt_forecast')}} - mode:backup
message: Price:{{states('sensor.amber_general_price')}} $/kWh
- conditions:
- condition: numeric_state
entity_id: sensor.p_batt_forecast
above: 4000
enabled: true
sequence:
- service: tesla_gateway.set_operation
data:
real_mode: autonomous
backup_reserve_percent: 1
enabled: false
- service: notify.mobile_app_pixel_6
data:
title: >-
p_batt alert {{states('sensor.p_batt_forecast')}} - consider
mode:autonomous
message: Price:{{states('sensor.amber_general_price')}} $/kWh
default:
- service: select.select_option
data:
option: Self-Powered
target:
entity_id: select.home_energy_gateway_operation_mode
- service: notify.mobile_app_pixel_6
data:
title: >-
p_batt alert {{states('sensor.p_batt_forecast')}} -
mode:self_consumption
message: Price:{{states('sensor.amber_general_price')}} $/kWh
mode: single