woensdag, december 13, 2017

A 'smarter' and safer home

This post is partly in Dutch, partly in English (i will translate more to English over time). It was started in Dutch and evolved over time.

In this post over time I will collect info (for myself, but feel free to read along ;-)) regarding a 'smarter' home (smart home). Think of lights that turn on/off by motion or because the sun is setting (adjusting the on/off time automatically) or that turn on to give cameras a better view during alarm etc.


MOST IMPORTANT THINGS TO KEEP IN MIND

  • Great, things with an app, but: how long will the vendor continue to support that app? Handy if there is a way to keep using things without an app!
  • Nice, 10 smart things and 4 apps from 4 brands, like motion sensors, smart plugs, smart lights, contact sensors etc, but believe me, eventually you want to link those sensorts in some way. So pay attention to that: what platforms does it work with? I myself am a fan of Home Assistant, with which you can make a lot of smart things works together. See below!
  • Nice, things that work over the Internet and you can control when not at home, but what if your Internet connection no longer works or the supplier suddenly starts charging monthly subscriptions or stops their cloud service. So it should also work without the Internet, and "locally" with something like Home Assistant.
  • Where will my data be? I'm pretty pragmatic about this myself, but the question is always whether all these smart things are properly secured, get updates, and your data is handled properly. Roughly speaking, if something is supplied by a well-known supplier and is/is sold a lot, it is more likely that these points are well taken care of, but it is a) no guarantee and b) sometimes just some 'small suppliers' are better at this. If your smart devices work locally without a vendor cloud service, your data is in your control! 
  • Is my house still operable by my spouse, children, guests etc. Nice, those smart lights, but for many situations the "old" switch just has to work too.
  • Expensive is not always better (I personally think a cheap Wyze camera has a great price quality balance), but sometimes cheap is expensive. An example: the popular (because, among other things, cheap) Klik-Aan-Klik-Uit (KAKU) system is based on 433Mhz radio technology; nice, but not very secure, and as neighbors you can easily control each other's systems. Want that?
VOICE-CONTROLLED SMART ASSISTANTS
Amazon Echo and Google Home are currently the most popular "smart voice-controlled assistants" (sometimes integrated in TV's, speakers from other brands like Sonos etc) that you can use to control many smart devices. You can find a nice item about those 2 here. What Google can control can be found here, what Amazon Alexa can control can be found here and here.

So what do you do with such assistants? Control your lights (or other devices) by voice. Play music (determine which music by voice, of course ;-)). Commonly used in many smart households: you're cooking dinner and want an alarm clock that goes off after 10 minutes: you just ask for it. Apart from that you can ask these assistants anything. Not only trivia, but also the time, the weather forecast or the latest news. Asking your assistant to remind you of something on a certain date/time. Or telling you where you put your keys (or whatever) and remembering that: then when you ask "where are my keys" later, you will be told where. Also: if you notice you don't have something in the house ask your assistant to add it to your grocery list so that you have your grocery list in order by the end of the week.

SMART LIGHTS
A nice start of a smart home is a set of "smart" bulbs. An overview article on smart bulbs such as the Tradfri and Hue can be found at iCulture. Now there are many types of "smart" lights and they work with various technologies: wifi, bluetooth low energy, zigbee etc. This article Briefly describes that with advantages and disadvantages. And according to this article (and this one in Dutch) Wifi lights are nice, but they do use more energy and you're more likely to have interference. Sadly, it's not like if you buy stuff with all the same technology, it will work together. See e.g. this Z-wave compatibility chart.

LIGHT CONTROL SWITCHES
Various vendors offer smart switches. Here a nice comparative article. With apps you can sometimes get even more out of those switches, e.g. with these: then you can turn 1 group on/off by e.g. pressing a button briefly, and another group by pressing longer.

INSPIRATION
I liked this clip from the founder of Tweakers as inspiration:

.

Like the video: maybe you also want to read his blog.

