Dog Food Reminder

One of my last hold out “automations” on Smartthings is a custom app that I tweaked to allow me to know if my dog has been fed at the appropriate time and send a reminder if there has been no activity, and let me know when she has been fed. First world problems of a busy household :slight_smile:

I would like to duplicate this in NR, but not sure where to start. We feed her twice a day. Ideally, I would like a log kept of when she’s been fed and let me know last time the feeder motion detector was triggered. If it could survive restarts, that would be even better. This automation uses a z-wave motion sensor.

At a laster phase, I would like to use this data to calculate dog food left until replacement, and perhaps add some type of physical notification at the feeder to let others know if she has/hasn’t been fed at the appropriate time window.

Thank you!

There are so many ways to accomplish this. What does your current automation routine look like? What are the triggers and what are the conditions that must be met? Is it a time of day problem, or is it a time between feedings problem? Lots of variables to consider.

A simple counter could track the number of times that the motions sensor has been triggered, but you may have an inherent problem in the logic.

Are you wanting to know when the dog has been fed, or when the dog has eaten what he’s been fed?

If it’s the former, then a sensor on the dog-food bin would trigger when you open the lid and scoop. If not, it’s the motion sensor for the dog at the dog bowl. But what if the dog goes to check for food at an odd time? You might need a condition that looks at the number of times the motion sensor is triggered within a time range. That would indicate the dog was at the bowl for an extended period of time.

Or, you could use an ultrasonic distance sensor to sense that there’s something standing at the dog’s station for a time.

So many ways…

My current routine checks to see if the motion sensor has triggered in a specific time range and if not, notifies via text. When it is triggered, it notifies me that she has been fed.

I intentionally left the details vague because I wanted to get some ideas on how to perhaps improve upon what I have now.

I would like to be able to look and see when she was fed last, which partially works now using “last-changed”, which I believe is partially deprecated anyway.

Really just looking for some good ideas and/or examples to pull from, as I doubt I’m re-inventing the wheel on this.

This is not yet released, but I am very sure that this might interest some of you:

That is pretty cool. Be interested to follow. Not sure if it’s big enough to really work with a large dog (or dogs) but maybe.

It should with medium sized kibble, but I don’t know. My dog has medium sized kibble so it should be ok for my dog. But even if it doesn’t, at $28 dollars it won’t hurt to try and if it isn’t good for my dog, I’m pretty sure I can make a cat owner happy.

For my dog, food, (water and weight), I use a load cells to measure weights of all three. I then use automation to trigger based on weight for:

  • Food delivered: >## grams, trigger a boolean switch and send an email with quantity
  • Food finished:> ## grams> 10, trigger boolean switch off and send email with quantity.
    I also calculate the time from now from finished (Last changed) so I can estimate (and maybe notify) if she was not fed for 12 hours.

Took a bit of fiddling over a year or two but it works pretty well. I use a ESP8266 with ESPhome to create the sensor (with temp/humidity and motion). For the load cell, go with a 5kg or less load cell so you have the (gram specific) resolution you may want. My dog gets a cup = 200grams. :slight_smile:

3 Likes

Oh wow, that is excellent! I would love to see some details (pics) of this setup. Currently, my dog has liver disease and won’t eat kibble, so the project is on hold, but I’m hopeful we’ll see a recovery and get her back on track and at some point get a second dog, so I’m still very interested in this.

Could you share the flows, examples, etc?

Can we see its brains code

Dog Bowls - Water and Food - with load cells on an ESP-8266 - running ESPHome

Dashboard:(very messy) shows - Dog Camera, dog weight (testing options), food weight (calibrated to ~gram), Water bowl etc. Dials in upper right show food/water bowls.
Most useful is the “time last fed” so we know if we forgot to feed her.

1 Like

Here ya go.
Welcome suggestions, feedback.

Sensors:
#Dog Food
- platform: template
  sensors:
    dogcup:
      value_template: '{{ ((states.sensor.dog_food.state | float/ 128) | round(2))  }}'
      friendly_name: 'Dog Food'
      unit_of_measurement: 'Cup'

- platform: template
  sensors:
    dog_last_fed:
      value_template: '{{ as_timestamp(states.input_boolean.dog_bowl_full.last_changed) | timestamp_custom("%a:%I:%M:%p") }}'
      friendly_name: "Time last fed"

#DEV measure time laurel has food on bowl
- platform: history_stats
  name: "Laurel time eat"
  entity_id: input_boolean.dog_bowl_full
  state: 'on'
  type: time
  start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'
- platform: template
  sensors:
    laurel_time_eath:
      value_template: '{{ states.sensor.laurel_time_eat.attributes.value }}'

#Automations:
#Dog Fed    
- alias: 'Laurel Eat'
  trigger:
    platform: numeric_state
    entity_id: sensor.dog_food
    above: '50'
    for: '00:00:05'
  action:
    - service: notify.iosme
      data_template:
        title: "Laurel has food"
        message: "Laurel has food {{ states.sensor.dog_food.state }}g." 
    - delay: '00:00:05'
    - service: input_boolean.turn_on
      entity_id: input_boolean.dog_bowl_full

- alias: 'Laurel Eat Done'
  trigger:
    platform: numeric_state
    entity_id: sensor.dog_food
    below: 10
    for: '00:00:05'
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.dog_bowl_full
    - delay: '00:01:00'
    - service: notify.iosme
      data_template:
        title: "Laurel is done eating"
        message: "All done {{ states.sensor.dog_food.state }}"

ESPHome - Config
esphome:
  name: espfood8
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: '<ssid>'
  password: '<password>'
  manual_ip:
    static_ip: ###.###.###.###
    gateway: ###.###.###.###
    subnet: ###.###.###.###

# mqtt:
  # broker: '###.###.###.###'
  # username: ''
  # password: ''
  # discovery: clean
# Enable logging
logger:

api:

ota:

sensor:
  - platform: hx711
    name: "dog food"
    dout_pin: D2
    clk_pin: D1
    gain: 128
#    accuracy_decimals: 1
    update_interval: 10s
    filters:
          #moved to 120 to stop small swings in value.
      - delta: 120.0
      - lambda: |-
          auto first_mass = 0.0; // first known mass was 0kg
          auto first_value = 861900.0; // value for the first known mass was 120
          auto second_mass = 113.0; // second mass was 1kg
          auto second_value = 1093300.0; // second value was 810

          return map(x, first_value, second_value, first_mass, second_mass);
    unit_of_measurement: g
  - platform: wifi_signal
    name: "espfood8 Wifi"
    update_interval: 300s
2 Likes