From 1a5fcd3c2c5facfe75f1b9598de4adf50b9f5f30 Mon Sep 17 00:00:00 2001 From: BeardedTinker Date: Fri, 18 Sep 2020 08:31:54 +0200 Subject: [PATCH] Fix entity_id breaking change in templates - #14 --- entities/sensors/etherscan.yaml | 2 +- entities/sensors/sensor_templates.yaml | 126 ++++++------------ entities/sensors/system/count_alerts.yaml | 1 - .../sensors/system/count_automations.yaml | 1 - .../sensors/system/count_binary_sensors.yaml | 1 - entities/sensors/system/count_cameras.yaml | 1 - entities/sensors/system/count_climate.yaml | 1 - entities/sensors/system/count_devices.yaml | 1 - entities/sensors/system/count_entities.yaml | 1 - entities/sensors/system/count_groups.yaml | 1 - entities/sensors/system/count_lights.yaml | 1 - .../sensors/system/count_media_players.yaml | 1 - entities/sensors/system/count_person.yaml | 1 - entities/sensors/system/count_scripts.yaml | 1 - entities/sensors/system/count_sensors.yaml | 1 - entities/sensors/system/count_switch.yaml | 1 - entities/sensors/system/count_timer.yaml | 1 - entities/sensors/system/count_weather.yaml | 1 - 18 files changed, 39 insertions(+), 105 deletions(-) diff --git a/entities/sensors/etherscan.yaml b/entities/sensors/etherscan.yaml index af5972d5..9e13bf46 100644 --- a/entities/sensors/etherscan.yaml +++ b/entities/sensors/etherscan.yaml @@ -6,4 +6,4 @@ platform: etherscan address: !secret storj_token token: storj -#value_template: '{{ value.replace(",", "") }}' \ No newline at end of file +#value_template: '{{ value.replace(",", ""), value.replace(".", ",") }}' \ No newline at end of file diff --git a/entities/sensors/sensor_templates.yaml b/entities/sensors/sensor_templates.yaml index 8584350f..fcb6381a 100644 --- a/entities/sensors/sensor_templates.yaml +++ b/entities/sensors/sensor_templates.yaml @@ -1,6 +1,7 @@ ##### # Sensor Templates ##### + platform: template sensors: @@ -8,6 +9,7 @@ sensors: # Octoprint - Time Elapse in HH:MM:SS # Calculcate HH:MM:SS from seconds ##### + octoprint_time_elapsed_friendly: friendly_name: "OctoPrint Time Elapsed" value_template: "{{ states('sensor.octoprint_time_elapsed') | int | timestamp_custom('%H:%M:%S', 0) }}" @@ -16,6 +18,7 @@ sensors: # Octoprint - Time Remaining in HH:MM:SS # Calculcate HH:MM:SS from seconds ##### + octoprint_time_remaining_friendly: friendly_name: "OctoPrint Time Remaining" value_template: "{{ states('sensor.octoprint_time_remaining') | int | timestamp_custom('%H:%M:%S', 0) }}" @@ -26,25 +29,22 @@ sensors: ##### media_player_title: - entity_id: media_player.lg_tv value_template: '{{ state_attr("media_player.lg_tv", "media_title") }}' friendly_name: Media Player Title media_content_type: - entity_id: media_player.lg_tv value_template: '{{ state_attr("media_player.lg_tv", "media_content_type") }}' friendly_name: Media Content Type media_source: - entity_id: media_player.lg_tv value_template: '{{ state_attr("media_player.lg_tv", "source") }}' friendly_name: Media Source ##### # Track A/B week for school schedule -# We need to know if it's odd or even week +# We need to know if it's odd or even week because of morning/afternoon school ##### current_week: - entity_id: sensor.date +# entity_id: sensor.date friendly_name: "School week" value_template: >- {% set week_number = now().isocalendar()[1] %} @@ -61,7 +61,7 @@ sensors: value_template: '{{ states.image_processing.facebox_saved_image.attributes.faces[0]["name"].title()}}' # old - to be removed after testing # value_template: '{{ state_attr("image_processing.facebox_saved_image", "faces[0][''name''].title()")}}' -# Check for low batteried +# Check for low batteries low_batteries: friendly_name: Low batteries value_template: >- @@ -80,56 +80,6 @@ sensors: # value_template: '{% if states.sensor.low_batteries.state %}{{states.sensor.low_batteries.state}}{% else %}OK{% endif %}' # old - to be removed after testing value_template: '{% if states("sensor.low_batteries") %}{{states("sensor.low_batteries")}}{% else %}OK{% endif %}' -##### -# VERY UNEFFICIENT energy tracking by combining W for every lightbulb. -# This is old attempt to get some at least idea of how energy is used - not counting dimmer or standby -# Hasn't been update in over a year... -##### - -# living room lights "calculation" -# 34W = 12W + 12W + 5W + 5W - living_room_lights_yearly: -# value_template: '{{ states.sensor.living_room_lights_yearly_2.state | multiply(0.0340) | round(2)}} kWh' # old - to be removed after testing - value_template: '{{ states("sensor.dining_room_lights_yearly_2") | multiply(0.0340) | round(2)}} kWh' - friendly_name: 'Yearly Living Room Lights' - -# kitchen lights "calculation" -# 37,5W = 12,5W + 12,5W + 12,5W - kitchen_lights_yearly: -# value_template: '{{ states.sensor.kitchen_lights_yearly_2.state | multiply(0.0375) | round(2)}} kWh' # old - to be removed after testing - value_template: '{{ states("sensor.kitchen_lights_yearly_2") | multiply(0.0375) | round(2)}} kWh' - friendly_name: 'Yearly Kitchen Lights' - -# dining room lights "calculation" -# 25W = 12,5W + 12,5W - dining_room_lights_yearly: -# value_template: '{{ states.sensor.dining_room_lights_yearly_2.state | multiply(0.0250) | round(2)}} kWh' # old - to be removed after testing - value_template: '{{ states("sensor.dining_room_lights_yearly_2") | multiply(0.0250) | round(2)}} kWh' - friendly_name: 'Yearly Dining Room Lights' - -# living room lights "calculation" kWh -# 34W = 12W + 12W + 5W + 5W - living_room_lights_yearly_kwh: - unit_of_measurement: "kWh" -# value_template: '{{ states.sensor.living_room_lights_yearly_2.state | multiply(0.0340) | round(2)}}' # old - to be removed after testing - value_template: '{{ states("sensor.living_room_lights_yearly_2") | multiply(0.0340) | round(2)}}' - friendly_name: 'Yearly Living Room Lights kWh' - -# kitchen lights "calculation" kWh -# 37,5W ? 12,5W + 12,5W + 12,5W - kitchen_lights_yearly_kwh: - unit_of_measurement: "kWh" -# value_template: '{{ states.sensor.kitchen_lights_yearly_2.state | multiply(0.0375) | round(2)}}' # old - to be removed after testing - value_template: '{{ states("sensor.kitchen_lights_yearly_2") | multiply(0.0375) | round(2)}}' - friendly_name: 'Yearly Kitchen Lights kWh' - -# dininig room lights "calculation" kWh -# 25W = 12,5W + 12,5W - dining_room_lights_yearly_kwh: - unit_of_measurement: "kWh" -# value_template: '{{ states.sensor.dining_room_lights_yearly_2.state | multiply(0.0250) | round(2)}}' # old - to be removed after testing - value_template: '{{ states("sensor.dining_room_lights_yearly_2") | multiply(0.0250) | round(2)}}' - friendly_name: 'Yearly Dining Room Lights kWh' ##### # Work in progress - Daily, Monthly, Quarterly and Yearly energy usage (totals) @@ -138,17 +88,17 @@ sensors: daily_energy_total: friendly_name: 'Daily Peak and Offpeak Total' - entity_id: - - sensor.daily_energy_peak - - sensor.daily_energy_offpeak +# entity_id: +# - sensor.daily_energy_peak +# - sensor.daily_energy_offpeak value_template: "{{ ((states('sensor.daily_energy_peak')|float + states('sensor.daily_energy_offpeak')|float) )|round(3) }}" unit_of_measurement: "kWh" monthly_energy_total: friendly_name: 'Monthy Peak and Offpeak Total' - entity_id: - - sensor.monthly_energy_peak - - sensor.monthly_energy_offpeak +# entity_id: +# - sensor.monthly_energy_peak +# - sensor.monthly_energy_offpeak value_template: "{{ ((states('sensor.monthly_energy_peak')|float + states('sensor.monthly_energy_offpeak')|float) )|round(3) }}" unit_of_measurement: "kWh" @@ -156,17 +106,17 @@ sensors: quarterly_energy_total: friendly_name: 'Quarterly Peak and Offpeak Total' - entity_id: - - sensor.quarterly_energy_peak - - sensor.quarterly_energy_offpeak +# entity_id: +# - sensor.quarterly_energy_peak +# - sensor.quarterly_energy_offpeak value_template: "{{ ((states('sensor.quarterly_energy_peak')|float + states('sensor.quarterly_energy_offpeak')|float) )|round(3) }}" unit_of_measurement: "kWh" yearly_energy_total: friendly_name: 'Yearly Peak and Offpeak Total' - entity_id: - - sensor.yearly_energy_peak - - sensor.yearly_energy_offpeak +# entity_id: +# - sensor.yearly_energy_peak +# - sensor.yearly_energy_offpeak value_template: "{{ ((states('sensor.yearly_energy_peak')|float + states('sensor.yearly_energy_offpeak')|float) )|round(3) }}" unit_of_measurement: "kWh" @@ -178,54 +128,54 @@ sensors: daily_peak_energy_cost: friendly_name: 'Daily Peak Energy Cost' - entity_id: - - sensor.daily_energy_peak - - input_number.peak_energy_cost +# entity_id: +# - sensor.daily_energy_peak +# - input_number.peak_energy_cost value_template: "{{ ((states('sensor.daily_energy_peak')|float ) * states('input_number.peak_energy_cost')|float) }}" # value_template: "{{ ((states('sensor.daily_energy_peak')|float /1000) * states('input_number.peak_energy_cost')|float) }}" unit_of_measurement: "hrk" daily_offpeak_energy_cost: friendly_name: 'Daily Offpeak Energy Cost' - entity_id: - - sensor.daily_energy_offpeak - - input_number.offpeak_energy_cost +# entity_id: +# - sensor.daily_energy_offpeak +# - input_number.offpeak_energy_cost value_template: "{{ ((states('sensor.daily_energy_offpeak')|float ) * states('input_number.offpeak_energy_cost')|float) }}" # value_template: "{{ ((states('sensor.daily_energy_offpeak')|float /1000) * states('input_number.offpeak_energy_cost')|float) }}" unit_of_measurement: "hrk" daily_total_energy_cost: friendly_name: 'Daily Total Energy Cost' - entity_id: - - sensor.daily_peak_energy_cost - - sensor.daily_offpeak_energy_cost - - input_number.energy_daily_cost +# entity_id: +# - sensor.daily_peak_energy_cost +# - sensor.daily_offpeak_energy_cost +# - input_number.energy_daily_cost value_template: "{{ (states('sensor.daily_peak_energy_cost')|float + states('sensor.daily_offpeak_energy_cost')|float + states('input_number.energy_daily_cost')|float)|round(2) }}" unit_of_measurement: "hrk" monthly_peak_energy_cost: friendly_name: 'Monthly Peak Energy Cost' - entity_id: - - sensor.monthly_energy_peak - - input_number.peak_energy_cost +# entity_id: +# - sensor.monthly_energy_peak +# - input_number.peak_energy_cost value_template: "{{ ((states('sensor.monthly_energy_peak')|float ) * states('input_number.peak_energy_cost')|float) }}" # value_template: "{{ ((states('sensor.monthly_energy_peak')|float /1000) * states('input_number.peak_energy_cost')|float) }}" unit_of_measurement: "hrk" monthly_offpeak_energy_cost: friendly_name: 'Monthly Offpeak Energy Cost' - entity_id: - - sensor.monthly_energy_offpeak - - input_number.offpeak_energy_cost +# entity_id: +# - sensor.monthly_energy_offpeak +# - input_number.offpeak_energy_cost value_template: "{{ ((states('sensor.monthly_energy_offpeak')|float ) * states('input_number.offpeak_energy_cost')|float) }}" # value_template: "{{ ((states('sensor.monthly_energy_offpeak')|float /1000) * states('input_number.offpeak_energy_cost')|float) }}" unit_of_measurement: "hrk" monthly_total_energy_cost: friendly_name: 'Monthly Total Energy Cost' - entity_id: - - sensor.monthly_peak_energy_cost - - sensor.monthly_offpeak_energy_cost - - input_number.energy_monthly_cost +# entity_id: +# - sensor.monthly_peak_energy_cost +# - sensor.monthly_offpeak_energy_cost +# - input_number.energy_monthly_cost value_template: "{{ (states('sensor.monthly_peak_energy_cost')|float + states('sensor.monthly_offpeak_energy_cost')|float + states('input_number.energy_monthly_cost')|float)|round(2) }}" unit_of_measurement: "hrk" \ No newline at end of file diff --git a/entities/sensors/system/count_alerts.yaml b/entities/sensors/system/count_alerts.yaml index 1bb98570..9b97a295 100644 --- a/entities/sensors/system/count_alerts.yaml +++ b/entities/sensors/system/count_alerts.yaml @@ -7,6 +7,5 @@ platform: template sensors: alert_count: friendly_name: 'Number of Alerts' - entity_id: [] value_template: >- {{ states.alert | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_automations.yaml b/entities/sensors/system/count_automations.yaml index 80f0fe19..42af404b 100644 --- a/entities/sensors/system/count_automations.yaml +++ b/entities/sensors/system/count_automations.yaml @@ -7,6 +7,5 @@ platform: template sensors: automation_count: friendly_name: 'Number of Automations' - entity_id: [] value_template: >- {{ states.automation | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_binary_sensors.yaml b/entities/sensors/system/count_binary_sensors.yaml index 9fb8e80a..acee4429 100644 --- a/entities/sensors/system/count_binary_sensors.yaml +++ b/entities/sensors/system/count_binary_sensors.yaml @@ -7,6 +7,5 @@ platform: template sensors: binary_sensor_count: friendly_name: 'Number of Binary Sensors' - entity_id: [] value_template: >- {{ states.binary_sensor | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_cameras.yaml b/entities/sensors/system/count_cameras.yaml index b40b048d..2f9b91ac 100644 --- a/entities/sensors/system/count_cameras.yaml +++ b/entities/sensors/system/count_cameras.yaml @@ -7,6 +7,5 @@ platform: template sensors: camera_count: friendly_name: 'Number of online Cameras' - entity_id: [] value_template: > {{ states.camera | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_climate.yaml b/entities/sensors/system/count_climate.yaml index 1cfbe213..b784e0ed 100644 --- a/entities/sensors/system/count_climate.yaml +++ b/entities/sensors/system/count_climate.yaml @@ -7,6 +7,5 @@ platform: template sensors: climate_count: friendly_name: 'Number of Climates' - entity_id: [] value_template: >- {{ states.climate | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_devices.yaml b/entities/sensors/system/count_devices.yaml index f1ca35b8..94040fcb 100644 --- a/entities/sensors/system/count_devices.yaml +++ b/entities/sensors/system/count_devices.yaml @@ -7,6 +7,5 @@ platform: template sensors: devices_count: friendly_name: 'Number of Device trackers' - entity_id: [] value_template: > {{ states.device_tracker | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_entities.yaml b/entities/sensors/system/count_entities.yaml index 7c2d059d..eabcee0c 100644 --- a/entities/sensors/system/count_entities.yaml +++ b/entities/sensors/system/count_entities.yaml @@ -7,6 +7,5 @@ platform: template sensors: entities_count: friendly_name: 'Number of Entities' - entity_id: [] value_template: > {{ states | length }} \ No newline at end of file diff --git a/entities/sensors/system/count_groups.yaml b/entities/sensors/system/count_groups.yaml index dc23a676..541c6d26 100644 --- a/entities/sensors/system/count_groups.yaml +++ b/entities/sensors/system/count_groups.yaml @@ -7,6 +7,5 @@ platform: template sensors: groups_count: friendly_name: 'Number of Groups' - entity_id: [] value_template: >- {{ states.group | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_lights.yaml b/entities/sensors/system/count_lights.yaml index 2ab25129..cc1214af 100644 --- a/entities/sensors/system/count_lights.yaml +++ b/entities/sensors/system/count_lights.yaml @@ -7,6 +7,5 @@ platform: template sensors: lights_count: friendly_name: 'Number of Lights' - entity_id: [] value_template: > {{ states.light | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_media_players.yaml b/entities/sensors/system/count_media_players.yaml index fcca1e4c..e64191ca 100644 --- a/entities/sensors/system/count_media_players.yaml +++ b/entities/sensors/system/count_media_players.yaml @@ -7,6 +7,5 @@ platform: template sensors: media_player_count: friendly_name: 'Number of Media Players' - entity_id: [] value_template: >- {{ states.media_player | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_person.yaml b/entities/sensors/system/count_person.yaml index 3e36ca2e..d7e14830 100644 --- a/entities/sensors/system/count_person.yaml +++ b/entities/sensors/system/count_person.yaml @@ -7,6 +7,5 @@ platform: template sensors: person_count: friendly_name: 'Number of Persons' - entity_id: [] value_template: >- {{ states.person | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_scripts.yaml b/entities/sensors/system/count_scripts.yaml index 462dec2f..97c5617a 100644 --- a/entities/sensors/system/count_scripts.yaml +++ b/entities/sensors/system/count_scripts.yaml @@ -7,6 +7,5 @@ platform: template sensors: script_count: friendly_name: 'Number of Scripts' - entity_id: [] value_template: > {{ states.script | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_sensors.yaml b/entities/sensors/system/count_sensors.yaml index 002d97d1..6a671a23 100644 --- a/entities/sensors/system/count_sensors.yaml +++ b/entities/sensors/system/count_sensors.yaml @@ -7,6 +7,5 @@ platform: template sensors: sensor_count: friendly_name: 'Number of Sensors' - entity_id: [] value_template: >- {{ states.sensor | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_switch.yaml b/entities/sensors/system/count_switch.yaml index 3f2e8b94..2bf0a243 100644 --- a/entities/sensors/system/count_switch.yaml +++ b/entities/sensors/system/count_switch.yaml @@ -7,6 +7,5 @@ platform: template sensors: switch_count: friendly_name: 'Number of Switches' - entity_id: [] value_template: >- {{ states.switch | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_timer.yaml b/entities/sensors/system/count_timer.yaml index 2385a5e7..6ca8195f 100644 --- a/entities/sensors/system/count_timer.yaml +++ b/entities/sensors/system/count_timer.yaml @@ -7,6 +7,5 @@ platform: template sensors: timer_count: friendly_name: 'Number of Timers' - entity_id: [] value_template: >- {{ states.timer | list | count }} \ No newline at end of file diff --git a/entities/sensors/system/count_weather.yaml b/entities/sensors/system/count_weather.yaml index 7938a99f..08f0a8aa 100644 --- a/entities/sensors/system/count_weather.yaml +++ b/entities/sensors/system/count_weather.yaml @@ -7,6 +7,5 @@ platform: template sensors: weather_count: friendly_name: 'Number of Weather' - entity_id: [] value_template: >- {{ states.weather | list | count }} \ No newline at end of file