One year of Home Assistant

It’s good to see I’m not the only one who finds the generic_thermostat pretty useless. I’ve been forcing myself to continue using it thinking that “doing it myself” would be more cumbersome. But, in the end, I’m basically doing it myself anyway.

For me, each room has a desired temperature for when it’s occupied, but I don’t need different away temps for each room. So each room turns on an input boolean when it wants heat (or air conditioning) and then an automation interprets all the input booleans to determine if the heat actually needs to be on or not.

I see that you have sliders/input_numbers to set climate in each room. Do you have a generic_thermostat that gets adjusted with each of these or are you just using the input_numbers and automations?

Automations. The input numbers determine if the heating/cooling device should be turned on. Then the actual thermostat used to control the room temperature is the thermostat in the equipment not HA.

1 Like

Looks awesome Tom! Impressive! Good to see a positive thread on here. Well done.

Couldn’t have done the weather page without your excellent custom components Brendan. Thank you.

1 Like

Heya

Just wondering what you did for snail mail?
It’s possibly here somewhere, but i cant find it.

My approach was to install reed switch inside.my post box, with an arduino triggering via mqtt on open.

Just interested in how you.approached it.

Other options I considered were laser sensors that have their beams broken when post is between them.

Cheers!
D.

My mailbox setup is very similar. It’s a NodeMCU-32S running ESPhome that has two reed switches. One for the letter slot lid and one for the letter retrieval door. It spends the majority of the time asleep. It wakes up for a couple of minutes every 12 hours to send wifi and battery state, or when either of the reed switches change state.

If 14 hours go by without getting a status update I get a lost connection alert from HA.

A signal from the slot = mailbox full, signal from the door = mailbox empty.

It’s powered by a single 18650 Li cell, 4.2V regulator and 6V 3.5W solar panel. So far (summer) the battery voltage has not deviated from 4.16V, day or night. I over engineered it a bit but the real test will be winter. Being this far south the day length gets very short, overcast and the panel is facing the wrong way for this hemisphere. We shall see in another 4 months or so how good my estimates and fudge factors were.

I’ve used this exact same circuit with one limit switch to monitor a boundary gate.

I tried a few (much) cheaper ebay solar panels but found they all lie about their power output. The worst one was a supposed 5V 5W panel that put out 250mW. So yeah, if anyone else is going to build something like this ‘caveat emptor’ when dealing with Chinese solar panels on ebay. Spend your money at a reputable supplier.

4 Likes

I’m glad you are having so much fun with HA. It’s been a year, so I think you are ready. I have two words for you “Node RED”. Good luck.

I’ve been able to do everything I wanted with yaml and jinja. Why would I add the extra layer?

3 Likes

Thanks for the inspiration. Always wanted my harmony devices all on one page

2 Likes

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:

https://github.com/jimz011/HA

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).

1 Like

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.

1 Like

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.

3 Likes

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