As a true nerd, I don't like having parameters inside automations that may need changing as this requires editing the automation each time the parameter value is altered. Much better (more satisfying anyway) to have a dashboard setting to amend the value used in the automation.
My only problem is how do I do this? I have experimented with lots of different ideas but without success. This code is as near as I have got:
Code: Select all
alias: Pass value test
description: >-
Test passing UI value to automation three trigger
triggers:
- trigger: numeric_state
entity_id:
- sensor.battery_soc
below: >-
{% set myValue=states('input_number.fd_stopatsoc') | float(1) %} {{myValue }}
conditions:
- condition: state
entity_id: select.kh10_inverter_work_mode
state: Force Discharge
actions:
- action: logbook.log
metadata: {}
data:
name: FD_AutomationThree
message: Battery below set SOC, work mode back to Feed-in First
- action: select.select_option
metadata: {}
data:
option: Feed-in First
target:
entity_id: select.work_mode
- action: logbook.log
metadata: {}
data:
name: FD_AutomationThree
message: |-
Grid Export at end is
{{states('sensor.feed_in_energy_today')}}
entity_id: sensor.feed_in_energy_today
mode: single
Thanks, Hugh