Home automation

Node-RED:

MQTT:

Zigbee vs Z-wave vs WiFi:

WiFi vs Zigbee channels

Domoticz:

Zigbee

Hubs

Проект SprutHub


Homebridge emulates the iOS HomeKit API to expose e.g. Zigbee devices to HomeKit.


Xiaomi Mijia gateway – $26.33 (€23.30)


Xiaomi Aqara Hub – $37.44 (€32.60)

:YES:


Coordinator sticks:

CC2531 USB sniffer – $8.25 (€7.25) Zigbee V2 (СС2530 + CH340G) Zigbee V3 (CC2538 + CC2592) CC2538+CC2592 Zigbee module – $9 (€8.25) CC2538 Dongle, CC2538SF53, USB – $33.99 (€31.38) ZigBee Dongle CC2538 – $39.60 (€33.83) CC2538+CC2592 zigbeebox CC2538+CC2592 development board – $39.99 (€36.92) CC2538+CC2592 Egony mod with USB-UART adapter CC2652P / Ebyte E72-2G4M20S1E Stick CC2652R Stick – €25.30 + €13.49 ZigStar LAN Gateway (Zigbee LAN Coordinator based on CC2652P) – €30 (only shield) / €42 (shield + case)

:YES:

:NO:

Advantages / disadvantages of CC2531-based solutions:

J-Link to CC2538 connection scheme

Installation:

Other:

Flashing via UART:


file.php_id_15379_.jpg

Similar projects are:


Conbee – €39.95

:YES:

:NO:


ZiGate – €49

:YES:

:NO:


Philips Hue Bridge 2.0 – €49.95

:YES:


Samsung SmartThings Hub – €95.43

:YES:


Zipabox – €184.95 480cba03e26439b7caa3639a354ac915.jpg


Homey – €299

:YES:

Devices

Bilisty Zigbee smart devices Single, double, momentary and 3-way switch for Shelly dimmer with and without neutral wire SONOFF ZBMINI Zigbee 3.0 – €8.58 ($9.90)

Switches

Livolo switches:

:WARN: Zigbee switches cannot work in 2-way mode with non-Zigbee (RF or WiFi) switches, see 10. Can I synchronize a 2 ways Zigbee switch and a none Zigbee 2 ways switch?. Это положение не подтверждается: функциональность Livolo 2-way никак не связана со способами удалённого управления: Zigbee 1-gang 2-way выключатель VL-C701SZ работает отлично в связке с обычным 1-gang 2-way выключатель VL-C701S.

:WARN: Zigbee version works on 26 channel and with specific manufacture-locked extended pan ID, see Switch 1 or 2 Gang by Livolo.

:WARN: Livolo switches without group wire do not act as Zigbee routers (amperage is not enough to support that feature).

:WARN: After power is back (after power shut down or changing the lamp/load), the coordinator should be in “permit join” mode because Livolo devices re-announce themselves (and get a new short network address). Otherwise they don't return back to network.

:WARN: Livolo devices are flooding the network with requests (see this comment) which probably only Livolo switches may answer.

:INFO: RF switches use 433.92MHz frequency which allows it to be controlled using Arduino, see Controlling a Livolo RF Light Switch Using a Raspberry Pi 3 B in Python and ontrol Livolo switches / Livolo switch library. There is now way to update/get the current status, so communication is one-way.

:INFO: Еще раз про Livolo + схема + ремонт + допилинг – решение проблемы, когда выключатель реагирует на касания переключением светодиода, но реле не щёлкает

:INFO: Home Assistant configuration to fix Zigbee2mqtt issue with Livolo switch

Price comparison for 1 gang 2 way switch:

Site Product Price
Livolo EU – Zigbee Schakelaars VL-C701SZ €44.95
Livolo NL VL-C701SZ + VL-C7-C1-12 €49.95
Alibaba VL-C701SZ-11 $35.97 (3-9 pcs)
Aliexpress C701Z-C1EUZ-11 €28.23 ($30.89)

ESP32 based:

DIY:

Power sockets

FAQ

Control devices (switches) and bulb status update

3rd party switches can usually be added, like the ones made by Lutron, Busch Jaeger or Dresden Elektronik, but they are not exposed to apps as such, and hence can’t be configured by apps. They usually only communicate on Zigbee level (the wireless protocol the Hue lights use) and transmit their commands directly to the bulbs instead of using the gateway.

Motion sensor: IKEA Trådfri or others?

The IKEA motion sensor talks to the bulb, Home Assistant can’t receive any signals from it directly. This means that you can’t create automations in HA based on the motion sensor alone. What you CAN do is make automations based on status of the bulb so that when the sensor triggers the bulb the bulb will in turn trigger something in HA. The efficiency of this is dependent on how fast HA gets the status of the bulb, so your mileage will vary, but depending on what kind of automation you’re looking for it could be worth a shot.

From zigbee2mqtt issue#247 and zigbee2mqtt issue#102:

You could control your Ikea bulb (or outlet) either with zigbee2mqtt only or with the remote only. Now you can use both in the same time, that's already a very good news.

What does interviewCompleted: false means?

The entry like below in data/database.db
{"id":4,"ieeeAddr":"0xccccccfffed5138a","nwkAddr":38336,"epList":[],"endpoints":{},"interviewCompleted":false,"meta":{}}

