Cameras, Covers, and even Day/Night mode

I recently decided to start with Home Assistant due to some ideas I was having that proved problematic with SmartThings.
My SmartThings setup includes webCoRE programming so there are some relatively complex interactions that I’ve coded over there and I wanted to duplicate them one at a time using Node-Red. (I know I can use native Automations, but I really like the visual approach that Node-Red takes.)
In addition to SmartThings, I was using Action Tiles to have a control-panel approach to non-automated interactions and to show status.
My garage door setup was always hinky. I had a Chamberlain lifter and added on a kludge that used a GoControl automator. SmartThings has a GoControl integration, but the Chamberlain door doesn’t use a straight switch to open and close it. It sends a coded signal so I had to rig the GoControl unit’s relay to the button of a remote that was paired with the door lifter. (I didn’t wire it in directly to the in-garage panel because a remote was a lot less expensive than a new panel.) This worked, but it looked like ceiling wax and baling wire.
Then we come to my Wyze cameras. I was using the RSTP firmware from Wyze and then pulling the results into BlueIris, running on an always-on PC, in order to get images I could pull up in Action Tiles. It works, but every time the PC reboots, it has to load BlueIris again and, because of my Cable-Modem to SmartThings WiFi hubs setup, I also needed to run ngrok to set up a connection that could send those camera streams to the outside world. (It does one little good to be able to look at camera images only when you’re home :slight_smile: ) Even with all this, I still had to use a separate app to see my Ring cameras.
(Those of you still reading this are probably amazed that all this actually worked. So was I. It’s probably a testament to my stubborn streak.)
I decided to leave all the devices that were connected through SmartThings still connected that way, so I’m using the SmartThings integration to work with them in Home Assistant. I may eventually start to switch them over. But it works well enough now. I actually prefer the Lovelace interface to SmartThings and even to Action Tiles.
I opted to pay for Nabu Casa because it works just fine through my Cable-Modem/ST Wifi Hub set up.
I’m currently running the whole thing on a Raspberry PI 3B. My intention is to migrate it to a PI4 booting from an SSD as soon as I can get those parts and spare the time. I’m using a straight HassOS (4.15) installation. I’ve looked at the options to run off a virtual machine on a PC and even running inside of Docker. Maybe later.
So… after burning the image to an SD card and starting up my PI3, I installed a File editor, FTP, Node-RED, and Mosquitto broker (for later). I added in integrations for AccuWeather, the Mobile App, MQTT, ring, and of course SmartThings. Then I added in the myQ integration because, lo and behold, HA actually supports it and it doesn’t require the subscription that IFTTT does. HA recognized the myQ unit and I was good-to-go on door control.
On to the cameras. I could have stuck with the Wyze RTSP firmware, but there was another option: Dafang is the source of the Wyze (and Neos) camera hardware, but they have a custom firmware setup that not only does RTSP, but also has a lot of options superior to Wyze’s firmware. There’s a link below that shows how to install it in your Wyze/Neos cameras. Once flashed over, I was able to easily add the cameras into HA, but I found that the video feed just didn’t work. Fortunately, there’s an option for still images that shows single frames on movement. That works very well for me. Here’s an example of the camera definition:

- platform: generic
  name: LivingRoomCam
  username: "i'm not going to tell you"
  password: "i'm not going to tell you this either"
  authentication: basic
  still_image_url: "https://192.168.40.177/cgi-bin/currentpic.cgi"
# stream_source: "rtsp://192.168.40.177:8554/unicast"
  framerate: 5
  verify_ssl: false
  scan_interval: 5

Adding in the ring cameras (both a ring flood-light cam and a doorbell cam) was automatic upon adding their integration. I was pleased with the results, but I may play with it a bit to take up less space on Lovelace (they have all the controls, including being able to turn the spot-light on and off.)

Custom Dafang firmware for Wyze/Neos Cameras:

That’s it for this post. I’ll come back and do the Overhead garage door and presence sensing next.

2 Likes

