Baby Buddy Log: Tummy Time, Sleep, Feeding, Diaper Change, Pumping

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Some amazing work has been done by the Baby Buddy project and @jcgoette to build the Baby Buddy Home Assistant HACS Integration.

Purpose

This blueprint makes it easier to log Baby Buddy actions from Home Assistant

What can you do with it?

If you have a baby you know that some people say you should log a variety of activities like sleep times, diaper changes, etc. To see what Baby Buddy can do start at the project’s GitHub page: GitHub - babybuddy/babybuddy: A buddy to help caregivers track sleep, feedings, diaper changes, and tummy time to learn about and predict baby's needs without (as much) guess work.

To see what I did with it go to: Baby Buddy Dashboard & Blueprint

Pre-requisites

This blueprint requires Helpers (You can use whatever name you want or use the below.)

You should also create a new dashboard page. This will be used as the target page when you tap the timer notification.

blueprint:
  name: Baby Buddy
  author: noblewolf
  description: "Notifications and control of Baby Buddy. Works with Baby Buddy https://github.com/jcgoette/baby_buddy_homeassistant \n\nThis blueprint requires Helpers (You can use whatever name you want or use the below.)
  \n- Input Button https://www.home-assistant.io/integrations/button/
  \n- - BB Diaper Helper
  \n- - BB Feeding Helper
  \n- - BB Pumping Helper
  \n- - BB Sleep Helper
  \n- - BB Tummy Time Helper
  \n- Counter https://www.home-assistant.io/integrations/counter/
  \n- - BB Diaper Counter
  \n- - BB Feeding Counter
  \n- - BB Pumping Counter
  \n- Input Text https://www.home-assistant.io/integrations/input_text/
  \n- - BB Notes
  \n- Input Number https://www.home-assistant.io/integrations/input_number/
  \n- - BB Amount
  "
  domain: automation
  input:
    bb_child:
      name: Baby Buddy Child
      description: Choose one child per automation.
      selector:
        entity:
          domain: sensor
          device_class: babybuddy_child
    bb_child_last_timer:
      name: Baby Buddy Child Last Timer
      description: Timer created by Baby Buddy integration. Choose the same timer as the child name.
      selector:
        entity:
          domain: sensor
          device_class: timestamp
    notification_group:
      name: Notification or Notification Group
      description: Device or notify group to notify of timer starting. Blueprint sends a notification each time a timer start. For example notify.josh_s_phone or notify.all_phones
    diaper_button:
      name: Diaper Button
      description: Helper (button type) to trigger diaper log. Use this button in your UI to log a diaper change.
      selector:
        entity:
          domain: input_button
    feeding_button:
      name: Feeding Button
      description: Helper (button type) to trigger feeding log. Use this button in your UI to log a feeding long.
      selector:
        entity:
          domain: input_button
    pumping_button:
      name: Pumping Button
      description: Helper (button type) to trigger pumping log. Use this button in your UI to log a pumping session.
      selector:
        entity:
          domain: input_button
    tummy_time_button:
      name: Tummy Timer Button
      description: Helper (button type) to trigger tummy time log. Use this button in your UI to log tummy time.
      selector:
        entity:
          domain: input_button
    sleep_button:
      name: Helper to trigger sleep log.
      description: Helper (button type) to trigger sleep log. Use this button in your UI to log a sleep session.
      selector:
        entity:
          domain: input_button
    bb_timer:
      name: Baby Buddy Timer
      description: The timer created by Baby Buddy. Usually named switch.firstName_lastName_timer For example switch.lindsay_smith_timer
      selector:
        entity:
          domain: switch
    diaper_counter:
      name: Diaper Change Counter
      description: Helper you created to count diaper changes. Resets at midnight.
      selector:
        entity:
          domain: counter
    feeding_counter:
      name: Feeding Counter
      description: Helper you created to count feeing sessions. Resets at midnight.
      selector:
        entity:
          domain: counter
    pumping_counter:
      name: Pumping Counter
      description: Helper you created to count pumping sessions. Resets at midnight.
      selector:
        entity:
          domain: counter
    bb_notes:
      name: Notes
      description: Shared notes field for diaper change or feeding notes.
      selector:
        entity:
          domain: input_text
    bb_amount:
      name: Amount
      description: Shared amount field for diaper changes and feedings.
      selector:
        entity:
          domain: input_number
    bb_ui_url:
      name: Link to Baby Buddy tab in your dashboard.
      description: Link to a dashboard page that has your Baby Buddy controls. For example /lovelace/baby-buddy Used as the tap action in the timer notificaiton to allow quick access.
