danVnest-home-assistant/configuration/electricity/cost/now.yaml

472 lines
25 KiB
YAML

template:
- sensor:
- name: Grid energy cost per kWh
unique_id: grid_energy_cost_per_kwh
state: >
{{
states('input_number.energy_cost_green_power')|float +
states('input_number.energy_cost_' + ('first' if states('sensor.monthly_energy_from_grid')|float < 100 else 'after_first') + '_100kwh_of_month')|float
}}
unit_of_measurement: "$/kWh"
state_class: measurement
icon: mdi:currency-usd
availability: >
{{
has_value('input_number.energy_cost_green_power') and
has_value('sensor.monthly_energy_from_grid') and
has_value('input_number.energy_cost_first_100kwh_of_month') and
has_value('input_number.energy_cost_after_first_100kwh_of_month')
}}
- name: Grid energy cost per Wh
unique_id: grid_energy_cost_per_wh
state: "{{ states('sensor.grid_energy_cost_per_kwh')|float / 1000 }}"
unit_of_measurement: "$/Wh"
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.grid_energy_cost_per_kwh') }}"
- name: Savings from solar per kWh
unique_id: savings_from_solar_per_kwh
state: >
{{
states('input_number.energy_cost_green_power')|float +
states('input_number.energy_cost_' + ('first' if states('sensor.monthly_energy_consumed')|float < 100 else 'after_first') + '_100kwh_of_month')|float -
states('sensor.effective_energy_cost_per_kwh')|float
}}
unit_of_measurement: "$/kWh"
state_class: measurement
icon: mdi:currency-usd
availability: >
{{
has_value('input_number.energy_cost_green_power') and
has_value('sensor.monthly_energy_consumed') and
has_value('input_number.energy_cost_first_100kwh_of_month') and
has_value('input_number.energy_cost_after_first_100kwh_of_month') and
has_value('sensor.effective_energy_cost_per_kwh')
}}
- name: Savings from solar per Wh
unique_id: savings_from_solar_per_wh
state: "{{ states('sensor.savings_from_solar_per_kwh')|float / 1000 }}"
unit_of_measurement: "$/Wh"
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.savings_from_solar_per_kwh') }}"
- name: Savings from battery per kWh
unique_id: savings_from_battery_per_kwh
state: "{{ 0 }}"
unit_of_measurement: "$/kWh"
state_class: measurement
icon: mdi:currency-usd
# TODO: update once battery is actually installed
- name: Savings from battery per Wh
unique_id: savings_from_battery_per_wh
state: "{{ states('sensor.savings_from_battery_per_kwh')|float / 1000 }}"
unit_of_measurement: "$/Wh"
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.savings_from_battery_per_kwh') }}"
# TODO: update once battery is actually installed
- name: Effective energy cost per kWh
unique_id: effective_energy_cost_per_kwh
state: "{{ states('sensor.grid_energy_cost_per_kwh')|float * (1 - states('sensor.power_meter_relative_autonomy')|float / 100) }}"
unit_of_measurement: "$/kWh"
state_class: measurement
icon: mdi:currency-usd
availability: >
{{
has_value('sensor.grid_energy_cost_per_kwh') and
has_value('sensor.power_meter_relative_autonomy')
}}
- name: Effective energy cost per Wh
unique_id: effective_energy_cost_per_wh
state: "{{ states('sensor.effective_energy_cost_per_kwh')|float / 1000 }}"
unit_of_measurement: "$/Wh"
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.effective_energy_cost_per_kwh') }}"
- name: Total power cost
unique_id: total_power_cost
state: >
{{
(states('sensor.power_meter_power_load_consumed')|float *
states('sensor.effective_energy_cost_per_wh')|float +
states('sensor.electricity_provider_service_power_cost')|float
)|round(9)
}}
#TODO: this doesn't take into account controlled load pricing
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: >
{{
has_value('sensor.power_meter_power_load_consumed') and
has_value('sensor.effective_energy_cost_per_wh') and
has_value('sensor.electricity_provider_service_power_cost')
}}
- name: Total power cost savings
unique_id: total_power_cost_savings
state: >
{{
(states('sensor.power_meter_power_load_consumed')|float *
states('sensor.savings_from_solar_per_wh')|float +
states('sensor.power_meter_power_grid_export')|float *
states('input_number.energy_export_price')|float / 1000
)|round(9)
}}
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: >
{{
has_value('sensor.power_meter_power_load_consumed') and
has_value('sensor.savings_from_solar_per_wh') and
has_value('sensor.power_meter_power_grid_export') and
has_value('input_number.energy_export_price')
}}
- name: Electricity provider service power cost
unique_id: electricity_provider_service_power_cost
state: "{{ states('input_number.energy_cost_service')|float / 24 }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('input_number.energy_cost_service') }}"
- name: Electricity provider service power cost savings
unique_id: electricity_provider_service_power_cost_savings
state: "0"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
- name: Lights power cost
unique_id: lights_power_cost
state: "{{ (states('sensor.all_light_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.all_light_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Lights power cost savings
unique_id: lights_power_cost_savings
state: "{{ (states('sensor.all_light_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.all_light_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Living room aircon power cost
unique_id: living_room_aircon_power_cost
state: "{{ (states('sensor.living_room_aircon_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.living_room_aircon_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Living room aircon power cost savings
unique_id: living_room_aircon_power_cost_savings
state: "{{ (states('sensor.living_room_aircon_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.living_room_aircon_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Dining room aircon power cost
unique_id: dining_room_aircon_power_cost
state: "{{ (states('sensor.dining_room_aircon_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.dining_room_aircon_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Dining room aircon power cost savings
unique_id: dining_room_aircon_power_cost_savings
state: "{{ (states('sensor.dining_room_aircon_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.dining_room_aircon_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Bedroom aircon power cost
unique_id: bedroom_aircon_power_cost
state: "{{ (states('sensor.bedroom_aircon_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.bedroom_aircon_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Bedroom aircon power cost savings
unique_id: bedroom_aircon_power_cost_savings
state: "{{ (states('sensor.bedroom_aircon_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.bedroom_aircon_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Office heater power cost
unique_id: office_heater_power_cost
state: "{{ (states('sensor.office_heater_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.office_heater_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Office heater power cost savings
unique_id: office_heater_power_cost_savings
state: "{{ (states('sensor.office_heater_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.office_heater_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Nursery heater power cost
unique_id: nursery_heater_power_cost
state: "{{ (states('sensor.nursery_heater_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.nursery_heater_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Nursery heater power cost savings
unique_id: nursery_heater_power_cost_savings
state: "{{ (states('sensor.nursery_heater_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.nursery_heater_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Fans power cost
unique_id: fans_power_cost
state: "{{ (states('sensor.all_fan_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.all_fan_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Fans power cost savings
unique_id: fans_power_cost_savings
state: "{{ (states('sensor.all_fan_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.all_fan_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Humidifiers power cost
unique_id: humidifiers_power_cost
state: "{{ (states('sensor.all_humidifier_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.all_humidifier_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Humidifiers power cost savings
unique_id: humidifiers_power_cost_savings
state: "{{ (states('sensor.all_humidifier_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.all_humidifier_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Kitchen appliances power cost
unique_id: kitchen_appliances_power_cost
state: "{{ (states('sensor.kitchen_appliances_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.kitchen_appliances_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Kitchen appliances power cost savings
unique_id: kitchen_appliances_power_cost_savings
state: "{{ (states('sensor.kitchen_appliances_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.kitchen_appliances_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Dishwasher power cost
unique_id: dishwasher_power_cost
state: "{{ (states('sensor.dishwasher_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.dishwasher_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Dishwasher power cost savings
unique_id: dishwasher_power_cost_savings
state: "{{ (states('sensor.dishwasher_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.dishwasher_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Fridge power cost
unique_id: fridge_power_cost
state: "{{ (states('sensor.fridge_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.fridge_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Fridge power cost savings
unique_id: fridge_power_cost_savings
state: "{{ (states('sensor.fridge_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.fridge_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Freezer, mini fridge, routers power cost
unique_id: freezer_mini_fridge_routers_power_cost
state: "{{ (states('sensor.freezer_mini_fridge_routers_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.freezer_mini_fridge_routers_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Freezer, mini fridge, routers power cost savings
unique_id: freezer_mini_fridge_routers_power_cost_savings
state: "{{ (states('sensor.freezer_mini_fridge_routers_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.freezer_mini_fridge_routers_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Washer power cost
unique_id: washer_power_cost
state: "{{ (states('sensor.washer_power')|float * states('sensor.effective_energy_cost_per_kwh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.washer_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Washer power cost savings
unique_id: washer_power_cost_savings
state: "{{ (states('sensor.washer_power')|float * states('sensor.savings_from_solar_per_kwh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.washer_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Dryer power cost
unique_id: dryer_power_cost
state: "{{ (states('sensor.dryer_power')|float * states('sensor.effective_energy_cost_per_kwh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.dryer_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Dryer power cost savings
unique_id: dryer_power_cost_savings
state: "{{ (states('sensor.dryer_power')|float * states('sensor.savings_from_solar_per_kwh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.dryer_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: TV, speakers, PC, Home Assistant, router relay, security hub power cost
unique_id: tv_speakers_pc_home_assistant_router_relay_security_hub_power_cost
state: "{{ (states('sensor.tv_speakers_pc_home_assistant_router_relay_security_hub_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.tv_speakers_pc_home_assistant_router_relay_security_hub_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: TV, speakers, PC, Home Assistant, router relay, security hub power cost savings
unique_id: tv_speakers_pc_home_assistant_router_relay_security_hub_power_cost_savings
state: "{{ (states('sensor.tv_speakers_pc_home_assistant_router_relay_security_hub_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.tv_speakers_pc_home_assistant_router_relay_security_hub_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Water heater, oven & stove, guest suite, garage, all other power cost
unique_id: water_heater_oven_stove_guest_suite_garage_all_other_power_cost
state: "{{ (states('sensor.water_heater_oven_stove_guest_suite_garage_all_other_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.water_heater_oven_stove_guest_suite_garage_all_other_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Water heater, oven & stove, guest suite, garage, all other power cost savings
unique_id: water_heater_oven_stove_guest_suite_garage_all_other_power_cost_savings
# assume water heater usage when solar available, use controlled load costs
state: >
{{
states('sensor.water_heater_oven_stove_guest_suite_garage_all_other_power')|float *
(states('input_number.energy_cost_green_power')|float +
states('input_number.energy_cost_controlled_load')|float) *
states('sensor.power_meter_relative_autonomy')|float / 100 / 1000
}}
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: >
{{
has_value('sensor.water_heater_oven_stove_guest_suite_garage_all_other_power') and
has_value('input_number.energy_cost_green_power') and
has_value('input_number.energy_cost_controlled_load') and
has_value('sensor.power_meter_relative_autonomy')
}}
- name: Office desk, computer & monitor, cooler, fish tank power cost
unique_id: office_desk_computer_monitor_cooler_fish_tank_power_cost
state: "{{ (states('sensor.office_desk_computer_monitor_cooler_fish_tank_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.office_desk_computer_monitor_cooler_fish_tank_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Office desk, computer & monitor, cooler, fish tank power cost savings
unique_id: office_desk_computer_monitor_cooler_fish_tank_power_cost_savings
state: "{{ (states('sensor.office_desk_computer_monitor_cooler_fish_tank_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.office_desk_computer_monitor_cooler_fish_tank_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Phone chargers power cost
unique_id: phone_chargers_power_cost
state: "{{ (states('sensor.phone_chargers_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.phone_chargers_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Phone chargers power cost savings
unique_id: phone_chargers_power_cost_savings
state: "{{ (states('sensor.phone_chargers_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.phone_chargers_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Sensors power cost
unique_id: sensors_power_cost
state: "{{ (states('sensor.sensors_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.sensors_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Sensors power cost savings
unique_id: sensors_power_cost_savings
state: "{{ (states('sensor.sensors_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.sensors_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Paludarium, picture frame, camera power cost
unique_id: paludarium_picture_frame_camera_power_cost
state: "{{ (states('sensor.paludarium_picture_frame_camera_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.paludarium_picture_frame_camera_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Paludarium, picture frame, camera power cost savings
unique_id: paludarium_picture_frame_camera_power_cost_savings
state: "{{ (states('sensor.paludarium_picture_frame_camera_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.paludarium_picture_frame_camera_power') and has_value('sensor.savings_from_solar_per_wh') }}"
- name: Standby power cost
unique_id: standby_power_cost
state: "{{ (states('sensor.all_standby_power')|float * states('sensor.effective_energy_cost_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.all_standby_power') and has_value('sensor.effective_energy_cost_per_wh') }}"
- name: Standby power cost savings
unique_id: standby_power_cost_savings
state: "{{ (states('sensor.all_standby_power')|float * states('sensor.savings_from_solar_per_wh')|float)|round(9) }}"
unit_of_measurement: $/h
state_class: measurement
icon: mdi:currency-usd
availability: "{{ has_value('sensor.all_standby_power') and has_value('sensor.savings_from_solar_per_wh') }}"