Вітаю. Як і обіцяв, сьогодні огляд реле Sonoff BASIC ZBR3. Ось цей девайс.
Отже, у мене в руках Zigbee версія реле Sonoff BASIC. Для того, щоб пристрій почав працювати з хабом Samsung Smartthings достатньо увімкнути пристрій а хаб перевести в режим пошуку, приблизно за півхвилини буде знайдено новий датчик. Вам потрібно лише додати його в потрібну кімнату і, за потреби, налаштувати сценарії автоматизації з його участю.
Зверніть увагу, для реле Zigbee версії не потрібно встановлювати хендлери, чи вводити облікові дані eWelink, як для Wi-Fi версії, це реле працює вже “з коробки”.
Подивимось на його роботу в дії
Для цього під’єднаємо дроти до конактів, з одного боку штекером для розетки, з іншого – дроти, що живлять світлодіодну лампу.
Вмикаємо живлення. На корпусі є два світлодіоди, що інформують про стан девайсу. Як бачимо живлення подається.
Натиснемо кнопку. Лампа засвітилась. Ще раз – погасла.
Тепер відкриємо додаток і зробимо те ж саме в ньому. Все працює чудово.
Висновок
Отже, маємо досить цікавий, якісний девайс, при цьому за досить невеликі гроші. Посилання на реле.
Перед тим як почати проектування розумного будинку, кожен задає собі такі питання:
Які існують стандарти для з’єднання датчиків з керуючими пристроями, чи є різниця в ціні між датчиками різних стандартів, чи сумісні ці стандарти в різних регіонах чи країнах, чи сумісні датчики різних виробників, яка енергоефективність стандартів бездротових з’єднань, чи можна обійтися без керуючого пристрою (хабу) та керувати розумним будинком з телефону, або навіть без нього. ZigBee vs Z-Wave. На ці, та деякі інші питвння сьогодні я спробую відповісти.
Існує три основних бездротових стандарти. Всі ми чули про Wi-Fi, про його технічні характеристики розповідати немає сенсу, про нього сказано вже дуже багато. Загострю вашу увагу на двох інших – це стандарти ZigBee та Z-Wave.
ZigBee
ZigBee – бездротовий стандарт передачі даних, підтримується та розвивається однойменним альянсом. Найбільші виробники чипів та пристроїв це Atmel, Samsung, Texas Instruments, Philips, Silicon Labs та інші. ZigBee технологія розроблялась аби бути простішою та меншою в ціні ніж Bluetooth. ZigBee призначений для пристроїв де необхідна тривала робота від батарей, та необхідна безпека передачі даних між пристроями. ZigBee не може похвалитися швидкістю передачі даних, але для датчиків вона і не потрібна. Проте завдями mesh-технології ZigBee мережа вміє самовідновлюватись, у випадку виходу з ладу чи вимикання одного з пристроїв інормація знайде обхідний маршрут. Коли датчики знаходяться далеко один від одного, і сигнал іноді “не добиває”, достатньо поставити розетку, реле чи лампу між ними, та приєднати до мережі, сигнал пройде через проміжний пристрій до кінцевого.
Для протоколу передбачено декілька профілів, що визначають призначення пристроїв, існують lightlink, home automation, telecom services та інші. Якщо один з пристроїв підтримує певний профіль а інший ні, то взаємодіяти один з одним вони не зможуть, але гаджети призначені для розумного будинку використовують один профіль home automation. Втім навіть збіг з версією стандарту і профілем не гарантує стовідсоткової сумісності. Оскільки виробництвом чипів стандарту ZigBee займається безліч компаній, кожна з них інтерпретує специфікації по своєму, деякі вендори вносять оптимізації в роботу протоколу.
Використовувані частоти залежять від регіону, крім того передбачено частоту 2.4 ГГц, ця частота не має прив’язки до географічного положення. Ця частота має найбільшу пропускну здатність, і, в теорії, вона може досягати 250 килобіт в секунду. Далекобійність в середині приміщення зазвичай становить 10-20 метрів.
Z-Wave
Z-Wave – це бездротова технологія з низьким енергоспоживанням, розроблена спеціально для дистанційного керування. На відміну від Wi-Fi та деяких інших стандартів передачі даних, Z-Wave працює в діапазоні нижче 1 ГГц і оптимізована для передачі простих керуючих команд з малими затримками, наприклад “включити”, “виключити”, “змінити гучність”, “яскравість” і т.д. Вибір такого частотного діапазону обумовлений малою кількістю можливих джерел електромагнітних перешкод, на відміну від діапазону 2.4 ГГц. в якому можливі перешкоди від побутових пристроїв, Wi-Fi і Bluetooth.
Z-Wave Альянс це відкритий консорціюм, який об’єднує понад 700 виробників. Протокол Z-Wave а також патенти на використання є власністю компанії Sigma Designs. Частотний діапазон для кожної країни свій 908.42 Мгц – США, 868.42 Мгц – Європа, 919.82 Мгц – ГонгКонг, У Австралії, Росії та іших країн також свої частоти. Очевидно що датчики Z-Wave що придбані в Сполучених Штатах з європейськими хабами працювати не будуть
І для ZigBee і для Z-Wave для функціонування мережі необхідний координатор (або хаб чи міст, як його називають в деяких екосистемах), зазвичай його під’єднують до локальної мережі, для можливості керування датчиками розумного будинку. Недоліком обох стандартів є якраз необхідність наявності керуючого пристрою, але одного такого пристрою буде достатньо для всього будинку.
Щодо Wi-Fi датчиків.
Маючи вдома бюджетний Wi-Fi роутер зазвичай не буде можливості приєднати більше 20 пристроїв для їх одночасної роботи в мережі, на це зверніть особливу увагу. Необхідно зробити вібір, придбати хаб і користуватися ZigBee чи Z-Wave пристроями, або заощадити кошти але не мати можливості розвивати свій будинок.
Вартість пристроїв.
В цілому вартість датчиків ZigBee, Z-Wave чи Wi-Fi майже однакова, проте існують деякі вийнятки, наприклад Z-Wave датчики і контролери Fibaro досить важко назвати доступним рішенням для українського споживача, можливо там було застосовано певні іноваційні технології, не знаю. Але іформації про іноваційні рішення в цих пристроях я не знайшов. Зазвичай ZigBee лампи дешевші за Wi-Fi, проте Philips Hue дорожчі. Це можна пояснити їх дуже високою якістю та гарною технічною підтримкою.
Давайте підведемо підсумки.
Датчики ZigBee та Z-Wave мають майже однаковий компактний вигляд, також вони є досить бюджетним рішенням для розумного будинку, проте існують деякі вийнятки. А ще для них потрібен керуючий пристрій хаб (кординатор). Купуючи Z-Wave датчик дізнайтесь на якій частоті він буде працювати, можливо він не сумісний з вашим хабом. А якщо ви лише починаєте керувати розумним будинком – придбайте декілька Wi-Fi пристроїв (розеток чи ламп) цього буде достатньо для розуміння чи варто вам рухатися далі.
Once upon a time, there was complete chaos in my Home Assistant configuration files, and it took a while before I put them in order. The configuration.yaml file was oversaturated with code and disorganized. My automations were in one file, and I have over 100 automations. All of my scripts were in a similar situation. Over time, I’ve created dozens of templates for sensors and binary_sensor, all in their “configuration.yaml” files. After getting confused about the configuration and settings, I decided on “general cleaning.”
Preamble
I should note that this article isn’t a discussion of the best ways to organize Home Assistant configuration files. Here are some points to keep in mind. I will focus on the configuration process for Home Assistant and what and how I decided on specific settings. I hope my experience can help you.
The initial state of Home Assistant configuration files
I have been using Home Assistant for almost three years. During this time, I’ve developed and expanded the capabilities of Home Assistant, making it a powerful tool for managing my smart home. Though, I didn’t plan or shorten my configuration files.
All my automations were in one big file (automations.yaml). Also, all my scripts were in one file (scripts.yaml). My configuration.yaml included a lot of sensors, lamps, switches, and more. It became difficult to find and manage files.
I wanted to make each of the configuration items more manageable. I didn’t want to have to scroll and search through long files to make minor edits. I want to make it easier to track errors in my configurations. I need to understand where to add new code.
Settings of the Home Assistant configuration file
Home Assistant has several code-splitting options. Their documentation explains these options in detail.
You can use “include” to move all of the integration to a new separate file(s).
You can use more advanced “include” versions to move full integrations to folders with files.
Examples will help in explaining those options.
The basics of the include setting
Let’s begin with the most simple example:
automation: !include automations.yaml
This line placed in your configuration.yaml file tells Home Assistant that your code is in the file called automations.yaml in the same configuration folder. Similarly, you can split more parts of your configuration.yaml file:
The example above moves the code for automation, switches, and lighting devices to separate files.
Advanced include options
For advanced options, I will copy the explanation from the Home Assistant documentation:
!include_dir_list will return the contents of a directory as a list. The contents of each file will be an entry in the list. The list entries are ordered based on the alphanumeric order of the file names.
!include_dir_named will return the contents of a directory as a dictionary that displays filename => file contents.
!include_dir_merge_list will return the contents of a directory as a list by merging all the files into one list.
!include_dir_merge_named returns the contents of a directory as a dictionary, loading each file and merging them into one dictionary.
Let’s look at an example of each of them:
automation: !include_dir_list automations/
In this case, each automation would be in its YAML file inside the automations/ directory. So you can have turn_on_lights.yaml and turn_off_lights.yaml files in the automations directory, each with its automation.
Compare this with:
automation: !include_dir_merge_list automations/
In this case, each YAML file in the automations/ directory can have multiple automations inside. You can write rules for turning lights on and off in a file called lights.yaml. The thing to remember when using the merge_list directive is that all automations in all files must be in list format (hyphenated), for example:
- alias: "Turn on Light"
trigger:
- platform: state
entity_id: device.iphone
to: "home"
action:
- service: light.turn_on
target:
entity_id: light.living_room
but not:
alias: "Turn on Light"
trigger:
- platform: state
entity_id: device.iphone
to: "home"
action:
- service: light.turn_on
target:
entity_id: light.living_room
!include_dir_named and !include_dir_merged_named work similarly, but instead of merging files into a list, they combine into a dictionary. For example, scripts load into a dictionary. Use an entry instead of a list like this:
script: !include_dir_named scripts/
to combine files in the scripts directory, each containing one script, or
script: !include_dir_merge_named scripts/
to combine files in the scripts directory, which could contain more than one script.
What I decided to change
I used a combination of include directives to split up my configuration file and organized my automations as a merged list. This way, you can store automation groups in one file. For example, I have irrigation.yaml file for irrigation automation and an hvac.yaml file for heating and cooling automation. I also created a unified dictionary for my scripts.
For sensors, lamps, switches, groups, shell commands, and input_numbers, I used a simple include directive to keep them in their files. I don’t tweak and add and change them as often as automations, and there aren’t that many, so I think a separate file for each is fine. Here is the relevant section of my configuration.yaml:
Note lines 2 and 3 above. I have a regular include directive and a merge list directive for automations, which allows me to organize the automations I write into files while the automations generated by the UI will still be in automations.yaml.
But what about packages?
Another way to organize your files is to use packages. Packages allow you to bundle integrations (like light, switch, input_boolean, etc.) together. You can combine packages with include directives to group functions in your configuration more logically. For example, you can have a home theater package that will include all the lighting, audio-video equipment, and automation for the room in one package.
Last thoughts
I hope that after this article, you will have new ways to organize your Home Assistant’s configuration files. I’d love to hear how you do it. Let me know in the comments.