trigger:
  - platform: state
    entity_id: !input diaper_button
    id: diaper-change
  - platform: state
    entity_id: !input feeding_button
    id: feeding-log
  - platform: state
    entity_id: !input pumping_button
    id: pumping-log
  - platform: state
    entity_id: !input tummy_time_button
    id: tummy-time-end
  - platform: state
    entity_id: !input sleep_button
    id: sleep-end-log
  - platform: time
    at: "00:00:00"
    id: midnight
  - platform: state
    entity_id: !input bb_timer
    to: "on"
    id: timer-on
  - platform: state
    entity_id: !input bb_timer
    to: "off"
    id: timer-off
variables:
  _bb_amount: !input bb_amount
  _bb_notes: !input bb_notes
  _bb_child_last_timer: !input bb_child_last_timer
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: diaper-change
        sequence:
          - service: babybuddy.add_diaper_change
            data:
              type: "{{ states('select.baby_buddy_diaper_type') }}"
              color: "{{ states('select.baby_buddy_diaper_color') }}"
              notes: "{{ states(_bb_notes) }}"
            target:
              entity_id: !input bb_child
          - service: input_text.set_value
            data:
              value: ""
            target:
              entity_id: !input bb_notes
          - service: counter.increment
            data: {}
            target:
              entity_id: !input diaper_counter
      - conditions:
          - condition: trigger
            id: feeding-log
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: "{{ state_attr(_bb_child_last_timer, 'active') }}"
                sequence:
                  - service: babybuddy.add_feeding
                    data:
                      timer: true
                      type: "{{ states('select.baby_buddy_feeding_type') }}"
                      method: "{{ states('select.baby_buddy_feeding_method') }}"
                      amount: "{{ states(_bb_amount) }}"
                      notes: "{{ states(_bb_notes) }}"
                    target:
                      entity_id: !input bb_timer
            default:
              - service: babybuddy.add_feeding
                data:
                  type: "{{ states('select.baby_buddy_feeding_type') }}"
                  method: "{{ states('select.baby_buddy_feeding_method') }}"
                  amount: "{{ states(_bb_amount) }}"
                  notes: "{{ states(_bb_notes) }}"
                target:
                  entity_id: !input bb_timer
          - service: input_text.set_value
            data:
              value: ""
            target:
              entity_id: !input bb_notes
          - service: input_number.set_value
            data:
              value: 0
            target:
              entity_id: !input bb_amount
          - service: counter.increment
            data: {}
            target:
              entity_id: !input feeding_counter
      - conditions:
          - condition: trigger
            id: pumping-log
        sequence:
          - service: babybuddy.add_pumping
            data:
              amount: '{{ states(_bb_amount) }}'
              notes: '{{ states(_bb_notes) }}'
            target:
              entity_id: !input bb_child
          - service: counter.increment
            data: {}
            target:
              entity_id: !input pumping_counter
          - service: input_text.set_value
            data:
              value: ""
            target:
              entity_id: !input bb_notes
          - service: input_number.set_value
            data:
              value: 0
            target:
              entity_id: !input bb_amount
      - conditions:
          - condition: trigger
            id: tummy-time-end
        sequence:
          - service: babybuddy.add_tummy_time
            data:
              timer: true
            target:
              entity_id: !input bb_timer
      - conditions:
          - condition: trigger
            id: sleep-end-log
        sequence:
          - service: babybuddy.add_sleep
            data:
              timer: true
            target:
              entity_id: !input bb_timer
      - conditions:
          - condition: trigger
            id: midnight
        sequence:
          - service: counter.reset
            data: {}
            target:
              entity_id:
                - !input diaper_counter
                - !input feeding_counter
                - !input pumping_counter
      - conditions:
          - condition: trigger
            id: timer-on
        sequence:
          - service: !input notification_group
            data:
              title: ⏳️ Baby Buddy Timer Running
              message: Tap to open Baby Buddy to log timer.
              data:
                group: baby-buddy-timer
                clickAction: !input bb_ui_url
                url: !input bb_ui_url
                persistent: true
                tag: baby-buddy-timer
      - conditions:
          - condition: trigger
            id: timer-off
        sequence:
          - service: !input notification_group
            data:
              message: clear_notification
              data:
                tag: baby-buddy-timer
mode: parallel
max: 10

Change Log

2022-11-12

Initial Commit

7 Likes

Thanks for your work on this!

For those that are also searching for ways to automate parenting, I took this a step further and repurposed a couple of old Pico remotes to log this information with the click of a button. I also created an automation for the naptime by connecting it to the Snoo Bassinet.

My first baby is due in two weeks and with any luck, he’ll be calling HASSIO daddy in no time!

3 Likes

good morning, is the Blueprint globally broken after the latest Baby Buddy updates or is it just my system?

Trace Timeline shows:

Stopped because an error was encountered at 10. Januar 2023 um 18:13:11 (runtime: 0.01 seconds)

