Power Consumption Setup
Sensor Code Example
- platform: rest
name: "Garage Charging Station"
resource: https://api.switch-bot.com/v1.0/devices/[DEVICEID]/status
method: GET
scan_interval: 600
headers:
Authorization: !secret switchbot_api
Content-Type: "application/json"
value_template: "{{ value_json.body.power }}"
json_attributes_path: "$.body"
json_attributes:
- weight
- voltage
- electricCurrent
- electricityOfDay
Power Sensor Example
- platform: template
sensors:
garage_charging_power:
friendly_name: "Garage Charging Power"
value_template: "{{ state_attr('sensor.garage_charging_station','weight')|float }}"
unit_of_measurement: "W"
Refresh When On Automation
alias: Time - Refresh Switchbot Power
description: ""
trigger:
- platform: time_pattern
minutes: /1
condition:
- condition: or
conditions:
- condition: state
entity_id: switch.garage_charging_plug
state: "on"
- condition: state
entity_id: sensor.kettle_plug
state: "On"
- condition: state
entity_id: sensor.monitor_switch
state: "On"
action:
- choose:
- conditions:
- condition: state
entity_id: switch.garage_charging_plug
state: "on"
sequence:
- service: homeassistant.update_entity
data: {}
target:
entity_id: sensor.garage_charging_plug
- choose:
- conditions:
- condition: state
entity_id: switch.kettle_plug
state: "on"
sequence:
- service: homeassistant.update_entity
data: {}
target:
entity_id: sensor.kettle_plug
mode: single
Charging Station Automation
To quickly import this Blueprint into your Home Assistant environment, just click the link below! Make sure to update your Home Assistant URL before completing the import.
Notify when automation runs
alias: Notify - Charging Station off
description: ""
trigger:
- platform: state
entity_id:
- automation.power_turn_off_garage
attribute: last_triggered
condition: []
action:
- service: notify.mobile_app_sm_f936u
data:
message: Your charging station has been turned off to save power
title: Charging Station Off
mode: single
Hot Water Kettle Automation
Automation to Notify when the kettle has the water hot.
alias: Notify - Kettle Done
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.garage_charging_power
below: 10
condition: []
action:
- service: notify.mobile_app_sm_f936u
data:
message: "Your hot water is ready. "
title: 🍵Hot Water Kettle
mode: single
Automation to Increment Counter
alias: Button - Kettle Counter
description: ""
trigger:
- platform: state
entity_id:
- switch.kettle_plug
condition: []
action:
- service: counter.increment
data: {}
target:
entity_id: counter.kettle_button_presses
mode: single
Automation to Reset Counter
alias: Button - Kettle Reset
description: ""
trigger:
- platform: state
entity_id:
- switch.kettle_plug
condition: []
action:
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: counter.reset
data: {}
target:
entity_id: counter.kettle_button_presses
mode: restart
Automation to Start Timer Based on Counter
alias: Counter - Start Kettle Timer
description: ""
trigger:
- platform: numeric_state
entity_id: counter.kettle_button_presses
above: 3
condition: []
action:
- service: timer.start
data: {}
target:
entity_id: timer.tea_timer
- service: notify.mobile_app_sm_f936u
data:
title: 🍵Tea Timer Started
message: Your 4 Minute Tea Timer Has Started
mode: single
Automation to Notify When Timer is Complete
alias: Timer - Tea is Ready
description: ""
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.tea_timer
condition: []
action:
- service: notify.mobile_app_sm_f936u
data:
message: It looks like your tea timer is complete
title: 🫖Your Tea is Ready🫖
mode: single
Office Monitor / Track Time In Front of Computer
alias: Office - Sit Timer Start
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.office_monitor_switch_power
above: 50
condition: []
action:
- service: input_datetime.set_datetime
data:
datetime: "{{ now () }}"
target:
entity_id: input_datetime.sitting_time
mode: single
alias: Power - Add Sit Time
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.monitor_switch_power
below: 50
- platform: state
entity_id:
- sensor.monitor_switch
to: "Off"
condition: []
action:
- service: input_number.set_value
data_template:
value: >-
{{ ((states('input_number.total_sit_time')|float) +
((as_timestamp(now()) -
as_timestamp(states('input_datetime.sitting_time')))/60) | round(0)) }}
target:
entity_id: input_number.total_sit_time
- service: input_datetime.set_datetime
data_template:
datetime: "{{ now() }} "
entity_id: input_datetime.sitting_time
mode: single