means that there was a problem when pairing with the device. To cure that do the steps from issue #2148:

  • systemctl stop zigbee2mqtt.service
  • Edit data/database.db and set interviewCompleted: true and meta: {"configured": 0}
  • :OPT: Wake up the control device by clicking buttons on it
  • systemctl start zigbee2mqtt.service

“offline” problem on Zigbee map

Sniffing Zigbee traffic

  • apt-get install wireshark-gtk wireshark && ln -s /usr/bin/wireshark-gtk /usr/local/bin/wireshark (fix for wireshark command via alternatives)
  • # apt-get install libstdc++-dev libusb-1.0-0-dev
    # wget -nv -O - https://github.com/homewsn/whsniff/archive/v1.3.tar.gz | tar -xz
    # cd whsniff-1.3
    # make all install
  • :OPT: Assign a special group for CC2531 stick device so that it can be read by whsniff:
    # cat <<'EOF' > /etc/udev/rules.d/95-CC2531.rules
    ACTION=="add", SUBSYSTEMS=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="16ae", MODE="660", GROUP="wireshark"
    EOF
    # udevadm control --reload

    :OPT: Otherwise it should be run by root:

    # cat <<EOF > /etc/sudoers.d/whsniff
    $USER  ALL = NOPASSWD: /usr/local/bin/whsniff *
    EOF
  • :OPT: Grant access to USB stick to some user
    usermod -a -G wireshark $USER

    :OPT: or open a new root session with

    su - wireshark
  • Run
    whsniff -c 11 | wireshark -k -i -

    where 11 is obligatory parameter that specifies ZigBee channel ID

More info:

Device tracking options

ZLL and Zigbee compliance

From Zigbee Light Link (ZLL) vs Zigbee 3.0:

Chipsets can be the same but the issue with ZLL is that it can still be different from one manufacturer to another, there is no definite standard. Zigbee HA1.2 is better and Zigbee 3.0 will be best and fully compliant across all Zigbee protocols.

In 2017 IKEA released firmwares which makes their devices fully ZLL compliant, so that they started to work with e.g. Philips Hue.

Home Assistant

Examples:

Custom cards:

External sensors and controllers:

Managed installation

# apt-get install python3-pip python3-setuptools
# mkdir -m 770 /var/lib/homeassistant
# useradd -d /var/lib/homeassistant -G dialout -r homeassistant
# chown homeassistant.homeassistant /var/lib/homeassistant
# su - homeassistant
$ pip3 install homeassistant --prefix=~/.homeassistant/deps
$ ln -s .homeassistant/deps/bin bin
$ ln -s .homeassistant/deps/lib/python3.7/site-packages packages
# cat <<'EOF' > /etc/systemd/system/homeassistant.service
[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=homeassistant
UMask=0027
Environment=PYTHONPATH=/var/lib/homeassistant/packages
Environment=TMP=/var/tmp
# [optional] scan network to populate ARP table:
#ExecStartPre=/usr/bin/nmap --open -p 23,80 -oG - 10.0.1.0/24
ExecStart=/var/lib/homeassistant/bin/hass
# Don't log output to syslog:
StandardOutput=null
# Enable if Home Assistant crashes:
# Below will restart the service StartLimitBurst times. For that set StartLimitInterval=RestartSec*StartLimitBurst+small_delta
#Restart=on-failure
#RestartSec=20
#StartLimitInterval=80
#StartLimitBurst=3

[Install]
WantedBy=multi-user.target
EOF
# systemctl daemon-reload
# systemctl enable homeassistant

Didn't work

Docker installation

See also:

Extras

Visualization

How to implement datetime filters and grouping for SQL source?

:OPT: First option would be to use the standard function $__timeGroup(dateColumn, '5m'):
...
WHERE $__timeFilter(time_created)
GROUP BY $__timeGroup(time_created, $__interval)
ORDER BY $__timeGroup(time_created, $__interval) ASC

:OPT: Second option would be to introduce a special variable, which will provide more fine-grained control but will require the user to select manually the appropriate scaling where necessary:

  • Create $interval template variable as in this post:
    SELECT 'minute' AS __text, '%Y%m%d%H%i' AS __value
    UNION
    SELECT 'hour' AS __text, '%Y%m%d%H' AS __value
    UNION
    SELECT 'day' AS __text, '%Y%m%d' AS __value
    UNION
    SELECT 'month' AS __text, '%Y%m' AS __value
  • Use the following SQL query template (:INFO: last_updated is indexed):
    SELECT
      MAX(unix_timestamp((last_updated))) AS TIME,
      MAX(volume) AS VALUE,
      'Volume' AS metrics
    FROM states
    WHERE $__timeFilter(last_updated)
    AND ...
    GROUP BY date_format(last_updated, '$interval')
    ORDER BY date_format(last_updated, '$interval') ASC

See also: Visualize Your Data With Grafana, Percona Live 2017 (Daniel Lee)

How do add series to second Y axis?

You can switch any series to the second y axis by clicking on the colored line to left of the series name in the legend below the graph. Alternately, use the “Display Styles” → “Series Specific overrides” to define an alias or regex + “Y-axis: 2” to move metrics to the right Axis.

Z-Wave

Yale YRD120-ZW-US