Files
zorruno-homeassistant/packages/ev_charging.yaml
2023-10-20 13:27:48 +13:00

28 lines
875 B
YAML

input_select:
leaf_ev_charging_mode:
icon: mdi:ev-plug-type1
name: Leaf EV Charge Mode
initial: "Normal (Offpeak)"
options:
- "Normal (Offpeak)"
- "Offpeak until charged"
- "1hr top-up now"
- "Charge now until full"
- "Stop charging now"
automation:
- id: set_the_leaf_ev_charging_mode
alias: Set the Leaf EV Charging MOde
trigger:
entity_id: input_select.leaf_ev_charging_mode
platform: state
action:
service: mqtt.publish
data:
topic: viewroad-status/evcharging/leaf-chargemode
payload:
'{% set mapping = { "Normal (Offpeak)":"normal", "Offpeak until charged":"offpeak-full",
"1hr top-up now":"boost", "Charge now until full":"now-full", "Stop charging now":"stop" } %} {% set dta = trigger.to_state.state %}
{{ mapping[dta] }}
'