CENTRAL CONTROL
Many vendors naturally want to be the heart of your system. Before you know it, you are then at the mercy of that vendor. Fortunately, there are solutions that make you less dependent. Some popular systems that can form the heart of your smart home are and can run on a Raspberry Pi :
  • Home Assistant: this system runs locally in your home, so can work without a cloud, and is therefore privacy-friendly. And key developers are Dutch, too.
  • Another nice one to check out is Mozilla WebThings Gateway. You can find install instructions here, or when you want to add it to an existing configuration manual steps here (in this case, you might want to add booting WebThings to your Pi boot sequence by adding "npm start &" via "sudo nano /etc/rc.local".
  • OpenHAB 
  • Hubitat: paid, but according to this video a lot more automated, so saving you time 
  • Domoticz 
People who prefer to buy something rather than assemble something themselves will find the Athom Homey a nice system, especially since it contains transmitters for all current systems and so there is a good chance that you can control stuff from many vendors with it and, where possible, have it work together.

WHAT IS RUNNING IN OUR HOUSE
For your idea, which I have or had myself as working (it wants to change over time ... and of course I do not tell every detail so as not to make burglars etc wiser than necessary ;-):
  • Hue lights (with a Hue Hub), some colors, some ambiance (warm) white. So these are also dimmable, with a dimmer, but also voice-controlled, with the Hue app or via Home Assistant (see below). I also made sure that lights in the living room come on automatically as soon as it gets dark (the Hue motion sensors, see below, also measure brightness). So I don't have to adjust timers all year or anything with summer/winter time, earlier/later darkening etc.
  • Hue motion sensors (also report temperature and light level)
    • If there is motion on the 1st floor landing in the evening, the light comes on there. If there is movement at night also, but dimmed
    • There are motion sensors active as part of the alarm system
    • In 2 rooms in the attic, I use the motion sensors to measure whether it is still light at night: if someone has left the lights on, I get a notification and can turn them off as soon as I see that notification (the lights themselves are not "smart" ;-)) ... I hardly ever get into the attic, so that can save days or weeks of electricity
  • An Amazon Echo Dot (which, among other things, allows me to switch various things by voice). What I like, among other things, is that the blue ring makes it easy to see remotely that the Echo is listening to you
  • A Sonos with Google Home (which, among other things, allows me to switch various things by voice). The Google Home also understands and speaks Dutch (nice for some Dutchies)
  • Logitech Harmony Elite with HUB, so that (also for others in the house) TV, decoder etc are easier (both with the Harmony Remote and voice operated) to control. And with the Harmony Hub I can also control my Hue lights
  • I use Home Assistant (HA) as the controller to tie everything together and make all brands co-operate, and run HA on a Raspberry Pi 4. HA (and thourgh it, everything :-)) is remotely accessible for control when i'm not at home
  • Osram Lightify Plug's which are, remotely controllable power plugs/strips (via Zigbee, cooperating with Hue, among others) . So you can use those to turn on/off all sorts of "dumb" devices (e.g., a salt lamp and a desk lamp, or your coffee maker).
  • I have a Mijia Aqara Water Sensor (which GearBest sells for instance) which I put in places where water can leak: as soon as that happens, I get a notification. 
    • To use that sensor (and other Xiaomi Mi sensors I have), I have a Xiaomi Mi Smart Home Gateway 2: the nice thing about that gateway, which we need for linking various (inexpensively priced) sensors, is that it also has a light function (e.g. as a night light), and a speaker (for Internet radio, but also as a "doorbell," alarm etc)
      • We sometimes don't hear when people ring the doorbell. What I have done is a 'Xiaomi Mi Smart Home Door / Window Sensor' contact sensor on the bell; as soon as the doorbell rings, the contact sensor is also activated and the Xiaomi Gateway makes a (adjustable) sound.Now we can also hear the bell when we are working in the garden e.g. I could e.g. also make the lights flash, or something else that lets us know that someone is ringing the bell. If this eventually doesn't work well enough I want to link the doorbell on the Raspberry Pi based on this instruction (of deze of deze (zie ook dit))
  • I read energy usage data from our landis gyr e350 energy meter through a cable between the P1 port of the meter and the Raspberry running Home Assistant (if you want to connect more than 1 device to your P1-port, you can try a P1-splitter for example the one from Iungo ).
  • Through the SolarEdge api, I have some info from the SolarEdge solar panels. I also activated ModBus on my SE8K and used this to get even more info into HA
  • i installed HACS, and through HACS the 'GoodWe' integration to read data from our solar panels connected to the GoodWe inverter (which replaced our broken Omniksol-1k-TL-M ). 
  • We also have a Xiaomi Mi Smart Home Occupancy Sensor motion sensor (which also is part of our alarm system ;-))
  • We have a Linksys DCS-932L camera and a 'Aqara Smart Camera Gateway Edition' (the latter you can add to HA via this instruction). In addition, some fixed and movable Wyze camera's (they cost $19.99 resp $29.99).
  • I installed ESPhome on some GoSund energy measuring plugs. I installed ESPhome like so. I used a RPi3b (later also a RPi4) to run Tuya and used this manual apart from the previous link. But
    • i ended up with 4 GoSunds running with hostname 'temp_flash', and my router did not allow for local DNS mapping to another name... so i redid everything, and instead of using 'temp_flash' in ESPhome for the config-name, i used 'gs_energyplug_', where nr was 001, 002, 003, 004... This made for a little extra work, but me ending up with GoSunds having a distinctive host name
    • when i ran "dmesg | grep wlan" and "dmesg | grep eth" i did not get any numbers; on my RPi i never got something different than wlan0 and eth0. I Google-d a lot, in the end i just tried with wlan0 and eth0 and that worked for me
    • i had to use "sudo killall wpa_supplicant" on the RPi before the "vtrust-flash" access-point would show up
    • i also was a bit confused of how i could make the GoSund find the firmware-file. It turned out you have to remember where on the host (in my case the Pi) you created the new firmware. I used linux commands cp to copy the file from within the ESPhomeyaml folder (in my case used cd to get into my /home/pi/tuya-convert/files folder and use "cp /home/pi/config/temp_flash/.pioenvs/temp_flash/firmware.bin" to copy over the files, and used "mv firmware.bin thirdparty.bin" to rename the file, so i could use the "curl http://10.42.42.42/flashURL?url=http://10.42.42.1/files/thirdparty.bin" command)
    • using the command line? An example of how to craft the command to upload via OTA to a device: esphome -v upload --device 192.168.1.25 some.bin 
  • we use smart plugs with energy measuring capability from other brands as well
  • the Sensus620 water meter i have integrated using this solution so i can see when water is used
  • switching on/off the garden watering system (a simple hose with a micro drip system attached) and filling up the pond from within Home Assistant, based on this project (using a Solenoid Valve connected to a Sonoff R3). Sonoffs can be used as wifi controllable on/off switches. Here you will find how to use them in HA ('back in the day' you had to flash them with a 'USB to TTL Converter' and ESPhome, see for example here how ... I have flashed 3 Sonoffs.
    • Note to self: if you need to set up the HA config as new and the ESPhome flashed Sonoffs don't show up, check on the router that the Sonoffs are there and have received an IP address, go to the HA Integrations screen, press the + in the lower left, choose ESPhome, enter the IP address and password you've set, and HA should discover the Sonoff ESPhome).
  • our Daikin Altherma 3 heat pump is connected to HA through a standard integration HA offers. Since July 3rd 2023 we have a Daikin Altherma 3 model EBBH11DF9W (EBBH-D9W) indoor unit (this unit has a 'Smart Grid Ready' contact, also known as an EVU (Energieversorgungsunternehmen)), an ERLA11DAW1 (ERLA11-14DW1) outdoor unit, a 250Liter EKHWS 250 hot water tank, all controlled with a Madoka BRC1HHDAW (BRC1HHDW) thermostat (which as far as i could find does not support advanced options) and a BRP069A78 wlan gateway adapter When my energy contract makes it so, i might look into solutions like the EcoSwitch or other products from the manufacturer to turn on/off the heat pump when energy prices are low.
  • to switch on/off the pump of our small pond (aSuperfish Pond Eco Plus RC 5000) i installed a SONOFF ZBMINI-L2 behind the physical switch, so we can both manually as well as digitally switch on/off the pump (and save some energy since now the pump won't be running 7*24). I used the Schedule option in Home Assistant to easily make a schedule. I could also have opted to use RF to control the Superfish as it works with a 433Mhz based RF remote, where i could have used the solution described here, using a RTL-SDR, with Universal Radio Hacker (URH), or maybe using RFlink .
  • I automatically turn on internet radio on the Sonos One with Google Home (i started this so our little bird has some 'company' in the house. And of course this turns off automatically in the evening.
  • We have a Stork Zehnder heat recovery fan (warmte terugwin, WTW) which i have included in my home automation platform by wiring in a Shelly 2.5PM in the wire running from the WTW to the 220V-outlet (just cut the WTW-wire) and wiring it up like shown here. By checking on duration of water usage (someone is showering) and presence in the shower (motion sensor) (and maybe at some time a rise in humidty) i can switch high or low this fan, taking care of high humidity due to showers.
  • Our EV and Zappi home charger show up in HA (so i can control the EV and home charger)
    WHAT I STILL CONSIDER AUTOMATING
    Some things i consider automating:
    • start measuring my (floor) heating system, so measure feed- and return temperature of my c.v. and floor heating system. This can be done with a ESP8266 and DS18B20 sensors like shown here.
    • start measuring air quality using the Snuffelaar hardware (already bought it but had trouble flashing the ESP, so i still need to find time, sit down and try again)
    • build this wifi controlled led lamp (have the components, but the LEDstrips i had did not fit, have to buy new ones)
    • WTW-filter-schoonmaak-meldingen: ik heb op zolder een WTW (een Stork Air Zehnder WHR 930) die soms op een display toont dat de filters schoongemaakt moeten worden. Leuk, maar ik kom bijna niet op zolder. Handig als ik dat seintje ook op een andere manier krijg.
      • To do anything smart with the WHR, you need to know the inner situation of your WHR. Some info i found online talks about a RJ45 connector as RS232 connection the WHR offers, other information talks about a serial connector. So you need to open your WHR and find the physical form of the RS232 (RS232 is printed on the control board of the WHR). How to do open the WHR is shown in the manual you can find online.
      • Read data from the WHR:
    • a watchdog like the one seen in https://www.youtube.com/watch?v=IGB2eRvhvB0
    • liefst wil ik  dat mijn huidige normale (licht- enzo) schakelaars (Busch-Yeager) het blijven doen EN de schakeling slim wordt. Bijvoorbeeld door in de inbouwdoos achter de schakelaar een kastje 'tussen' te voegen (bekende zijn Shelly en Sonoff mini which has a jumper for DIy mode). Maar vaak is er net te weinig ruimte omdat in veel dozen te veel draad en lasdoppen zitten, bv omdat het hotelschakelingen zijn, niet overal de normale 3 draden beschikbaar zijn etc.I did buy 2 Sonoff mini's which i integrated with Home Assistant using this HACS integration and guide. You can also flash the mini with another firmware using this guide (or, more elaborate, these steps).
    • een slimme (-re dan onze huidige Ei146) rookmelder ook b.v. je lichten aan laten zetten bij alarm
    • make a garage for our robot vacuum (Roborock S5 Max) like so 
    • make a wireless rain sensor with a zigbee window contact, like this project    
    • (nog) meer info van mijn Solaredge zonnepanelen die zijn gekoppeld via een SolarEdge SE8k zichtbaar maken in HA. Aan de hand van deze aanpak. Installatie-handleiding SolarEdge hier
    • use TeslaMate to visualize Tesla data using Grafana
    • maybe connect our Daikin Altherma to HA using ESPAltherma if that seems to provide more functionality than the standard integration: this post will be helpful.
    • maybe see whether i can get some info about our 100liter Itho Daalderop Monosolar 'zonneboiler.
    TIPS
    • Want to buy 'smart home' stuff, like a smart plug, and also want to be able to at some time integrate it into something like Home Assistant? Than check out this handy list with hardware you can put Tasmota on.
    • Ideeën opdoen? Kijk eens op instructables 
    • Meer ideeën: YouTube!
    • Sonoff heeft via Wifi te schakelen spullen , en op dit blog kun je zien hoe je de $7 Sonoff switches kunt combineren met je eigen home automation systeem
    • Een handig platform is IFTTT, If This Than That 
    • De API's voor de Philips Hue zijn hier gedocumenteerd
    • Als je ook spul op 433Mhz wil gebruiken, kijk dan eens naar de Sonoff RF bridge: voor ca $14 heb je de bridge, voor ca $21 met deur sensor en bewegingsmelder.
    • Een aardig overzicht van populaire onderdelen voor een slimmer huis vind je bij AndroidPolice.
    • Wil je meer weten van de techniek voor smart homes, dan is dit artikel nuttig. Uit 2015, maar de techniek die dit allemaal mogelijk maakt is niet heel erg veranderd.
       
    WHAT I LEARNED WHILE DOING
    • If you try to connect a Logitech Harmony with Alexa and you see "We’re as excited as you are to bring intuitive voice control to your family entertainment center; however we only support", you need to check the following (source: spraak-makend):
      • Check your Amazon account > “Manage Your Content and Devices” > the "Settings" tab and make sure the country is set to US.
      • The Logitech App needs to think it is on a device in a supported region. Change your phone settings for language (set to English) and region (set to US)
      • Check in the Logitech App "account settings" whether country is set to “UNITED STATES”.
    • Hoe je je Google Home met de Harmony verbindt lees je hier
      • You can connect all kinds of Zigbee based stuff without the gateways by using zigbee2mqtt and/or a Zigbee-stick like this Electrollama 
      • I have a couple of Osram Lightify Plug's. At Beaumotica i found some nice info on how to (re)configure that smart plug (PDF here in case at some point in time the info at Beaumotica disappears). 
        • In case you have trouble getting the device to be discoverd:
          • Getting this plug to (re)connect to a Zigbee bridge has cost me lots of times a couple of times. In case you have trouble getting the bridge to find your device while you're pretty sure the plug is in pairing mode (see below), consider whether the distance of the device and bridge is o.k. AND understand some devices interfer, like my Electrolama Zigbee USB stick turned out to work much better with a USB extension cable between the stick and the RPi4 it was plugged into :-|.
          • If your Osram Smart+ plug is not found by your Hue or other brand/type of Zigbee-bridge, sometimes it helps (in case of the Hue bridge) to unplug the Hue bridge and replug
          • Sometimes the below procedure works:
          • (in case you're trying to pair the Osram with the Hue App, make sure you're in the 'discover devices' screen of the Hue app, but don't start discovering yet!)
          • Press and hold the button on the Osram for 10 seconds: you should hear a click > keep holding it and start discovery, wait for the plug to click another time, and release the button on the plug.
          • Alternative: " If the Osram Lightify Plug is not recognized, then you should unplug it for 5 seconds, reconnect it for 5 seconds and repeat this 5 times. Now you can search for lights."
        •  Updating the Osram plugs can be done through the Osram Gateway, or this procedure using a Raspbee Deconz combo.
      • Although setting up a new HA config from scratch, for instance when your SD crashes, is 'educational', you might want to consider making an image of your SD  periodically or use a SDD instead of a SD. When your OS is Linux, you can use this. Put a recurring event in your calendar to make a new image every x months or so. HA nowadays also offers great backup options to recover from a crash
      • When you switch off uPNP on your router, stuff starts having trouble finding other stuff (Amazon Echo couldn't find Hue in my case, for example).
      • Handy Linux commands:
        • When you wonder what your Pi (or whatever you run HA on) is doing: use the Linux 'top' command. Or similar command.
      • We hadden een Osram SMART+ Outdoor Plug waarmee ik een pomp in de tuin aan en uit schakelde op tijd (konden we de pomp niet vergeten aan of uit te zetten en hoefde hij niet de hele dag te draaien). Maar de Osram weigerde vaak dienst/schakelde vaak niet, dus bleef aan, of uit. Die heb ik daarom geretourneerd. 
      • Sometimes you want to know the Kelvin values of the standard Hue white ambiance scenes. I found some info on Reddit:
        • Relax = 2237K
        • Read = 2890K
        • Concentrate = 4291K
        • Energize = 6410K
      WTW 930
      The Stork Zehnder i have included in my home automation platform by wiring in a Shelly 2.5PM in the wire running from the WTW to the 220V-outlet (just cut the WTW-wire) and wiring it up like shown here

      Before doing that i found another solution (which i turned out not to use, but i share the info here for maybe others or later use) a blog by Mosibi, but he removed the blog from the internet. The WayBackMachine had a copy. It said:

      "Control a StorkAir/Zehnder WHR 930 ventilation unit using mqtt
      December 31, 2017, Domotica, mqtt, whr930, wtw, Mosibi
      Our house is equipped with a WHR 930 ventilation system, in Dutch a ‘warmte terugwin systeem (wtw)’ and since we have the ‘basic’ version, we have to control it using switch in the bathroom. There is a RF module available for the WHR 930, but that’s a pretty expensive option and i could not figure out how open it was. Since i want to control it from Home Assistant, it must be open or should have some sort of API.

      Searching the internet for possibilities i learned that the WHR 930 has a serial interface on it’s mainboard and that the protocol is fully reverse engineered! The picture below is one of the mainboard, the red arrow points at the serial interface (RJ45)

      I modified a UTP cable to get the right pin layout for a Serial<>USB converter and attached it to a Raspberry Pi and wrote some python code (file) to interface with the WHR 930 via the serial connection. The code reads the various temperature values and fan status and publishes the results on a mqtt topic. The python code subscribes to a specific mqtt topic (house/2/attic/wtw/set_ventilation_level) for messages (0, 1, 2 or 3) to set the ventilation level. Level 0 stops the ventilation, i did not even know that the WHR 930 could do that 🙂

      For now i am happy, but the serial protocol description shows that there is much more possible. Maybe i will look into that later, but do not hesitate to contact me (see my Github page for contact info) if you found out nice additions!

      For integration with Home Assistant, see the README file (file) on my Github channel."
       
      HOME ASSISTANT TIPS & TRICKS
      Notes on my own HA config:
      • At some time i wanted to add more online radio stations to my Media component. I had trouble finding out how to do that. Although not ideal, my solution was:
        • add the Radio Browser. This is great for accessing lots and lots of radio streams, but lacks a 'mark as favorite' option, a 'recently accessed list' or anything to make for less clicks the next time you're looking for that same station
        • add some buttons so i can choose a favorite station with one click. I did find a page with some info i could use as a foundatio, but for me that code had some bugs (like buttonS now need to be button, datES need to be data etc). So i ended up with adding buttons (i added a horizontal stack card on one of my HA tabs, and added buttons in that card). The code for 1 card:
        • i haven't found an easy way of how to find the id of a radio station.  

      Image source: home depot.

      Geen opmerkingen:

      Een reactie posten