Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created April 30, 2021 11:02
Show Gist options
  • Save bessarabov/c1c26f9e7851d2204063caf9ff6bbfc4 to your computer and use it in GitHub Desktop.
Save bessarabov/c1c26f9e7851d2204063caf9ff6bbfc4 to your computer and use it in GitHub Desktop.
Датчики температуры в холодильнике для Home Assistant
binary_sensor:
- platform: template
sensors:
fridge_top_temperature_is_ok:
value_template: >-
{{ (states('sensor.0x00158d00045f5f93_temperature') | float > 5)
and (states('sensor.0x00158d00045f5f93_temperature') | float < 12) }}
fridge_bottom_temperature_is_ok:
value_template: >-
{{ (states('sensor.0x00158d00040df945_temperature') | float > -28)
and (states('sensor.0x00158d00040df945_temperature') | float < -14) }}
fridge_top_is_sending_data:
value_template: >-
{{ as_timestamp(now())
- as_timestamp(states.sensor['0x00158d00045f5f93_temperature'].last_updated)
< 60*60*2 }}
fridge_bottom_is_sending_data:
value_template: >-
{{ as_timestamp(now())
- as_timestamp(states.sensor['0x00158d00040df945_temperature'].last_updated)
< 60*60*2 }}
automation:
- id: check_fridge_top_temperature
alias: check_fridge_top_temperature
trigger:
- platform: state
entity_id: binary_sensor.fridge_top_temperature_is_ok
to: 'off'
- platform: time_pattern
minutes: "/20"
condition:
condition: state
entity_id: binary_sensor.fridge_top_temperature_is_ok
state: 'off'
action:
service: notify.bessarabov
data:
message: "Проблема с температурой в холодильнике: {{ states('sensor.0x00158d00045f5f93_temperature') }} °C"
- id: check_fridge_bottom_temperature
alias: check_fridge_bottom_temperature
trigger:
- platform: state
entity_id: binary_sensor.fridge_bottom_temperature_is_ok
to: 'off'
- platform: time_pattern
minutes: "/20"
condition:
condition: state
entity_id: binary_sensor.fridge_bottom_temperature_is_ok
state: 'off'
action:
service: notify.bessarabov
data:
message: "Проблема с температурой в морозилке: {{ states('sensor.0x00158d00040df945_temperature') }} °C"
- id: check_fridge_top_is_sending_data
alias: check_fridge_top_is_sending_data
trigger:
- platform: state
entity_id: binary_sensor.fridge_top_is_sending_data
to: 'off'
- platform: time_pattern
minutes: "/30"
condition:
condition: state
entity_id: binary_sensor.fridge_top_is_sending_data
state: 'off'
action:
service: notify.bessarabov
data:
message: "Датчик температуры температурой в холодильнике дано не отправлял данные"
- id: check_fridge_bottom_is_sending_data
alias: check_fridge_bottom_is_sending_data
trigger:
- platform: state
entity_id: binary_sensor.fridge_bottom_is_sending_data
to: 'off'
- platform: time_pattern
minutes: "/30"
condition:
condition: state
entity_id: binary_sensor.fridge_bottom_is_sending_data
state: 'off'
action:
service: notify.bessarabov
data:
message: "Датчик температуры температурой в морозилке дано не отправлял данные"
title: home
views:
- title: fridge
path: fridge
icon: mdi:fridge
badges:
- entity: sensor.0x00158d00045f5f93_temperature
name: холодильник
- entity: sensor.0x00158d00040df945_temperature
name: морозилка
- entity: binary_sensor.fridge_top_temperature_is_ok
name: °t холодильник
- entity: binary_sensor.fridge_bottom_temperature_is_ok
name: °t морозилка
- entity: binary_sensor.fridge_top_is_sending_data
name: data холодильник
- entity: binary_sensor.fridge_bottom_is_sending_data
name: data морозилка
cards:
- type: history-graph
hours_to_show: 48
refresh_interval: 0
entities:
- entity: sensor.date
name: date
- entity: binary_sensor.fridge_top_temperature_is_ok
- entity: binary_sensor.fridge_bottom_temperature_is_ok
- entity: binary_sensor.fridge_top_is_sending_data
- entity: binary_sensor.fridge_bottom_is_sending_data
- entity: sensor.0x00158d00045f5f93_temperature
name: холодильник
- entity: sensor.0x00158d00040df945_temperature
name: морозилка
- entity: sensor.0x00158d00045f5f93_linkquality
name: холодильник
- entity: sensor.0x00158d00040df945_linkquality
name: морозилка
- type: markdown
content: |-
холодильник:
{{ states('sensor.0x00158d00045f5f93_temperature') }} °C (5° — 12°)
{{ states.sensor['0x00158d00045f5f93_temperature'].last_updated }}
{{ relative_time(states.sensor['0x00158d00045f5f93_temperature'].last_changed)}}
морозилка:
{{ states('sensor.0x00158d00040df945_temperature') }} °C (-28° — -14°)
{{ states.sensor['0x00158d00040df945_temperature'].last_updated }}
{{ relative_time(states.sensor['0x00158d00040df945_temperature'].last_updated) }}
- type: entities
entities:
- automation.check_fridge_top_temperature
- automation.check_fridge_bottom_temperature
- automation.check_fridge_top_is_sending_data
- automation.check_fridge_bottom_is_sending_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment