Hi, I am newish to Home Assistant and love it. Still getting to grips with automations. I am looking to create an automation to force charge the batteries connected to my solar during the cheap rate electricity period (23:30 - 05:30).
I currently have 2 automations setup to start and stop charging at the times above. Yes, very basic and I believe this can be done in 1 automation. The yaml code is pasted below…
Start charge
alias: Charge Home Battery
description: “”
trigger:
platform: time
at: “23:30:00”
condition:
action:
device_id: b2e7f88987acec1a852bdec7191b879a
domain: select
entity_id: a05fe497a7ca8fc8813ace3a6dccb456
type: select_last
mode: single
Stop Charge
alias: Stop Home Battery Charging
description: “”
trigger:
platform: time
at: “05:30:00”
condition:
action:
device_id: b2e7f88987acec1a852bdec7191b879a
domain: select
entity_id: a05fe497a7ca8fc8813ace3a6dccb456
type: select_previous
mode: single
Would someone be so kind to let me know a better way to do this, perhaps in a single automation ?
the above could be made even simpler with a single template…
e.g. in my example have it call service light.turn_{{ states(‘binary_sensor.test_time’) }}
but if you’re just starting out, this is perhaps clear straightforward logic that you can see & edit in the ui.
you currentlyhave device_id and entity_id in your automation. i’m not sure why… i don’t know what device you’re using… but if possible, you’re better off to use entity_id only if you can, and furthermore use a more human-readable entity name (like light.alcove above)
of course replace all of my entities and such with your own! just showing you the logic flow.
in your posts, you should use the pre-formatted text format for code. it preserves the indentation and readability.