Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenterheerdt committed Nov 27, 2022
1 parent b64e80c commit 5755dd9
Show file tree
Hide file tree
Showing 6 changed files with 896 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# Baby-Buddy-Keypad
# Baby-Buddy-Keypad

inspired by https://github.com/sfgabe/OITProjects/tree/master/Baby_Buddy_Keypad I made a version of the baby buddy keypad.
Differences between this version and the original apart the physical appearance are:
- Uses ESP32 chip instead of ESP8266 because of option to do deepsleep (for battery version)
- removed light scenes support
- added support for feeding start / end
- added support for tummy time start / end
- added a version that is battery powered using two AA batteries. Since it uses deepsleep it can run for an extended time on just these batteries. Note that if you go this route you only can use single click for the buttons, so no double click/hold/etc.

## Parts
- [8 waterproof buttons](https://www.amazon.com/Waterproof-Momentary-Button-Switch-Colors/dp/B07F24Y1TB/ref=sr_1_9?crid=1TF5LGCYWZNZZ&keywords=waterproof+buttons&qid=1669590461&sprefix=waterproof+buttons%2Caps%2C154&sr=8-9).
- [a ESP32 board that provides enough RCT ports](https://www.amazon.com/gp/product/B08D5ZD528/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1).
- [Battery holder case (for battery powered version only)](https://www.amazon.com/gp/product/B09V7Z4MT7/ref=ppx_yo_dt_b_asin_title_o08_s00?ie=UTF8&psc=1).
- Home Assistant installation with ESPHome
- enclosure (I used some wood and glue)

## Assembly
- all switches are connected to VIN and to their respective GPIOs (see ESPHome YAML files)

## Programming
- Use ESPHome to load the battery powered or USB powered code
- Add your ESP device to Home Assistant once detected
- Add the Baby Buddy HA Integration if you haven't already.
- Add your own automations (you can use the one here for inspiration - for the battery powered one there are no events being fired, but a sensor will be created that returns the wake reason.).
- You'll need to figure out your baby's entity ID number/name from HA for the automations to log correctly, and decide what notes will be helpful, and change the YAML as needed. You can figure this out by making a test service call from the HA developer section and see what the YAML shows you for entity_id.

## Images
![](top.jpg)

![](inside.jpg)
150 changes: 150 additions & 0 deletions battery-powered-keypad.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
esphome:
# Battery powered version. This uses deepsleep and sends the wake reason (button press) in a sensor to HA.
# Only supports single click, no double click, hold, etc like the USB powered version.
name: dev-esp32
on_boot:
- priority: 900
then:
- lambda: |-
id(wake_up_reason) = esp_sleep_get_ext1_wakeup_status();
- wait_until:
condition:
api.connected
timeout: 60s
- priority: 900
then:
- lambda: esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
esp32:
board: esp-wrover-kit #or whatever your board is
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Dev-Esp32 Fallback Hotspot"
password: !secret hotspot_password
captive_portal:
sensor:
- platform: template
id: wakereasonsensor
name: "Wake Reason"
accuracy_decimals: 0
lambda: |-
return id(wake_up_reason);
#sleepstart: GPIO26
#sleepstop: GPIO33
#tummytimestart: GPIO25
#tummytimestop: GPIO32
#feedingstart: GPIO27
#feedingstop: GPIO14
#diaperwet: GPIO12
#diapersolid: GPIO13
binary_sensor:
- platform: gpio
pin:
number: GPIO26
mode:
input: true
pulldown: true
id: sleepstart
name: Sleep Start
- platform: gpio
pin:
number: GPIO33
mode:
input: true
pulldown: true
id: sleepstop
name: Sleep Stop
- platform: gpio
pin:
number: GPIO25
mode:
input: true
pulldown: true
id: tummytimestart
name: Tummy Time Start
- platform: gpio
pin:
number: GPIO32
mode:
input: true
pulldown: true
id: tummytimestop
name: Tummy Time Stop
- platform: gpio
pin:
number: GPIO27
mode:
input: true
pulldown: true
id: feedingstart
name: Feeding Start
- platform: gpio
pin:
number: GPIO14
mode:
input: true
pulldown: true
id: feedingstop
name: Feeding Stop
- platform: gpio
pin:
number: GPIO12
mode:
input: true
pulldown: true
id: diaperwet
name: Diaper Wet
- platform: gpio
pin:
number: GPIO1
mode:
input: true
pulldown: true
id: diapersolid
name: Diaper Solid
deep_sleep:
id: deep_sleep_1
run_duration: 10s #10s
sleep_duration:
days: 1
esp32_ext1_wakeup:
pins:
- number: GPIO12
- number: GPIO13
- number: GPIO14
- number: GPIO25
- number: GPIO26
- number: GPIO27
- number: GPIO32
- number: GPIO33
mode: ANY_HIGH
globals:
- id: wake_up_reason
type: int #or uint64_t if your board requires it
restore_value: no
initial_value: '0'
mqtt:
broker: 192.168.1.88
username: !secret mqttuser
password: !secret mqttpassword
on_message:
- topic: babybuttonpanel/ota_mode
payload: 'ON'
then:
- deep_sleep.prevent: deep_sleep_1
- topic: babybuttonpanel/sleep_mode
payload: 'ON'
then:
- deep_sleep.enter: deep_sleep_1
Binary file added inside.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added top.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
201 changes: 201 additions & 0 deletions usb-powered-automations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
alias: Babybuddy Panel
description: ""
trigger:
- platform: event
event_type: esphome.babybuddy_panel_sleepstop
id: sleepstop
- platform: event
event_type: esphome.babybuddy_panel_tummytimestart
id: tummytimestart
- platform: event
event_type: esphome.babybuddy_panel_tummytimestop
id: tummytimestop
- platform: event
event_type: esphome.babybuddy_panel_feedingstop
id: feedingstop
- platform: event
event_type: esphome.babybuddy_panel_sleepstart
id: sleepstart
- platform: event
event_type: esphome.babybuddy_panel_diaperwet
id: diaperwet
- platform: event
event_type: esphome.babybuddy_panel_diapersolid
id: diapersolid
- platform: event
event_type: esphome.babybuddy_panel_feedingstart
id: feedingstart
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: sleepstart
sequence:
- service: babybuddy.start_timer
data:
name: Sleep Timer
target:
entity_id: switch.[yourbabies_timer]
- conditions:
- condition: trigger
id: sleepstop
sequence:
- service: babybuddy.add_sleep
data:
timer: true
notes: From panel
target:
entity_id: switch.[yourbabies_timer]
- conditions:
- condition: trigger
id: feedingstart
sequence:
- service: babybuddy.start_timer
data:
name: Feeding Timer
target:
entity_id: switch.[yourbabies_timer]
- conditions:
- condition: trigger
id: feedingstop
sequence:
- choose:
- conditions:
- condition: template
value_template: "{{trigger.event.data.title == 'single_click'}}"
sequence:
- service: babybuddy.add_feeding
data:
timer: true
type: Breast milk
method: Left breast
notes: From panel
target:
entity_id: switch.[yourbabies_timer]
- conditions:
- condition: template
value_template: "{{trigger.event.data.title == 'dbl_click'}}"
sequence:
- service: babybuddy.add_feeding
data:
timer: true
type: Breast milk
method: Right breast
notes: From panel
target:
entity_id: switch.[yourbabies_timer]
- conditions:
- condition: template
value_template: "{{trigger.event.data.title == 'triple_click'}}"
sequence:
- service: babybuddy.add_feeding
data:
timer: true
type: Breast milk
method: Both breasts
notes: From panel
target:
entity_id: switch.[yourbabies_timer]
- conditions:
- condition: trigger
id: tummytimestart
sequence:
- service: babybuddy.start_timer
data:
name: Tummy Time Timer
target:
entity_id: switch.[yourbabies_timer]
- conditions:
- condition: trigger
id: tummytimestop
sequence:
- service: babybuddy.add_tummy_time
data:
timer: true
target:
entity_id: switch.[yourbabies_timer]
- conditions:
- condition: and
conditions:
- condition: trigger
id: diaperwet
- condition: template
value_template: "{{trigger.event.data.title == 'single_click'}}"
sequence:
- service: babybuddy.add_diaper_change
data:
type: Wet
amount: 5
notes: From panel
target:
entity_id: sensor.[your baby]
device_id: [device_id for your baby]
- conditions:
- condition: and
conditions:
- condition: trigger
id: diaperwet
- condition: template
value_template: "{{trigger.event.data.title == 'long_click'}}"
sequence:
- service: babybuddy.add_diaper_change
data:
type: Wet
amount: 10
notes: From panel
target:
entity_id: sensor.[your baby]
device_id: [device_id for your baby]
- conditions:
- condition: and
conditions:
- condition: trigger
id: diapersolid
- condition: template
value_template: "{{trigger.event.data.title == 'single_click'}}"
sequence:
- service: babybuddy.add_diaper_change
data:
type: Solid
amount: 5
notes: From panel
target:
entity_id: sensor.[your baby]
device_id: [device_id for your baby]
- conditions:
- condition: and
conditions:
- condition: trigger
id: diapersolid
- condition: template
value_template: "{{trigger.event.data.title == 'long_click'}}"
sequence:
- service: babybuddy.add_diaper_change
data:
type: Solid
amount: 10
notes: From panel
target:
entity_id: sensor.[your baby]
device_id: [device_id for your baby]
- conditions:
- condition: and
conditions:
- condition: or
conditions:
- condition: trigger
id: diaperwet
- condition: trigger
id: diapersolid
- condition: template
value_template: "{{trigger.event.data.title == 'dbl_click'}}"
sequence:
- service: babybuddy.add_diaper_change
data:
type: Wet and Solid
amount: 10
notes: From panel
target:
entity_id: sensor.[your baby]
mode: single
Loading

0 comments on commit 5755dd9

Please sign in to comment.