Skip to content

Commit

Permalink
add cat food level
Browse files Browse the repository at this point in the history
  • Loading branch information
zanix committed Mar 5, 2024
1 parent 080b6b4 commit 744b3bd
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
15 changes: 15 additions & 0 deletions entities/template/sensor/cat_feeder_food_level.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# The template integration allows creating entities which derive their values
# from other data. This is done by specifying templates for properties of an
# entity, like the name or the state.
#
# https://www.home-assistant.io/integrations/template/
#
sensor:
- name: Cat Feeder Food Level
icon: mdi:paw
availability: "{{ has_value('sensor.cat_feeder_total_weight') }}"
unit_of_measurement: "%"
state: |-
{% set weight = int(states("sensor.cat_feeder_total_weight"), 0) %}
{{ ((1440 - weight) / 1440 * 100) | round(1) }}
34 changes: 34 additions & 0 deletions ui-lovelace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5593,6 +5593,40 @@ views:
icon: mdi:food
name: Daily Weight
type: sensor
- animation:
state: 'on'
card_mod:
style: "ha-card {\n background: none;\n border-width: 0;\n}\n#states {\n\
\ padding: 8px 2px;\n}\nbar-card-name,\nbar-card-value {\n font-weight:\
\ 500;\n text-shadow: 1px 1px var(--primary-background-color);\n}\nbar-card-backgroundbar\
\ {\n background-color: var(--primary-background-color);\n}\n"
decimal: 1
entities:
- entity: sensor.cat_feeder_food_level
height: 24px
max: 100
min: 0
name: Food Level
positions:
icon: inside
indicator: inside
severity:
- color: var(--red-color)
from: 0
to: 10
- color: var(--orange-color)
from: 10
to: 20
- color: var(--amber-color)
from: 20
to: 40
- color: var(--light-green-color)
from: 40
to: 70
- color: var(--green-color)
from: 70
to: 100
type: custom:bar-card
- content: "{%- if has_value(\"sensor.cat_feeder_schedule\") -%}\n{%- set schedules\
\ = states(\"sensor.cat_feeder_schedule\") | replace(\"'\", '\"') | from_json\
\ -%}\n{%- for schedule in schedules -%}\n {{ schedule.size }} portions at\
Expand Down

0 comments on commit 744b3bd

Please sign in to comment.