initial commit

This commit is contained in:
2025-02-07 12:46:24 -05:00
commit 8dfb36a3f1
183 changed files with 9212 additions and 0 deletions

View File

@ -0,0 +1,10 @@
---
- platform: template
sensors:
number_doors_open:
friendly_name: "Open Doors"
unit_of_measurement: door(s)
value_template: >
{{ label_entities(label_id('external')) | expand | selectattr('state', '==', 'on') | map(attribute='entity_id') | select('in', label_entities("door")) | list | count }}
# {{ states.binary_sensor | selectattr('object_id', 'match', 'door_.*') | selectattr('state', '==', 'on') | map(attribute='entity_id') | list | count }}

View File

@ -0,0 +1,52 @@
---
- platform: template
sensors:
lock_01_keycode:
friendly_name: 'Lock Last Key Code'
value_template: >-
{% if states('sensor.lock_01_alarm_level') | int == 0 and states('sensor.lock_01_alarm_type') | int == 19 %}
Locked
{% elif states('sensor.lock_01_alarm_level') | int == 1 and states('sensor.lock_01_alarm_type') | int == 19 %}
Alex
{% elif states('sensor.lock_01_alarm_level') | int == 2 and states('sensor.lock_01_alarm_type') | int == 19 %}
Tanya
{% elif states('sensor.lock_01_alarm_level') | int == 3 and states('sensor.lock_01_alarm_type') | int == 19 %}
Maxim
{% endif %}
- platform: template
sensors:
lock_01_status:
friendly_name: 'Lock Status'
value_template: >-
{% if states('sensor.lock_01_alarm_type') | int == 17 %}
Lock Secured at Keypad Bolt Jammed (Not fully extended)
{% elif states('sensor.lock_01_alarm_type') | int == 18 %}
Lock Secured at Keypad Successful (Fully extended)
{% elif states('sensor.lock_01_alarm_type') | int == 21 %}
Lock Secured using Keyed cylinder or inside Thumb-Turn
{% elif states('sensor.lock_01_alarm_type') | int == 23 %}
Lock Secured by Controller Bolt Jammed (Not fully extended)
{% elif states('sensor.lock_01_alarm_type') | int == 24 %}
Lock Secured by Controller Successful (Fully extended)
{% elif states('sensor.lock_01_alarm_type') | int == 26 %}
Lock Auto Secured Bolt Jammed (Not fully extended)
{% elif states('sensor.lock_01_alarm_type') | int == 27 %}
Lock Auto Secured Successful (Fully extended)
{% elif states('sensor.lock_01_alarm_type') | int == 19 %}
Lock Un-Secured by User ({{ states('sensor.lock_01_alarm_level') | int }}) at Keypad
{% elif states('sensor.lock_01_alarm_type') | int == 22 %}
Lock Un-Secured using Keyed Cylinder or inside Thumb-Turn
{% elif states('sensor.lock_01_alarm_type') | int == 25 %}
Lock Un-Secured by Controller Successful (Fully retracted)
{% elif states('sensor.lock_01_alarm_type') | int == 161 %}
Failed User Code attempt at Keypad
{% elif states('sensor.lock_01_alarm_type') | int == 167 %}
Low Battery Level
{% elif states('sensor.lock_01_alarm_type') | int == 168 %}
Critical Battery Level
{% elif states('sensor.lock_01_alarm_type') | int == 169 %}
Battery Level too Low to operate lock
{% else %}
Unknown State
{% endif %}

View File

@ -0,0 +1,8 @@
---
- platform: template
sensors:
number_light_on:
friendly_name: "Lights ON"
unit_of_measurement: light(s)
value_template: >
{{ states.light | rejectattr('attributes.color_mode', '==', 'onoff') | rejectattr('attributes.entity_id', 'defined') | selectattr('state', '==', 'on') | map(attribute='entity_id') | list | count }}

View File

@ -0,0 +1,11 @@
---
#- platform: template
# switches:
# lr_fan:
# value_template: "{{ is_state('fan.xiaomi_fan', 'on') }}"
# turn_on:
# service: script.xiaomi_fan_normal_operation
# turn_off:
# service: fan.turn_off
# data:
# entity_id: fan.xiaomi_fan

View File

@ -0,0 +1,19 @@
---
- platform: template
sensors:
sunset_time:
value_template: '{% set timestamp = as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%I:%M") %} {{ timestamp.lstrip("0") }}'
friendly_name: 'Sunset'
sunrise_time:
value_template: '{% set timestamp = as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%I:%M") %} {{ timestamp.lstrip("0") }}'
friendly_name: 'Sunrise'
sun_state:
friendly_name: 'Sun State'
value_template: '{{ states.sun.sun.state }}'
sun_elevation:
friendly_name: 'Sun Elevation'
value_template: '{{ states.sun.sun.attributes.elevation }}'
unit_of_measurement: 'degrees'

View File

@ -0,0 +1,72 @@
---
- platform: template
sensors:
cost_energy_monthly:
friendly_name: "Energy Cost (Monthly)"
unit_of_measurement: '$'
value_template: >
{{ "%.2f" | format( states('sensor.power_house_total_1mon') | float * ( 0.112830 + 0.062540 ) + 4.27 ) }}
cost_energy_daily:
friendly_name: "Energy Cost (Daily)"
unit_of_measurement: '$'
value_template: >
{{ "%.2f" | format( states('sensor.power_house_total_1d') | float * ( 0.112830 + 0.062540 ) ) }}
# Price per kWh
# Delivery Price per kWh
# Customer charge 4.27 per month
- platform: template
sensors:
cost_water_monthly:
friendly_name: "Water Cost (Monthly)"
unit_of_measurement: '$'
value_template: >
{{ "%.2f" | format( states('sensor.water_monthly') | float / 100 * ( 0.77752 + 0.05289 + 0.08791 + 0.00551) + 19.85 + 3.67 ) }}
cost_water_daily:
friendly_name: "Water Cost (Daily)"
unit_of_measurement: '$'
value_template: >
{{ "%.2f" | format( states('sensor.water_daily') | float / 100 * ( 0.77752 + 0.05289 + 0.08791 + 0.00551 ) ) }}
# Aug 02 + 31 day
# Water Service 50.95
# Water Service Charge 19.85
# Water Usage Charge (40 x $0.77752) 31.10
# Other Charges 9.53
# Purchased Water Surcharge (40 x $0.05289) 2.12
# Distribution System Improvement Charge
# (1 x $3.67) 3.67
# LSLRC Surcharge (40 x $0.08791) 3.52
# Special Program Charge (40 x $0.00551) 0.22
- platform: template
sensors:
cost_gas_monthly:
friendly_name: "Gas Cost (Monthly)"
unit_of_measurement: '$'
value_template: >
{{ "%.2f" | format( states('sensor.gas_monthly') | float * 1.012 * 1.032 * (0.550932 + 0.397731) + 8.62 ) }}
cost_gas_daily:
friendly_name: "Gas Cost (Daily)"
unit_of_measurement: '$'
value_template: >
{{ "%.2f" | format( states('sensor.gas_daily') | float * 1.012 * 1.032 * ( 0.550932 + 0.397731 ) ) }}
# Converted to CCF x 1.012 13.156
# Converted to therms x 1.032 13.577
# Total gas you used in 29 days 13.577 therms
# Delivery charges
# Monthly service charge $8.62
# Charges for delivering gas to you:
# 13.577 therms x $0.550932 $7.48
# Total gas delivery charges $16.10
# Supply charges
# Cost of gas supplied by PSE&G:
# 13.577 therms x $0.397731 $5.40
# Total gas supply charges $5.40
# Total gas charges $21.50

View File

@ -0,0 +1,8 @@
---
- platform: template
sensors:
number_windows_open:
friendly_name: "Windows Open"
unit_of_measurement: window(s)
value_template: >
{{ states.binary_sensor | selectattr('object_id', 'match', 'window_.*') | selectattr('state', '==', 'on') | map(attribute='entity_id') | list | count }}

View File

@ -0,0 +1,8 @@
---
- platform: history_stats
name: "[Time Tracker] NPFD (monthly)"
entity_id: person.alexander_savin
state: "NPFD"
type: time
start: "{{ now().replace(day=1, hour=0, minute=0, second=0, microsecond=0 ) }}" #current month
end: "{{ now() }}"