When you're living with family or roomates AND a pet you never sure when it was already fed or just asking for attention)
So you have to message roommate to check if he or she already did a refill to pets bowl. No more!
The first part is crafting.You'll need to fit the reed switch under the plastic stand. Depending on your bowl configuration you may need to strip off the case, wrap the sensor with the insulation tape and fix it with adhesive tape. Even without a case it could be necessary to add some height to the stand so it will not rest on the sensor itself. Simple furniture pads can do the trick.
Then you need the adhesive tape to position the magnet on the down side of the bowl. Mind the magnetic poles! Just try both sides of a magnet, the wrong one will give false results to the sensor.
The second part: automation.(Setup of xiaomi devices in Home Assistant is not covered in this guide, you'll find the neccessary information here)
In configuration.yaml create an input_boolean sensor. It will work 'behind the scenes' and can be hidden from UI to avoid manipulation by user (but still can be operated from develoeper tools)
input_boolean:
cat_is_fed:
initial: off
In binary sensors create a template sensor as a 'frontend', to show in UI or tunnel it to homekit devices if needed.
binary_sensor:
cat_is_fed:
friendly_name: "Cat is fed"
value_template: "{{ states.input_boolean.cat_is_fed.state == 'on' }}"
And finaly the automations: they will mark the cat 'as fed' (on) if bowl was picked up and then placed back, but will revert it 'not fed' (off) after 10 hours from the moment of bowl placed in its stand.
- id: 'cat_bowl_placed_automation'
alias: '[CAT] Bowl placed'
trigger:
- entity_id: binary_sensor.cat_bowl_sensor
platform: state
to: 'off'
condition: []
action:
- data:
entity_id: input_boolean.cat_is_fed
service: input_boolean.turn_on
- id: 'cat_reset_automation'
alias: '[CAT] Reset'
trigger:
- entity_id: input_boolean.cat_is_fed
platform: state
to: 'on'
for:
hours: 10
condition: []
action:
- data:
entity_id: input_boolean.cat_is_fed
service: input_boolean.turn_off
You can check it out in action on this video https://twitter.com/marcellus00/status/1038813183753035782
ExtraFor the sake of thoroughness here’s the lovelace card bit
views:
- title: Cat
icon: mdi:cat
cards:
- type: picture-entity
entity: binary_sensor.cat_is_fed
name: Cat is fed
state_image:
"on": /local/cat.png
"off": /local/cat_triggered.png
Comments