One of the nice things that’s included in the Dafang firmware is a suite of sensors that come right into HA. There’s a motion sensor and a light sensor which can be used to trigger automations in HA and even a motion snapshot. I already had a motion sensor in my living room, but now I could repurpose it. The light sensor will also be handy for when I get to automating my blinds. There are also a series of switches that allow you to set camera features without having to go to the camera UI (which, by the way is a simple local IP address call.)
Now, onto the overhead garage door (or cover, as HA refers to it). As I said, my SmartThings “integration” was a kludge of epic proportions. HA has allowed me to fix that. Chamberlain has a WiFi “hub” which connects to your WiFi for control purposes and connects to the door opener in the same way you “pair” a keypad or remote. (No wiring necessary!) It’s made by Chamberlain, but it will also pair with a wide variety of openers of various companies as long as they’re 1993 or later. It comes with a “tilt” sensor that tells it whether the garage is open or closed. The hub includes the safety feature where, when you’re closing the door, it flashes the lights on the drive and beeps for a short time to warn you that it’s about to happen. It will, of course, abort if something crosses the safety sensors.
You use the myQ app to set it up, but unlike some other integrations (IFTTT), it doesn’t require any subscription to work with HA. Within HA, you simply add the myQ integration and put in the username and password you use for your Chamberlain “account.” (It’s called an account, but again, you don’t have to pay for a subscription.) Once you’ve added the myQ integration and set it up, you’ll get two new devices/entities. The gateway entity, which seems to be there to tell you that the gateway is connected, and the garage door entity, which has both the open/closed sensor and the open/close controls.
I added a little code in my configuration.yaml file to change the icon to show the door’s open/closed state:

cover:
  - platform: template
    covers:
      garage:
        device_class: garage
        value_template: "{{ is_state('cover.gocontrol_smart_garage_door_controller', 'open') }}"
        open_cover:
          service: cover.open_cover
          data:
            entity_id: cover.gocontrol_smart_garage_door_controller
        close_cover:
          service: cover.close_cover
          data:
            entity_id: cover.gocontrol_smart_garage_door_controller
        icon_template: >-
          {% if is_state('cover.gocontrol_smart_garage_door_controller', 'open') %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}

I also use the “Color icons based on state?” option in Lovelace to show the open/closed state. I like the fact that the color highlights when states change.
Here’s what it looks like in Lovelace:
garage open
Open
garage closed
Closed

1 Like

The final major thing in my HA setup was combining presence sensing and a “day/night” mode for informing me of certain events. The “people” panel looks like this:
people panel
The first item is a person entity (for me) which is tied to my cell-phone. The second and third entities are my wife and daughter and those are binary_sensors integrated through the SmartThings app and linked to their cell-phones. The Family item is a group entity which combines all three of us. It’s on when any of us are home and off when all of us are not. It simplifies presence-based programming considerably. In SmartThings, I had to write some webCoRE coding to do the same thing. The binary_sensors automatically do the icon change based on state. (So the home icon is filled when they’re home, but outlined when they’re not. I can’t quite figure out how to do that with my person entity because it has multiple states. I can be “home”, “not_home”, “Work”, or “Church” depending on where I am and the zones I’ve set up.
The final element is the “day/night” mode indicator. It’s an input_boolean I created using Configuration->Helpers. It’s of the toggle type. However, I also template it for two reasons: First, I wanted to “cast” it as a binary_sensor for the UI so it wouldn’t show a toggle control and second so it can do the neat change the icon based on state thing. Here’s the configuration.yaml code:

binary_sensor:
  - platform: template
    sensors:
      daytime_sensor:
        value_template: "{{ is_state('input_boolean.day_night', 'on') }}"
        icon_template: >-
          {% if is_state('input_boolean.day_night', 'on') %}
            mdi:weather-sunny
          {% else %}
            mdi:moon-waning-crescent
          {% endif %}

That makes it show up nicely in Lovelace, but I still have to toggle it. That’s done in Node-RED:


The injectors simply trigger at the assigned times and set my input_boolean to true for daytime and false for nighttime. So, how do I use that? Here’s an example of one of my Node-RED flows:
notify me of movement
The first node triggers when my living room motion sensor senses motion. If no one is home (Remember that Family group entity? Here’s where I use that.), then it notifies me right away. Otherwise, it checks to see if we’re in night mode. If we are, it’s assumed we’re all snuggled in our beds and something else is moving in the living room, so it notifies me in time to prepare an appropriate “welcome.”
There’s more to my HA setup that these things (For example, I have a sensor/boolean combination that informs me that my mailbox has been opened so I can go check the mail.), but these are the ones I found most interesting.
In addition to certain items being a lot less of a kludge (the garage door control), the change-over has allowed me to retire a few bits of software that I no longer need and I don’t have to manually re-load bits after my computer re-boots.
All-in-all, I’m fairly pleased with HA. It’s got a bit of a learning curve for certain things. (It took me a while to figure out how to parse input to a call service node and I still haven’t quite figured out MQTT messaging so I can include a camera snapshot with a motion notification.) I’m glad for the wealth of information on this forum and through YouTube videos.

1 Like