trying to change target hours with automation what am I doing wrong #62
Replies: 2 comments
-
|
OK, so my 'obviously... probably' might not not be true, though that seems hard to believe. I've just tried this (and many variations) and singularly failed to 'automatically' update an - id: '1761728245727'
alias: Battery AutoChange Charge Time
description: ''
triggers:
- trigger: time
at: '23:08:00'
conditions: []
actions:
- action: input_number.set_value
target:
entity_id: input_number.battery_charge_time
data:
value: "{{ ((90.0 - float(states('sensor.battery_soc')) // 40) * 0.5 + 0.5 if float(states('sensor.battery_soc')) < 90.0 else 0.0 }}"
mode: singlebattery_charge_time and immersion_on_time basically follow the same logic but with different calculations for the time they need to be on. PS or with triggers:
- trigger: state
entity_id:
- sensor.battery_soc |
Beta Was this translation helpful? Give feedback.
-
|
Answering my own question here: I needed to set up template sensor that was driven by the immersion cylinder temperature (or battery SOC) in - sensor:
- name: "battery_charge_time"
unique_id: "battery_charge_time"
unit_of_measurement: "h"
state: >
{% set soc = states('sensor.battery_soc') | float %}
{{ ((100.0 - soc) // 30) * 0.5 }}
- sensor:
- name: "immersion_on_time"
unique_id: "immersion_on_time"
unit_of_measurement: "h"
state: >
{% set tmp = states('sensor.immersion_cylinder_temperature') | float %}
{{ ((60.0 - tmp) // 10) * 0.5 if tmp < 60.0 else 0.0 }}and then the The other thing I found I had to do, that might be a figment of my messing around or might actually be necessary, is to put values in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've gone round in quite a few circles but the only thing that seems to work is this.
Really I want to calculate:
immersion_on_time = (60.0 - sensor.immersion_cylinder_temperature) // 8 * 0.5 if sensor.immersion_cylinder_temperature < 60.0 else 0.0(actual text involved various{{, '. float(, states( etc)Is it just not possible to use the state of entities apart from the trigger in homeassistant automations? Obviously I can probably set an automation to run every *:58:00 to recalculate
immersion_on_timebut it seems complicated, is this the standard approach?Paddy
Beta Was this translation helpful? Give feedback.
All reactions