extra keys not allowed @ data[‘type’]

any hint?

I believe the most recent update of the BB HACS integration broke this Blueprint. I updated the integration before the add on and noticed it break in the first instance.

I will let you know if I find the issue. I get the same error as above.

1 Like

@ankrarke and @jeti I’m not currently experiencing any issues and I’m on the most current version of the Integration and Addon. Please let me know if you find any issue and I’ll update the Blueprint.

Side note… Now that the Baby Buddy Addon has ingress see fix here it can be accessed via the Home Assistant companion app so the need for this Blueprint (for me at least) is not necessary.

I’ve just installed this for the first time and experiencing the same issue as the commenters above. Happy to help try debugging as best I can, just let me know what you need.

I’m using a standalone instance of BB, not the Addon, so the ingress issue isn’t relevant in my case.

@NathanReus @ankrarke @jeti I just saw that @jcgoette released a new version to fix an issue. Please update your Integration, test, and comment back if your issues are fixed.

@Noblewolf I think this resolves the Issue but ingress is much more straight thankd :slight_smile: so I switched to use ingress now, works perfectly!
thanks

I want to use this as a starting point for my own Baby Buddy setup, and I’m curious if you could help me understand how this works.

My ideal setup has some “quick action” buttons using the ADD_DIAPER_CHANGE service (and others) from the Baby Buddy integration, with an option to create more detailed notes like in your example.

I really like how you have options for creating detailed notes. Can you explain for me in a little more detail how this setup interfaces with Baby Buddy to send the contents of those notes as a feeding/diaper/etc. log?

I have some suggested copy-editing changes.

Line 63 (current):

       name: Helper to trigger sleep log.

Line 63 (suggested):

      name: Sleep Log Button

This makes this consistent with other helpers in terms of naming convention, capitalization, and punctuation.

Line 70 (current):

      description: The timer created by Baby Buddy. Usually named switch.firstName_lastName_timer For example switch.lindsay_smith_timer

Line 70 (proposed):

      description: The timer created by Baby Buddy. Usually named switch.firstName_lastName_timer; for example, switch.lindsay_smith_timer

This fixes a lack of punctuation between sentences.

Line 82 (current):

      description: Helper you created to count feeing sessions. Resets at midnight.

Line 82 (proposed):

      description: Helper you created to count feeding sessions. Resets at midnight.

Fixes typo in “feeding”.

1 Like

Thank you! Once I get a minute when I’m home and baby is asleep I’ll add your proposed changes.

Check out the documentation for the Baby Buddy integration here: GitHub - jcgoette/baby_buddy_homeassistant: This custom integration provides sensors for Baby Buddy API endpoints.

If you still need guidance after that reply back here.

Baby Buddy has been updated an no longer uses the “Active” key and thus is no longer provided by the HACS integration.

value_template: "{{ state_attr(_bb_child_last_timer, 'active') }}"

Is now no longer working.

EDIT: It looks like last_timer is no longer provided by the HACS integration at all :frowning:

EDIT: It looks like last_timer is no longer provided by the HACS integration at all :frowning:

For me it appeared once I flipped the timer switch sensor

Good catch. Yes, it seems that a few sensors like last_timer do not appear until you activate that feature in Baby Buddy for the first time. It’s been a while since I’ve used Baby Buddy so I don’t remember which ones behave that way.

I’m running into the issue with the blueprint after updating to new version of Baby Buddy and updating HA to the latest build

value must be one of ['Solid', 'Wet', 'Wet and Solid'] for dictionary value @ data['type']

Same for feed, it needs a value. I don’t know where to set a default value that it can pick everytime.

Anyone knows what I’m doing wrong? I keep getting the error:

Message malformed: Entity inpu is neither a valid entity ID nor a valid UUID for dictionary value @ data[‘entity_id’]

My yaml looks like this:

description: “”
alias: Baby Buddy
use_blueprint:
path: Noblewolf/baby-buddy-log-tummy-time-sleep-feeding-diaper-change-pumping.yaml
input:
bb_child: sensor.baby_marla
bb_child_last_timer: sensor.marla_last_timer
notification_group: notify.all_phones
bb_timer: switch.marla_timer
diaper_counter: counter.bb_diaper_counter
feeding_counter: counter.bb_feeding_counter
pumping_counter: counter.bb_pumping_counte
bb_notes: input_text.bb_notes
bb_amount: input_number.bb_amount
diaper_button: inpu
feeding_button: input_button.bb_diaper_helper
pumping_button: input_button.bb_pumping_helper
tummy_time_button: input_button.bb_tummy_time_helper
sleep_button: input_button.bb_sleep_helper
bb_ui_url: /lovelace/babybuddy

I also tryed going with the http://homeassistant.local:8123/lovelace/babybuddy for the ui