Hello
So I wanted to create a Card / UI functionality, where I could sell power from my battery in X amount of time.
So I’ve created 3 Automations, 1 Script, 2 Helpers, to do this like this:
The overview:
code:
Card code
type: entities
entities:
- entity: input_number.time_slider_sell
name: Choose sell time
- entity: script.start_sell_solar_cd_2
name: Start battery selling
- entity: timer.sell_solar_cd
name: Selling time left
show_header_toggle: false
title: Battery seller
Script:
alias: Start Sell Solar Countdown
sequence:
- data:
entity_id: timer.sell_solar_cd
duration: "{{ (states('input_number.time_slider_sell') | float * 60 * 60) | int }} "
action: timer.start
- action: notify.mobile_app_oneplus12anders
data:
message: >-
Sell Solar Countdown started for {{
states('input_number.time_slider_sell')}} hours.
timer (just made in configuration.yaml)
# for the solar
timer:
sell_solar_cd:
duration: "00:00:00"
- a input_number (can’t find the yaml file or a like for that anywhere):
The 3 Automations:
- id: '1724266308456'
alias: Battery sell start
description: Starts the solar selling of deye inverter
trigger:
- trigger: state
entity_id:
- timer.sell_solar_cd
from:
to: active
condition:
- condition: numeric_state
entity_id: sensor.deyeinverter_sun12k_battery_capacity
above: 45
enabled: false
action:
- device_id: f216aefc5e28619ce8cb66ab2880b225
domain: select
entity_id: e42a6804ff4fc6c0dd7c8ee1ff852fcf
type: select_option
option: Selling first
- action: notify.mobile_app_oneplus12anders
metadata: {}
data:
title: Battery sell
message: Battery sell started
- action: notify.mobile_app_anna_s_mobil
metadata: {}
data:
title: Battery sell
message: Battery sell started
mode: single
- id: '1725652598087'
alias: Battery sell stop
description: ''
trigger:
- trigger: state
entity_id:
- timer.sell_solar_cd
from: active
to: idle
condition: []
action:
- device_id: f216aefc5e28619ce8cb66ab2880b225
domain: select
entity_id: e42a6804ff4fc6c0dd7c8ee1ff852fcf
type: select_option
option: Zero export to CT
- action: notify.mobile_app_oneplus12anders
metadata: {}
data:
title: Battery sell
message: Battery sell has stopped
- action: notify.mobile_app_anna_s_mobil
metadata: {}
data:
title: Battery sell
message: Battery sell has stopped
mode: single
- id: '1725653373612'
alias: Battery sell - Emergency stop
description: Battery sell - Emergency stop
triggers:
- trigger: numeric_state
entity_id:
- sensor.deyeinverter_sun12k_battery_capacity
below: 25
conditions:
- condition: state
entity_id: select.deyeinverter_sun12k_limit_control_mode
state: Selling first
actions:
- action: timer.cancel
metadata: {}
data: {}
target:
entity_id: timer.sell_solar_cd
- device_id: f216aefc5e28619ce8cb66ab2880b225
domain: select
entity_id: e42a6804ff4fc6c0dd7c8ee1ff852fcf
type: select_option
option: Zero export to CT
- action: notify.mobile_app_oneplus12anders
metadata: {}
data:
title: Battery sell
message: Battery sell stopped - battery too low
- action: notify.mobile_app_anna_s_mobil
metadata: {}
data:
title: Battery sell
message: Battery sell - But already not selling
mode: single
Now since I have this.
And my setup is made by a friend, I’d love that he could give this “component” to all his friends/clients, so they could easily sell aswell. But how do I make a blueprint or component or whatever that has all of this code?
I tried putting everything in 1 yaml file, but that made me have multiple “scripts” tags where only 1 is allowed… I’m kinda puzzled here.