I’ve been able to do everything I wanted with yaml and jinja. Why would I add the extra layer?
would love more info on this, I need a way to know if i have snail mail other than checking manually every few days…
What do you want to know?
would you share the code? did you just use arduino for it?
I have wanted to implement the same thing, but I have been reluctant to try because I didnt want to figure out how to run power to it.
I cant add a solar panel to mine but even a few months of battery would be good for me…
Very nice indeed, I like this in particular because it uses the states ui (old ui) which I desperately need because of my older ipads not supporting custom lovelace cards.
I will follow this thread and watch for the code (as I might use a bit in my own setup).
I got as far as this after 6 months of Home Assistant and always looking for new ideas:
I did it with ESPhome and a nodemcu-32s board.
Some notes:
- All resistors 100K
- All Diodes 1N4148 * not needed, see below
- Look for magnetic reed switches with both NO (normally open) and NC (normally closed) contacts. Connect to the NC contacts. So the switch is open when the magnet is close. This will reduce the sleep current.
- The header pins for the ESP board do not bring pins GPIO14 or GPIO32 to the Veroboard. If you do this they will short out.
- There is a two pin header on the edge of the board you can short out to keep the board awake for testing / OTA updates. Alternatively just short either the door or lid sensors wires (i.e. open the lid or door).
- ESPhome now supports multiple wake pins for the ESP32 so you don’t have to do it this way and it can be considerably simplified. No need for the diodes or R17 or configuration for GPIO12. Just set the wakeup pin to GPIO25 and GPIO26.
- A good quality 2200mAh 4.2V 18650 Li cell should run this for months. Get one with a built in battery protection circuit to prevent over discharging and damaging your battery.
Configuration for ESPhome:
esphomeyaml:
name: mailbox
platform: ESP32
board: nodemcu-32s
wifi:
ssid: 'YOUR_SSID'
password: !secret wifi_pwd
manual_ip:
static_ip: 10.1.1.77
gateway: 10.1.1.1
subnet: 255.255.255.0
mqtt:
broker: 10.1.1.100
username: !secret mqtt_usr
password: !secret mqtt_pwd
logger:
level: WARN
ota:
password: !secret esp_pwd
deep_sleep:
run_duration: 2min
sleep_duration: 720min
wakeup_pin_mode: KEEP_AWAKE
wakeup_pin: GPIO12 # change to GPIO25 and GPIO26
sensor:
- platform: wifi_signal
name: "Mailbox WiFi Signal"
update_interval: 4s
filters:
- sliding_window_moving_average:
window_size: 15
send_every: 15
- platform: adc
pin: GPIO36
name: "Mailbox Battery"
attenuation: 6db
unit_of_measurement: "V"
update_interval: 4s
filters:
- multiply: 1.89
- sliding_window_moving_average:
window_size: 15
send_every: 15
binary_sensor:
- platform: status
name: "Mailbox Status"
- platform: gpio
pin:
number: GPIO25
name: "Mailbox Lid"
device_class: door
filters:
- delayed_on: 100ms
- delayed_off: 10s
- platform: gpio
pin:
number: GPIO26
name: "Mailbox Door"
device_class: door
filters:
- delayed_on: 100ms
- delayed_off: 10s
- platform: gpio # no longer needed ESPhome supports multiple wake pins
pin:
number: 12
mode: INPUT_PULLDOWN
name: "Mailbox Wake Pin"
Configuration for home assistant sensors is automatic due to discovery.
Home Assistant Configuration:
#################################################################
## Mailbox Full Sensor
#################################################################
- platform: mqtt
state_topic: "home-assistant/variable/mailbox"
name: "mailbox"
payload_on: 'ON'
payload_off: 'OFF'
qos: 0
#################################################################
## Mailbox Automations
#################################################################
- id: mail_arrived_alert
alias: 'Mail Arrived Alert'
trigger:
platform: state
entity_id: binary_sensor.mailbox
to: 'on'
action:
- service: notify.all_ios_devices
data:
message: Snail-mail has arrived.
data:
push:
sound: "MailArrived.wav"
- id: mailbox_full
alias: 'Mailbox Full'
hide_entity: true
initial_state: true
trigger:
platform: state
entity_id: binary_sensor.mailbox_lid
to: 'on'
action:
service: mqtt.publish
data_template:
payload: "ON"
topic: 'home-assistant/variable/mailbox'
retain: true
- id: mailbox_clear
alias: 'Mailbox Clear'
hide_entity: true
initial_state: true
trigger:
platform: state
entity_id: binary_sensor.mailbox_door
to: 'on'
action:
service: mqtt.publish
data_template:
payload: "OFF"
topic: 'home-assistant/variable/mailbox'
retain: true
- id: mailbox_connection_monitor
alias: 'Mailbox Connection Monitor'
trigger:
platform: state
entity_id: binary_sensor.mailbox_status
to: 'off'
for:
hours: 14
action:
- service: notify.ios_iphonex
data:
message: Communication lost to mailbox sensor.
data:
push:
sound: "Attention.wav"
- id: mailbox_battery_monitor
alias: 'Mailbox Battery Monitor'
trigger:
platform: numeric_state
entity_id: sensor.mailbox_battery
below: 3.3 # any lower than this and the ESP may reset
action:
- service: notify.ios_iphonex
data_template:
message: Mailbox battery low volatage {{ states('sensor.mailbox_battery') }}.
data:
push:
sound: "Attention.wav"
I just added the battery monitor. Not sure if it will alart me when the sensor becomes unavailable. It spends 99% of it’s time in this ‘unavailable’ state (only waking up to report twice a day or if the reed switches activate).
I finally found the limits of my Pi 3b. I was prettying up the admin stats as shown below but this has resulted in regular periods of 5 or so seconds when the front end becomes unresponsive.
I’m guessing the bottleneck is SD card read speed. Which should be rectified by the arrival of my mini PC in the next week or so.
EDIT: Actually the pi was still very responsive to automated actions. A bit further investigation revealed Firefox was using 6GB of RAM. Restarting the browser has returned full responsiveness. The Pi really is amazing.
A quick question about your WiFi Levels gauges. Are any of your devices ever off line (either by design or by accident)? If so how do you handle that in Lovelace to stop big red boxes?
Yes, the mailbox and gate sensors spend 99.9% of their time asleep and thus off-line. I simply dont send LWT (last will and testament) mqtt messages so they never appear as offline.
As well as when they are tripped, they wake up every 12 hours to send battery levels. If I dont hear from them for 14 hours I get an alert.
Thanks for posting your awesome installation. I think the real benefit to Node RED is speed of implementing and testing new ideas. I’ve waited a long time for something as cool as Node RED. (the first program I ever wrote was in FORTRAN on punchcards).
Complete interface redesign: https://imgur.com/a/OAxIGFb
Works well from 1900x1200 to mobile displays.
The only issue I have is trying to style monster cards. Just can’t seem to get them to take a border with card-mod.
I’m getting this error in my logs for all the buttons I set up for my remotes. Everything still works but every time I press a button it triggers the following log entry. Any idea what is going on?
Not passing an entity ID to a service to target all entities is deprecated. Update your call to remote.send_command to be instead: entity_id: all
Your scripts to send the remote commands aren’t correctly specifying an entity id. Start a topic. Post a script config that you use to send a remote command.
posted here…thanks
Hi @tom_l
Awesome configuration by any chance do you have a github repo with the configuration?
I would be interested in following and look at some configurations.
Thanks in advance.
No I don’t sorry. Also nothing in that old configuration has remained in my current one. Some examples of how it looks now:
Your setup looks really nice, theme and graphs… also seems a really complete setup.
I have tons of questions
Until now my focus was mostly having the devices on HA, I still have a bunch to install and configure, but I am also looking to beautify some stuff andyour setups seems really neat.
Congrats.
Unfortunately it is a precarious “house of cards” (pun intended) at the moment. I use the custom tiles-card extensively and support for this card has been abandoned. Coupled with recent changes to the way home assistant handles custom cards this means I will probably have to re-write the whole front-end, again.
How do you create that big time/date card?