Smart Home » Home Assistant
Resources! The best! Awesome Home Assistant Home - Home Assistant Devices
The Beginner’s Guide to Home Assistant - HassIO - YouTube
Home Assistant Basics
Hass & Zigbee: No need for gateway
The perfect project to replace Zigbee gateway and use Raspberry Pi directly as a hub (gateway, bridge) is Koenkk/zigbee2mqtt, as commented a lot at Home Assistant Community
Other similar projects include ConBee/deCONZ are closed source, ZiGate with elric91/homeassistant_zigate is too-French.
Hass & Sonoff: No need for cloud
Sonoff devices can be flashed (Tasamota firmware) so they act on MTQQ protocol.
The new esphomelib should be better and more flexible.
A simple jig for flashing Sonoffs
http://www.instructables.com/id/Sonoff-Garage-Door-Opener/
Koji pin na koji Pinovi na Sonoff Pinovi na Sonoff ponovo Sve zajedno spojeno
Savršen video: TUTORIAL: Install Sonoff-Tasmota Firmware on your Sonoff Device - YouTube
WiFi Switches
onaj jedan radi, pa sam ga kupio: Wifi Wall Switch WITHOUT TOUCH (1,2 or 3 Gang) - Hardware - Home Assistant Community
EWeLink Introduction - ITEAD Wiki Sonoff Dimming LED – eWelink Sonoff switch complete hack without firmware upgrade How to use a Sonoff Switch with Home Assistant | DEW IT & Web Services
Tasker Configuration and Setup - How To Automate Your House - YouTube
Samba shares
Samba connection to edit configuration files. Access via \\hassio
SSH connection
Reboot
There is an option in GUI
but you can also do it in console: hassio host reboot
Sexy Projects
-
Floorplan for Home Assistant:
Visual representation of a home
Broadlink Remote
Hass plugin: Broadlink RM Switch
Connect Your BroadLink Remote – Smart-Home Hobby Teach Your BroadLink Remote – Smart-Home Hobby
2018 Broadlink R1 RM3 with temperature sensor old version - YouTube
Broadlink R1 (or “RM plus” or “RM Pro Plus” or “RM03”) is exactly the same as RM Pro (RM03) but is exclusive for Chinese market and have temperature sensor. It is RM03 as serial begins with RM03. The BroadLink RM Pro also contains a temperature sensor.
Two Android applications: e-Control and ihc (Intelligent Home Center), both on Google Play Market. Broadlink Hub is also interesting app. as is RM Bridge
broadlink rm plus vs pro - Google Search
There is a beautiful app called Home Remote that probably can be made to work with Broadlink.
Zigbee
http://software-dl.ti.com/download/lprf/RFGRYSJVJK4N5_5T2VQEQ4QQUNEQFB3H/flash-programmer-1.12.8.zip TI Flash Programmer
Important Basics
Entity IDs are generated based on the friendly name of the entity. And if the friendly name of two entities are the same, _2 _3 and so on are appended to the name to have unique IDs as before.
Mac Adresses:
Broadlink IR: 34:EA:34:9D:6C:4C Xiaomi Gateway: 7C:49:EB:7F:F4:EA
Kako otkriti key na gateway-u?
Key na gateway samo preko starog MiHome-a.
Kako na net?
nmcli c add type wifi con-name SmartyLAN ifname wlan0 ssid <WIFI_SSID>
nmcli c modify SmartyLAN wifi-sec.key-mgmt wpa-psk wifi-sec.psk <WIFI_PASS>
nmcli c up SmartyLAN
Access Token za vacumm i ostalo?
Ne radi:
apt-get -y install npm
npm install -g miio
miio discover
Radi:
- Stari MiHome (pa radi token za gateway) https://cloud.mail.ru/public/8wZG/jQ5z4sLXH/Old/
- Poveži na windows i extract tokens
lumi.acpartner.v3 - Air Conditioning Controller - 460330fd9ee9ede569febf07d85679d8 - 192.168.0.90
rockrobo.vacuum.v1 - Vacuum - 6f706649665378665248737455463777 - 192.168.0.72
yeelink.light.lamp1 - Desk Lamp - cc847b9810d9f1c146190fb086d30cb1 - 192.168.0.64
yeelink.light.color1 - Lamp - b14e644c4ab9b64fd4115eae6a785420 - 192.168.0.22
zimi.powerstrip.v2 - Power Strip - 316897f6d546fe953e9825c844843405 - 192.168.0.27
zhimi.airpurifier.m1 - Air Purifier - 8a639002e7cc3e4e75224aecac701bb3 - 192.168.0.24
xiaomi.repeater.v2 - Mi WiFi Repeater 2 - 845b55ffbedf84b57b2742e4f6407a1a - 192.168.0.52
yunshi.lock.s2 - Door - 6e9f3489f8917ab56cfbc833 -
lumi.ctrl_neutral1.v1 - Entrance - -
lumi.sensor_magnet.v2 - Staircase Closet Door - -
lumi.sensor_switch.aq2 - SQ button - -
lumi.plug.v1 - Staircase LED - -
lumi.ctrl_ln1.aq1 - Balcony - -
lumi.ctrl_ln1.aq1 - Living room - -
lumi.ctrl_ln1.aq1 - WC - -
lumi.sensor_cube.aqgl01 - Aqara Cube - -
Zigbee ID’s:
zigbee2mqtt/0x00158d0001a4e09a :: Door Sensor / MCCGQ01LM, Xiaomi MiJia door & window contact sensor (EndDevice)
zigbee2mqtt/0x00158d00021347e7 :: Square Button / WXKG11LM, Xiaomi Aqara wireless switch (EndDevice)
zigbee2mqtt/0x00158d000128b178 :: Round Button Up / WXKG01LM, Xiaomi MiJia wireless switch (EndDevice)
zigbee2mqtt/0x00158d0002556987 :: Round Button Down / WXKG01LM, Xiaomi MiJia wireless switch (EndDevice)
zigbee2mqtt/0x00158d000233b83c :: Light WC / QBKG11LM, Xiaomi Aqara single key wired wall switch (Router)
zigbee2mqtt/0x00158d0002235d85 :: Light Balcony / QBKG11LM, Xiaomi Aqara single key wired wall switch (Router)
zigbee2mqtt/0x00158d000233b59f :: Light Living / QBKG11LM, Xiaomi Aqara single key wired wall switch (Router)
zigbee2mqtt/0x00158d000242c218 :: Light Entrance / QBKG04LM, Xiaomi Aqara single key wired wall switch (Router) / No Neutral
zigbee2mqtt/0x00158d00013e5a64 :: Staircase Plug / ZNCZ02LM, Xiaomi Mi power plug ZigBee (Router)
Hass.io in a virtual machine
Need to de-activate “secure Boot” in the VM settings.
Hass.io Custom Components
Home Assistant Community Store (HACS): hacs.xyz / custom-components/hacs Discover custom elements for Home Assistant.
Packages no listed in HACS store can be installed using HACS > Integrations > right upper corner "..." > Custom Repositories
After edit .yaml files, do: Supervisor » Server Controls » Reload Automations
Global variables that are stored between automations - without add-on
Channel Interference
2.4GHz (1: Smarty / 6: Smarty UP / 11: empty) Zigbee (15 / 20 / 25: Conbee)
Zigbee uses either a powerful 2.4 GHz frequency or a low-power 915 MHz frequency. Z-Wave uses a frequency of 908.42 MHz
Example vibration: Help with binary sensor automation - Configuration - Home Assistant Community
Bathroom Light problem:
Lights activated by motion or by switch - Configuration - Home Assistant Community maybe this: https://community.home-assistant.io/t/automation-different-actions-based-on-condition/74349/8 or this: https://www.home-assistant.io/cookbook/turn_on_light_for_10_minutes_when_motion_detected/
pantry - ostava u kuhinji wardrobe - walk-in closet na spratu closet - locker below staircase
entrance - ulaz staircase - stepenice hallway - hodnik na spratu study - koletova soba office - radni deo
Odlična automatizacija: Making ‘dumb’ Dishwashers and Washing Machines Smart: Alerts When the Dishes and Clothes Are Cleaned – Phil Hawthorne
Xiaomi - koji Zigbee uređaji mogu da se updateuju Aqara/Xiaomi - which devices can be updated? - Devices - Homey Community Forum Updating Aqara device firmware - Hardware - Home Assistant Community
Devices NOT Meshing! Network lost issues · dresden-elektronik/deconz-rest-plugin Wiki · GitHub Mesh not forming. Conbee One, 2.05.77, 26350500, pi3 · Issue #2866 · dresden-elektronik/deconz-rest-plugin · GitHub
BEST INFO ON Xiaomi DEVICES: Zigbee Device Compatibility Repository Zigbee Compatibility
Conditions can also be part of an action: Automation Actions
Najbolji izvor informacija za miio discovery! skysilver-lab/php-miio: Реализация взаимодействия с устройствами из экосистемы xiaomi по протоколу miIO Ima objašnjeno za Packet Sniffer i slično! https://kb.mjdm.ru/xiaomimiio-tokens/
staro: com.xiaomi-miio/obtain_token.md at master · Maxmudjon/com.xiaomi-miio
THERE IS NO WAY TO RETRIEVE TOKEN FROM DEVICES AS ALL NEW FIRMWARES ARE CHANGING THEIR TOKEN ON WIFI CONNECT. FUCK YOU XIAOMI!
{% set device = ’lounge_dehumidifier’ %} {% if states.switch[device] is defined %} {# it’s safe to access the last_changed attribute #} {{ states.switch[device].last_changed }} {% endif %}
Jinja Templating: https://jinja.palletsprojects.com/
sensor:
- platform: template sensors: toilet_is_occupied: friendly_name: “Toilet is occupied” value_template: >- {% if is_state(‘switch.kettle’, ‘off’) %} off {% elif state_attr(‘switch.kettle’, ‘kwh’)|float < 1000 %} standby {% elif is_state(‘switch.kettle’, ‘on’) %} on {% else %} failed {% endif %}
Retrieve API key:
curl http://core-deconz:40850/api/ -X POST -d ‘{“devicetype”: “My API Application”}’ | jq ‘.’
Result: {“success”:{“username”:“09B9D88188”}} where username value is API key
Host: core-deconz
API Port: 40850
WebSocket Port: 8081
My API key: 09B9D88188
curl http://core-deconz:40850/api/09B9D88188/config -X GET | jq .
- condition: template
value_template: >
{% if is_state('binary_sensor.toilet_motion', 'on') and is_state('binary_sensor.toilet_door', 'off') %}
input_boolean.turn_on
{% else %}
input_boolean.turn_off
{% endif %}
constant movement check, with door closed
- id: toilet_pooling_occupation
alias: “Toilet: Pooling occupation”
initial_state: false
trigger:
platform: time_pattern
seconds: “/3”
action:
- service_template: > {% if is_state(‘binary_sensor.toilet_motion’, ‘on’) and is_state(‘binary_sensor.toilet_door’, ‘off’) %} input_boolean.turn_on {% else %} input_boolean.turn_off {% endif %} entity_id: input_boolean.toilet_occupied
- service: system_log.write data_template: level: debug logger: homeassistant.components.my message: “… checked. toilet_occupied = {{ states(‘input_boolean.toilet_occupied’) }}”
cleanup
- id: toilet_cleanup
alias: “Toilet: Cleanup”
trigger:
platform: state
entity_id: binary_sensor.toilet_motion
to: ‘off’
for:
minutes: 120
action:
- service: input_boolean.turn_off entity_id: input_boolean.toilet_occupied
- service: automation.turn_off entity_id: automation.toilet_pooling_occupation
- service: system_log.write data_template: level: debug logger: homeassistant.components.my message: “Executed toilet_cleanup: toilet_motion state is {{states.binary_sensor.toilet_motion.state|int }}”
- id: toilet_no_movement_timeout
alias: “Toilet: No Movement Timeout”
trigger:
platform: state
entity_id: binary_sensor.toilet_motion
from: ‘on’
to: ‘off’
condition:
condition: state
entity_id: binary_sensor.toilet_occupied
state: “on”
action:
- service: switch.turn_off entity_id: switch.wc
- service: automation.turn_off entity_id: automation.toilet_pooling_occupation
situacija - ako prestane da mrda, a sigurno je neko unutra - nastavi da bude unutra
Xiaomi device tokens change on every reset or reconnect to different cloud account.
Therefore it is best to configure discovered devices using cloud and system will retrieve tokens automatically. If device is not discovered, use the following tool and use token to manualy configure device
Now, in 2022, there is a simple Windows tool to get the tokens: Maxmudjon/Get_MiHome_devices_token - Get.token.exe
It works amazing!
Xiaomi Air Purifiers
Favorite Levels are from 0 to 14 (~ 300 to 1700 RPM) Service “fan.set_preset_mode” is for setting Favorite
Prolong Your SD Card’s Lifespan
An article, Optimize Your Home Assistant Database, explains perfectly how to properly allocate which entity belongs to InfluxDB and which belongs to MariaDB.
Two important integrations to note are recorder
, which stores events, states, and data in the main SQL database, and history
, which displays that data as charts in the UI. Additionally, the logbook
integration displays change events in a list format.
And if you’re interested in exploring your database further, check out article The History Explorer Card Tutorial In Home Assistant.
Debugging Home Assistant
Ready to debug Home Assistant? Start by enabling debug logging on the integration card, then log in to SSH and tail your log file.
Home Assistant Debug
First thing to get an integration debugging is to “Enable Debug Logging” on the triple dots for the integration card as explained here: Troubleshooting your configuration - Home Assistant.
This action will log all related activity to home-assistant.log
, which you can best monitor live by logging in to SSH and typing:
clear; tail -f /config/home-assistant.log -n0
And that’s it.
Optimal way to monitor the log file
First, SSH into Hass.io, then tail your log like this:
ssh 192.168.0.111 -l desetar
# watching on debug log
tail -f /config/home-assistant.log | grep 'homeassistant.components.my'
# to glance core or supervisor logs
ha core logs
ha supervisor logs
Debugging the operating system on which is HA running
That’s very different process and login, explained here: Debugging the Home Assistant Operating System.
ssh root@hassio.local -p 22222 -i ~/.ssh/cvladan
Then type
login
# supervisor log
journalctl -f -u hassos-supervisor.service
# hass log
docker logs -f homeassistant
Home Assistant Windows Agent
LAB02-Research/HASS.Agent is the perfect Windows-based desktop addition to Home Assistant.
There’s a ton of cool stuff you can do with it. For instance, all the sensors of your computer hardware and state are available in HA. You can define quick actions that you can trigger with a hotkey, right from HA. And, it’s even possible to run commands on your computer that are triggered from HA under certain conditions in automation, and more.
If we’re talking about cool sensors, you can even turn on your computer remotely with Wake-On-LAN from HA.
Your computer can receive notifications from HA and act as a media player, but you’ll need to install the LAB02-Research/HASS.Agent-Integration integration in HA to enable those notifications and media player capabilities. It’s super easy to install via HACS with just one mouse click from here.
These notifications aren’t your ordinary ones either. They can be Actionable Notifications, where you ask the user for a choice and then respond based on their answer.
As a media player, it does all the basics, but the Text-to-Speech feature is also quite interesting and is explained in the documentation.
This addition is simply masterful, both in its idea and execution.
Ako /var/log naraste nebulozno, iskontroliši ga tako što se uloguješ na host:
# login to host
ssh root@hassio.local -p 22222 -i ~/.ssh/cvladan
# clear logs
journalctl --vacuum-time=1s
# check disk usage now
journalctl --disk-usage
Can’t modify cat /etc/systemd/journald.conf
as it is “Read-only file system”
# this doesn't work as read-only
sed -i -r 's/^.*(SystemMaxUse)\W+(.*)$/\1=10M/gi' /etc/systemd/journald.conf
Takođe, često Docker containers narastu, pa you should try a ha su repair
or ha supervisor repair
as it is a “docker purge”.
Icons for Home Assistant
The Material Design Icons - Icon Library - Pictogrammers is the official home for MDI Icons, offering a perfect search feature and also specifically customized for Home Assistant.
I was directed to this remarkable project from now obsoleted project site mdi.bessarabov.com, which was described in the text about mdi.bessarabov.com.