Elektroda.com
Elektroda.com
X

Search our partners

Find the latest content on electronic components. Datasheets.com
Elektroda.com

Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

p.kaczmarek2 22404 33
This content has been translated flag-pl » flag-en View the original version here.
  • Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Hello my dear
    Here I will describe in detail how you can easily start your adventure with Home Assistant. I will present its configuration on various platforms (Raspberry Pi, Banana Pi, virtual machine) and demonstrate how to connect the first devices to it via WiFi and Zigbee.

    Introduction
    Home Assistant is a still developing solution that allows you to connect many different Smart Home devices from different manufacturers, and free us from unwanted and (according to some) tracking servers from their manufacturers.
    Normally, when we buy a Smart device (e.g. a socket with WiFi, or a door opening sensor from Zigbee, or a vacuum cleaner), we are doomed to use it with the application of its manufacturer and with the servers of this manufacturer.
    When we have devices from two different manufacturers, we often cannot integrate them together (e.g. program the sensor so that a sensor from one company turns on the light on the relay from the other).
    In addition, when a given company goes down, it is possible that its servers will go down along with it and the device in our company will also go down.
    Home Assistant solves it all - and supports many devices 'on the spot', even without the need to change the firmware.
    Of course, everything has its cost - the Home Assistant must be set up by us on a machine in our local network.
    We also have to pair the devices with our Home Assistant ourselves.
    And it is these processes that I will describe here.
    I invite you to read.

    Topic content
    I will answer the following questions here:
    - how to install Home Assistant on a virtual machine?
    - how to install Home Assistant on Raspberry Pi (using Balena Etcher, clean install on SD card)?
    - how to add Home Assistant on Banana Pi (on an existing server on Banana Pi, without resetting the entire system)?
    - how to install Mosquitto MQTT broker for Home Assistant?
    - how to connect a Tasmota device (on ESP8266 or similar) via MQTT to Home Assistant?
    - how to install zigbee2mqtt on Home Assistant?
    - how to use the Zigbee USB dongle CC2531 with Home Assistant?
    - how to connect Aqara device to Home Assistant via Zigbee?
    - how to create a simple automation scenario on Home Assistant, for example something like "turn on the light when the room is dark"?
    - how to set a fixed IP for a device with Home Assistant?
    - how to connect Home Assistant to our Tuya / SmartLife account and control their devices without changing the firmware?
    - how to enable logging in via SSH to the Home Assistant console?
    NOTE: The topic assumes that the reader knows the basics of the basics, for example, with a Raspberry, with a router, how to run a Raspberry, how to log into your router, etc. etc. etc.

    What will we need?
    What will be needed depends on the installation route we choose.
    I will describe two possibilities here:
    OPTION 1 - Virtual machine
    We put the virtual machine on a normal computer, you can use VMware or VirtualBox for this. For this topic, I will be using VMware. A virtual machine is a very convenient solution, because it can be easily moved if necessary, you can make its backups (and if we have a copy, you can experiment as much as you want, because we will not break anything), but it requires a bit more powerful equipment. It also increases power consumption, but if we have a computer that runs all the time, thanks to the VM, we do not have to buy a special Raspberry.
    The virtual machine can also be placed e.g. on an old laptop that is connected to the network all the time.
    OPTION 2 - Single board computer
    The second solution is to use a Raspberry Pi, preferably Raspberry Pi 3, 3+ and 4. This is a cost but low power consumption pays it back to some extent, although it is not as universal as a virtual machine.
    You can also try to use Raspberry clones such as Banana Pi, you can also install Home Assistant on them, although they are not officially supported.
    Then you will need an SD card.

    In both cases, if we want to support Zigbee then we need Zigbee Dongle as well, they are different, but here I used CC2531:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    And of course, a device to be controlled by Home Assistant will be useful - here is a really wide selection, because the possibilities are very large, Home Assistant supports a lot of devices from different manufacturers, I recommend you to read their list:
    https://www.home-assistant.io/integrations/#all
    My device collection looks like this:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    (but I'm not saying they're all 100% supported by Home Assistant, I'll just check that out)

    Home Assistant Home Page and Documentation
    For starters, it is worth familiarizing yourself with the documentation of Home Assistant, available on its official website:
    https://www.home-assistant.io/
    Description of how to get started:
    https://www.home-assistant.io/getting-started/
    List of supported devices:
    https://www.home-assistant.io/integrations/
    Documentation:
    https://www.home-assistant.io/docs/
    Automation examples:
    https://www.home-assistant.io/cookbook/

    Raspberry Pi - Home Assistant installation clean
    Raspberry Pi, and more specifically Raspberry Pi 3, 3+ and 4 are officially supported by Home Assistant and allow for easy and quick installation of the whole with the ready operating system on a clean SD card, which we then put into the 'Raspberry'.
    The Raspberry Pi Zero and Pi 2 are also supported, but their use is discouraged due to a performance issue.
    First, we download the appropriate image from here:
    https://www.home-assistant.io/hassio/installation/
    Then we use Balena Etcher, hence:
    https://www.balena.io/etcher/
    to record this image to an SD card (at least 32GB in size).
    I recommend 64GB:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    For this USB adapter:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Balena Etcher Image Upload Process:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We put the prepared SD card (with a compatible system image) into the Raspberry and then run it. That's enough - then you only need to connect the keyboard and monitor or connect via UART to have access to the command line.
    If we do not have a free monitor, etc. and want to immediately connect to the Raspberry via the network, then you will need to know the IP that the Raspberry got, and this IP can be found, for example, in the router logs, which IP was recently assigned by DHCP.

    Banana Pi - adding Home Assistant to the finished server
    The second method of installation is to add Home Assistant to a ready-made system, for example, Banana Pi. There is nothing in the official documentation about the Banana Pi, but after applying a few small tricks, it can also be easily placed on this platform.
    I have a ready server for Banana Pi for some time, this is my OpenMediaVault described here:
    Noiseless, energy-saving 480GB file server on Banana Pi - OpenMediaVault
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    I have been using this server all the time for almost a year, so it is an ideal candidate to enrich it with the control of Smart devices.
    I will show here how you can install on such a Home Assistant server.
    We perform the operation via SSH, I use Putty for this:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    You must log in as root:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then we will download the installation script, command:
    curl -Lo installer.sh https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh
    I already have Curl installed, if necessary, it needs to be installed via apt-get.
    Result:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then we run the installer (but it probably won't work the first time, more on that in a moment). Command bash installer.sh :
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Installation failed - [error] missing: network-manager apparmor . We are missing a package.
    You have to install it.
    Command apt-get install network-manager apparmor-utils :
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We confirm the execution by entering Y:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Downloading will take some time:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    NOTE: depending on what you are installing on, you may be missing other packages, including bash, jq, curl, avahi-daemon, dbus, software-properties-common. We install them in the same way as apparmor-utils, via apt-get.
    Then we try to install again, bash installer.sh :
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Confirm (if we have something in / etc / network / interfaces, it's worth making a copy).
    Spoiler:

    For me, this file was:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    and overwriting did not break anything

    Now, unfortunately, the error will appear again. [error] Please set machine for armv71 This is because banana pi has a different architecture, armv71, which is officially supported by Home Assistant.
    This can also be fixed.
    We run the installer like this:
    bash installer.sh -m raspberrypi3
    then the script will treat our Banana just like a Raspberry.
    Installation continues:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    After some time:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Installation ready, but this is not the end!
    At this point, Home Assistant is still installing itself in the background.
    His website (our machine's IP address, port 8123, e.g. 192.168.0.128:8123) does not work at all:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    At this point, we wait patiently, we do not make any changes. We do not turn off or restart the machine.
    After some time, a temporary page will be displayed asking you to wait:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    This page may still be disappearing. Only after some time will we receive:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    and only then is the installation really ready

    Virtual Machine - Home Assistant installation
    The third way to get Home Assistant is to run it in a virtual machine, e.g. in VMware, which runs on a normal PC.
    I assume we have VMware already installed.
    Of course, a similar process can be performed on VirtualBox.
    First, we download the appropriate image:
    https://www.home-assistant.io/hassio/installation/
    In this case hassos_ova-5.10.vmdk.xz .
    Remember to unpack the image from the package:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We run VMware (you probably have a different version, but the process will be similar):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We choose Create New, Custom mode:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Hardware compatibility - I chose the newest:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then select "I will install the operating system later", because it will not install the operating system normally from the media, but we will just attach the already ready VMDK disk image with the system.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We choose the type of system. Depending on the downloaded version, Other 32-bit or Other 64-bit, but rather 64-bit. Here, too, I chose "Linux" before and it worked as well.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Virtual machine name and location. I recommend putting it on an SSD. For me, the C drive is SSD.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    The number of processor cores - it depends on the hardware hosting the VM, but at least 2 cores should be given.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Amount of RAM - as above, it depends on how much we can devote, 1GB is the minimum, I recommend 2GB or more.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Network configuration - choose 'bridged' so that the VM is connected directly to our LAN.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    SCSI Controller Type - LSI Logic (Recommended).
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Virtual disk type - we choose SATA.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Disk selection - "Use an external virtual disk" - because we already have a disk ready in the form of VMDK.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We provide the path to the downloaded VMDK:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We make Convert (replacing the disk with a new format supported by this version of VMware what we have):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Now, if we want, we can make a few changes, if we click Customize, and if not, the VM will be added:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    VM ready - but we will go to VM-> Settings to change something:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We remove the Sound Card - it is redundant. Select and click Remove.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    If the size of the disk here (with 'Hard Disk') is unnaturally small, e.g. 6GB, then we can enlarge it to e.g. 32 or 64GB. I had 32GB right away.
    In the Options tab, select Advanced and turn on 'Boot with EFI instead of BIOS' (in other versions, instead of a single checkbox, there may be a radio button checkbox, but we choose EFI anyway).
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    It's time to start our VM:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    The operating system starts:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Log in as root (without a password by default, then you should change it). Done - now we are on the Home Assistant command line. You can also leave it by typing 'login'.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota


    Network information from the Home Assistant console
    Normally, all operations are performed here via the web panel, but it is worth knowing, for example, how to check the network operation through the Home Assistant console, for example from VMware or after logging in via UART or SSH (if we have them installed).
    You may need to enter 'login' beforehand to get to the system command line:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    A command is used to display information about the network nmcli :
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    You can also use it for this ip a .
    Of course, you can also check if we can ping the network (eg. ping elektroda.pl , or ping 8.8.8.8 or you can have fun nslookup elektroda.pl ):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Everything should work.

    Virtual machine - IP configuration
    If we put Home Assistant on a virtual machine, it is worth setting its IP configuration in Bridged mode.
    This mode makes the virtual machine have a different IP than the host computer, but it is visible in the LAN.
    If we omitted this when creating the VM, it changes in Machine Settings, in Network Settings, here:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Below is a screenshot simultaneously from VMware, from a Windows console with IP configuration, and from a browser that sees the Home Assistant page:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    and of course other devices on that LAN see Home Assistant too. Phone screenshot:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

    Virtual Machine - IP problem solution
    If we are using VMware and we are using the 'Bridged' mode for the network card, and yet we are not connected to the network - ping 8.8.8.8 shows unreachable network , a nmcli shows " connecting (getting IP configuration) to HassOS default " as in the screenshot below:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then we need to improve the network configuration from VMware. We run Virtual Network Editor , you can find it via Start on Windows:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    There we turn on the administrator mode (as needed), we find VMnet0:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    we click "Automatic Settings" and turn off all adapters except the one we use (for me it was WiFi, because I only tested how it works, but I recommend using a wired connection as normal):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Click Apply, save the changes, and after restarting the VM, we should receive the correct IP. We check with the command nmcli :
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

    Fixed IP - by MAC reservation on the router settings
    This step is important no matter where you install Home Assistant - it applies to both Raspberry, Banana and VM.
    It is important that the Home Assistant has a fixed IP in the network (although you could also deal with DNS here and refer to it by the hostname).
    There are several ways to fix IP, you can set them hard on the machine itself (disable DHCP), and you can also set it in DHCP on the router so that a given MAC will always have the same IP. Normally, DHCP does not guarantee that the same client will always have the same IP address.
    Here, I'll show you the latter way.
    We enter the router's settings through its web panel, log in (you need to know the password), check the DHCP settings. First, the client list:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We remember the MAC of our Home Assistant.
    Then select 'Address Reservation':
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We add a new entry:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    And if necessary, restart the router:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    From now on, the client with the MAC set by us will always have the one IP chosen by us.


    The first launch of Home Assistant
    A correctly configured Home Assistant should be visible in our local network under its IP address or (if we cover DNS) with its domain name.
    For me it was:
    http://192.168.233.183:8123/
    We open this address in the browser.
    (NOTE: If it does not open, and we are fresh after the installation, it is worth waiting for a quarter of an hour, because in the background the server may still start up)
    It's time to do the first configuration:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Without external IP / port forwarding, this site won't be accessible outside of our LAN, but it's a good idea to set a strong password anyway. In the future, we may need to make our Home Assistant available on the Internet.
    Next, we need to configure our Home. This is an important step, because Home Assistant is even able to base actions on the weather from the Internet, so the location should be correct:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    After that, Home Assistant will try to detect devices available on the network. For me, it only detected the router:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then the login form appears (although it can also direct us to the panel). We use a predetermined login and password:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    This way we get to the main Home Assistant panel. I recommend that you familiarize yourself with it, because this is where we will perform most of the operations and configurations.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

    Home Assistant - we are adding the Mosquitto MQTT broker
    MQTT Mosquitto broker is not automatically installed with Home Assistant. You have to install it separately via the Addon Store. It is necessary to connect to devices via MQTT, i.e. to connect Tasmota devices.
    I will describe step by step how to install it.
    On the main Home Assistant website, go to the 'Supervisor' tab, here:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    If by some miracle we don't have this tab, it means that we installed a trimmed version of Home Assistant without Hass.IO. In this situation, I recommend that you verify what we did wrong with the installation and reinstall the full version (supervised).
    From there we go to the Addon Store, here:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    In the Addon Store, we have a wide selection of various Home Assistant add-ons that we can add to our home for free.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We are looking for Mosquitto:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Click on its name and then on Install:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Installation will literally take a minute. Then we get such a view (we make sure that start on boot is enabled - that is, whether it will just turn on with the system startup):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Click Start:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Now you need to configure Mosquitto. Go to configuration from the main menu:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then select "Integrations" (we will find Mosquitto there):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    "Configure" button:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We enable detection of:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We confirm:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    The Mosquitto backlight should disappear:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    But we click "Configure" again:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Click on 'Re-configure', then display the MQTT password and copy it:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Example data:
    Quote:

    Broker
    core-mosquitto



    Harbor
    1883

    User Name
    homeassistant

    Password
    AiQuahcheethoaL9joo7aa6aaLei9pho1eimee1sel8iewookaijiew3Iechah1n

    After 'confirm':
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    After saving:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

    Home Assistant - we add a Tasmota device to the MQTT
    Now we will add the Tasmota device (with ESP8266, with the Tasmota batch loaded) to the Home Assistant via MQTT.
    Tasmota can be easily uploaded to many different devices from different manufacturers, SmartLife, Tuya, BlitzWolf, eWeLinkIt, etc.
    I have described the method of uploading Tasmota several times.
    Upload via tuya-convert here:
    SC3-01 SmartLife switch and uploading ESP firmware via WIFI (tuya-convert / OTA)
    Here via UART (and soldering cables):
    SmartLife switch - test, interior and WiFi light switch programming
    The Tasmota device should already be connected to our WiFi network and we should know its IP.
    I also recommend following the process from here:
    ESP8266 and Tasmota - step-by-step control of the WiFi relay
    (by the way, in the case of many devices, it would be possible to pair them with Home Assistant without changing the firmware at all, but more on that another time)
    So, we go to the device page:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Press 'Configuration' ":
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Press 'Configure MQTT':
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    On the screen above, we provide information about the MQTT broker from Home Assistant.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    In addition, I recommend that you turn on the SetOption19 1 option in the Tasmota console.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    SetOption19 enables the so-called MQTT discovery, i.e. a way of discovering new devices:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then restart the device again (Restart from the main menu).

    Home Assistant - Tasmota device by MQTT
    Tasmota's device is rebooting. We wait a moment.
    In Home Assistant, in the logs (tab 'Journal') we should already see that something is going on and Tasmota is visible:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We can then click on the name "Tasmota" and the following window will open:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then it is also worth changing the name from "Tasmota" to something more specific.
    I recommend paying attention to the green-red bar that shows us when the device was turned on and when it was turned off:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    After clicking the 'cog' icon, you can change its name:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    You can also change its area (where it is located - kitchen, bedroom, etc.), create your own area and change the icon:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    And from now on it will be visible on our desktop:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Ready. From this desktop, you can already control it - here you turn the light on and off.

    Home Assistant - automation through MQTT
    To do this, on the main page, click the Configuration button, and then in the MQTT block, click "1 device" (this will display a list of devices):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    It will show us such a list of devices (but this time filtered according to MQTT):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We click on the line we are interested in (device) and we get all the possibilities of its configuration in one place:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Here you can do automations, i.e. scripts like "when it's dark in the room, turn on the lamp" or "when the temperature drops below 18C, turn on the heater", etc.
    It's just that to make a meaningful automation we will need two devices - and I will present it in a moment, but that in the next paragraph.

    Zigbee2mqtt - Virtual machine - Zigbee Dongle connection
    Now we turn to the topic of Zigbee. We reach for the aforementioned dongle based on CC2531 (although you could try to get a better CC2538 + CC2592, better range):
    If we use VMware, we make sure that it is connected to our virtual machine and not to the main computer. This is done in VM -> Removable Devices -> there we find CC2531 and make sure that "Connect" is selected. As below picture:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    The presence of a USB device can be checked on Linux with the command lsusb , it lists the id of connected devices. Before connecting:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    After connecting:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    There is a new device in the list, its ID is 0451: 16a8 . Is that a ZigBee dongle? Of course you do - a short search confirms it:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    At this point, we are sure that the machine with Home Assistant can see our CC2531 and we can move on to the next step.

    Zigbee2mqtt - installation via Addons from Home Assistant
    First we need to give Home Assistant a look at the plugin repository from zigbee2mqtt. On the main page, click on Supervisor:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    There, click on the 'Addon Store', and then enter the settings by clicking the three dots icon, from where we select the 'Respositories' button:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    A dialog box will open:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Zigbee2mqtt is on github, here:
    https://github.com/danielwelch/hassio-zigbee2mqtt
    And we paste this address there.
    After adding, new entries should appear in the Store:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    At this point, the Store already knows that an add-on like zigbee2mqtt exists, but we haven't installed it yet.
    Click on zigbee2mqtt from the list, install it here:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    This installation took a long time for me.
    After installation, you need to click 'Start':
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    It is also worth to turn on "Show in sidebar" so that we can conveniently find them. Then zigbee2mqtt will appear in the bar on the left:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota


    Zigbee2mqtt - Zigbee dongle configuration
    Now we need to determine what serial port our dongle has. Ports can be viewed in Supervisor -> System -> (three dots) -> Hardware:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    At the very end we have:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    The names and IDs show that these are our dongles:
    Quote:

    / dev / serial / by-id / usb-Texas_Instruments_TI_CC2531_USB_CDC ___ 0X00124B0014D9A7B2-if00
    attributes:
    DEVLINKS:> -
    / dev / serial / by-id / usb-Texas_Instruments_TI_CC2531_USB_CDC ___ 0X00124B0014D9A7B2-if00
    /dev/serial/by-path/pci-0000:02:00.0-usb-0:2.2:1.0
    DEVNAME: / dev / ttyACM0
    DEVPATH:> -
    /devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.2/2-2.2:1.0/tty/ttyACM0
    ID_BUS: usb
    ID_MODEL: TI_CC2531_USB_CDC
    ID_MODEL_ENC: TI \ x20CC2531 \ x20USB \ x20CDC
    ID_MODEL_ID: 16a8
    ID_PATH: 'pci-0000: 02: 00.0-usb-0: 2.2: 1.0'
    ID_PATH_TAG: pci-0000_02_00_0-usb-0_2_2_1_0
    ID_REVISION: 0009
    ID_SERIAL: Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0014D9A7B2

    We remember / dev / ttyACM0. We need to enter this in the zigbee2mqtt configuration. We enter Supervisor, and then in Zigbee2mqtt:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then 'Configuration':
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We have to change a few things here. Everything marked in the picture:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    - mqtt group, user and password fields
    - serial group, port field (to the port we have, it is possible that you will not need to change anything),
    - group advanced field network_key (change the numbers so that we have a different password than the default one)
    - permit_join to true
    After changes:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We write down:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We confirm the restart of the add-on:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

    Zigbee2mqtt - connect the first device
    Now we will need something that uses Zigbee. For example, I chose a motion sensor from the Aqara series:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    I will provide more information on this sensor in a separate topic.
    I pressed its button on the casing (although maybe it was not necessary):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    and after a while the sensor was detected in the Configuration -> Integrations -> MQTT tab:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Click on its name to display more information:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Here you can also create automation (e.g. automatically turn on the lamp when it is dark in the room).
    If we have enabled Zigbee2mqtt on the sidebar, it will also be visible here:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    After clicking on the name:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Here, for example, you can check the values of the variables exported by this sensor:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    There is a bit of it, the sensor displays its battery level, temperature, light level and even determines whether it has detected movement in the room.

    Home Assistant - automations (i.e. scenarios, scripts)
    Now we have two devices - a lighting sensor (not only) and a relay.
    It's time to connect them in some clever way, i.e. make automation.
    No light in the room will light the lamp.
    Open Configuration -> Devices -> (select and click for which device we are doing the automation).
    For example, for the Aqara sensor we have there:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Next to 'Automations', click the plus icon. A window like this will appear:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    here we choose what will trigger the event. As you can see, the choice is wide.
    Let's choose that the event will be triggered by a change in the lighting level. After clicking, we are transferred to a more complex form:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We enter the name and description (optional) of the action, and then set the parameters of the event that will trigger them.
    For example, this action will be triggered when the light value from the sensor drops below 5 lux:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Below we can add the conditions of the action (additional, you do not need to set them) and what the action will result:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    The actions can be of different types, but I will choose the "device" type:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    On the "device" list we have devices available in the system (there is also a Tasmota relay that I added earlier):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    There are three operations for this relay - on, off and changeover (change of state to its opposite). I chose to turn on here (when it's dark, the light turns on):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then you have to click 'Save' and the automation will work from then on.
    In the same way, I made a second automation that turns off the light when it's bright.
    We also have all automation in the Configuration -> Automations tab, here:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    In the video below I present their operation:
    [movie: 2c1753af0e] https://filmy.elektroda.pl/32_1612868070.mp4 [/ movie: 2c1753af0e]
    (this in the video is my Tasmot relay on ESP8266, DIY version, but it could also be a Smart device from Tuya, or Blitzwolf, etc. etc. etc.)
    Everything works, covering the sensor turns on the lamp. It will be worth increasing the frequency of sending the state by the Aqara sensor by MQTT to make everything more responsive, but I will describe it in another topic.


    Home Assistant - additional information - automations as Yaml
    It is also worth knowing that editing the automation via the Home Assistant's web panel also allows you to edit them as Yaml (this is how they are saved internally).
    We switch it here:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    This is what it looks like in Yaml mode:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Copy the content as text:
    Quote:

    alias: power on_when_dark
    description: ''
    trigger:
    - type: illuminance
    platform: device
    device_id: b3108200a6e6b23fba64eaa38a915edc
    entity_id: sensor.0x00158d000586adf6_illuminance_lux
    domain: sensor
    below: 10
    above: -10
    condition: []
    action:
    - type: turn_on
    device_id: a9c4515caaa84b116ae8fe99b6dac7e6
    entity_id: switch.tasmota
    domain: switch
    mode: single



    Home Assistant - Noteworthy plugin - File Editor
    There are many more or less useful plugins in the Addon Store. One of them is File Editor. It allows (as the name suggests) to conveniently edit configuration files from the web panel.
    https://github.com/home-assistant/addons/blob/master/configurator/README.md
    We install it in a similar way as I discussed earlier for the MQTT plugin. So we open the Store, enter File Editor or Configurator:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Click 'Install' to install:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    And then 'Start':
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    I also recommend selecting 'Show in sidebar' so that the editor is conveniently available on the sidebar:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    From now on, in File Editor, we can view files, create and edit them:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    In addition, this editor also pre-checks the correctness of writing scripts and, if necessary, informs us in which line the error is:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

    Home Assistant - Tuya support without changing the firmware
    Tuyi devices (i.e. from Tuya, Smart Life, or Jimvoo Smart App) can also be added to Home Assistant directly. You do not need to change their firmware to Tasmota. It is quite convenient, although it also has its downsides, such as the fact that these devices will then also be visible in the manufacturer's cloud, and the Home Assistant will select them through our account at their manufacturer.
    This process is described in detail here:
    https://www.home-assistant.io/integrations/tuya/
    I will now show you how it works.
    We need a Tuya device, a Tuya account (confirmed by email) and the Tuya application will also be useful for demonstrations:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    The photo above shows an already paired device that can be controlled by the Tuyi application.
    In order to connect our Tuya account to the Home Assistant, open the Configuration-> Integrations tab, click the plus icon:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We find Tuya in the list:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We provide the details of our Tuya account and determine whether we are specifically talking about the Tuya application, or maybe about Smart Life (it is also supported). The country code for Poland is 48.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    The application selection looks like this:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    If we have provided correct data, then Home Assistant should log in to our account after a while:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Our Tuya account will appear on integrations:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    And all devices from the Tuya account will appear on the main desktop:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    And that's it - now you can control them simultaneously from the Tuya application and our Home Assistant.
    Demonstration below:
    [movie: 2c1753af0e] https://filmy.elektroda.pl/63_1612900096.mp4 [/ movie: 2c1753af0e]
    The phone on the right has the Home Assistant page open, and the phone on the left has the original Tuya app. The control works from both phones.
    (there is no bulb connected to the relay, but you can see that the blue LED is on, and you can see that the Tuya application is responding to the change by Home Assistant)

    Home Assistant - access to the terminal via SSH
    The finished system image from Home Assistant does not include SSH support, so it should be installed as well. However, if we installed Home Assistant as an addition to an existing server, via a script (as I did on Banana Pi), we already have SSH.
    In any case, SSH installations can be done through the Addon Store:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Click 'Install':
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    After installing (it's worth to turn on 'Show in sidebar'):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Then we can click 'Start', but it won't work yet. The answer to what can be found in the tab next to it, in 'Logs':
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    The mistake is WARNING: SSH port is disabled. Prevent start of SSH server ..
    For this reason, we have to go to Configuration (the tab next to it) and set the port number in Network there:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Here you also need to set a login password:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    (otherwise we will get the error 'FATAL: You need to setup a login!' in the logs)
    Here you have to copy:
    Quote:

    authorized_keys: []
    password: test123
    server:
    tcp_forwarding: false

    Click 'Save' (on the right, you have to do it twice, once for the port and once for the config).
    We restart:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    We try to connect through Putty:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Success:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Login (according to agreed data):
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Done, this is how we can get to the Home Assistant console via SSH.

    Summary
    Of course, this is just the beginning of the Home Assistant adventure. The whole system offers a lot of functionalities and plugins that cannot be described in one topic, and the long list of supported devices is really impressive and shows us that it is possible to make a Smart Home based on equipment from different manufacturers.
    I collected some of these devices myself and soon I'm going to present the configuration and interiors of some of them separately. We'll see how Home Assistant can handle it.
    In the queue I have, among others:
    - Aqara series on Zigbee (I have already presented one of the sensors here; but I also have other devices from this series, e.g. door opening sensor)
    - smoke, water, lighting detectors on WiFi by SmartHome / Tuya / eWeLinkIt
    - AlfaWise P2 air freshener
    And that's it for now, although this topic will still be updated.
    Do you have any experience with Home Assistant, what do you think about this platform? Please feel free to discuss.

    Cool? Ranking DIY
    Can you write similar article? Send message to me and you will get SD card 64GB.
    About Author
    p.kaczmarek2
    Level 26  
    Offline 
    p.kaczmarek2 wrote 1720 posts with rating 3439, helped 94 times. Been with us since 2014 year.
  • #2
    chemik_16
    Level 25  
    also rummaging in HA from time to time, I make a shim for production use.
    For me it is a VM on proxmox - if there is something there, there is also a script that will set it up with an "automat".
    As an Intel Celeron 3930 base, on a small itx board powered from 12v, the whole thing consumes from 7 to 12W.

    curiosities - it is harder and harder to find IOT devices with built-in esp8266 - most of the Chinese production switched to BK7231 and similar from this series. You have to replace or write your own software - some SDK is available. So-called AliOS
  • #3
    p.kaczmarek2
    Level 26  
    chemik_16 wrote:

    As an Intel Celeron 3930 base, on a small itx board powered from 12v, the whole thing consumes from 7 to 12W.

    that's pretty good, although in the case of my server on Banana Pi (with SD card and SSD drive) the power consumed from the network does not exceed 3W
  • #4
    krzbor
    Level 23  
    chemik_16 wrote:
    curiosities - it is harder and harder to find IOT devices with built-in esp8266 - most of the Chinese production switched to BK7231 and similar from this series.

    Good point. It's worth reading this thread: Link - many people buy devices where there was ESP in previous versions, and now there is BK.
  • #5
    Ibuprom
    Level 26  
    chemik_16 wrote:
    For me it is a VM on proxmox - if there is something there, there is also a script that will set it up with an "automat".
    Can you write something more about it? I play with HA with docker images, but it works terribly unstable when we want to dig deeper. I have proxmox on my home server, but can't find full info on how to put it on a clean system.
  • #7
    Ibuprom
    Level 26  
    Thanks buddy chemik_16. Somehow I was not given the chance to find it earlier, apparently I was looking poorly.
  • #8
    chemik_16
    Level 25  
    p.kaczmarek2 wrote:

    that's pretty good, although in the case of my server on Banana Pi (with SD card and SSD drive) the power consumed from the network does not exceed 3W

    not too little ram as under HA?

    I had uploaded on rpi 3 before, but it was almost unusable compared to x86, before toto got up, updated, loaded packets, web navigation was also barely-so. Now everything flies instantaneously.
  • #9
    czupyt
    Level 2  
    The tutorial is nice, but cc2531 is an immediate kick and purchase the desired coordinator and do not recommend this chaff to anyone.
  • #10
    p.kaczmarek2
    Level 26  
    chemik_16 wrote:

    curiosities - it is more and more difficult to find IOT devices with built-in esp8266

    Recently I was dealing with a door sensor, which as it turned out is based on the XR809.
    I found an SDK for it and I managed to compile and upload the batch for it, so nothing prevents you from making your own batch for it. Details here:
    https://www.elektroda.pl/rtvforum/viewtopic.php?p=19211057#19211057
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    I have not read about BK yet, but if there is also the entire SDK on the web and documentation, it should also be tame

    chemik_16 wrote:

    not too little ram as under HA?

    except that after the installation it still had 10 minutes in the background (and the HA website did not work, only then it turned on) I did not experience any problems, but wait, I will test for a month, I will connect more devices and give a verdict


    czupyt wrote:
    The tutorial is nice, but cc2531 is an immediate kick and purchase the desired coordinator and do not recommend this chaff to anyone.

    What would you suggest instead, CC2538 + CC2592?
  • #11
    Ibuprom
    Level 26  
    I have Domoticz placed under BananaPi on the BCM2835 CPU (Like RPi1) and 1GB Ram. Basically it's a smarticz ready image for Debian10. In addition to domoticz, there are dashticz, grafana, HA Bridge, Monit, Webmin and some more. Domoticz, having about 20 mqtt and GPIO devices connected, several LUA scripts (2 S0 counters, electric boiler, etc.), CPU load is about 1.30, RAM occupancy is about 300MB and the domoticza gui runs quite smoothly and without jams for the second year. I want to switch to HA because of greater flexibility, but I can't find device logs anywhere. Ie - not text, only temperature diagrams, power consumption as a function of time or switch on time. In Domoticz it is available by default and I will not say it was useful many times. I can't find it in HA, maybe some plugin? How do you deal with the clutter on the HA homepage? A friend uses it, wants to do something like a smart home, but even on a 24-inch monitor, the status page is filled to the brim and gives the impression of chaos combined with tangles. Domoticz is also not better with its tiles, but in HA it looks more chaotic.
  • #12
    p.kaczmarek2
    Level 26  
    Ibuprom wrote:
    not text, but temperature diagrams, power consumption as a function of time, or switch-on time.

    is it about that?
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    e.g. door opening sensor:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    on the screenshots from me it's a bit chaotic because I haven't changed the names of the devices yet, but it's under the "History" tab for me
  • #13
    Ibuprom
    Level 26  
    In Domoticz, the temperature + humidity graph looks like this:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    In HA it looks less clear, grouping or time periods are quite poorly resolved. In Domoticz, I click on the graph, select the range that interests me and you can enlarge it as you like. Because of such "crap" a person becomes attached to this and no other solution ... But ok, now I am clinging unnecessarily. Thanks for pointing out the place.
  • #14
    krzbor
    Level 23  
    I just like programming, and PHP + JavaScript gives me full possibilities. Example of one tab:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    I can arrange everything as I want. Here is another example - an image displayed on a tablet in a bedroom. It's dark because the astronomical clock has detected the night :)
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    It's a mix of Google RSS, ICM weather, and my sensor data - bedroom temperature and outdoor temperature, and of course the clock. The tablet in the hall has a different composition - it shows, for example, the image from the camera. However, I am aware that this is a hobby solution that cannot be copied among any group of clients. Just when I need something, I add a new option, and if something does not work, I correct it.
  • #15
    pablo_banita
    Level 12  
    Ibuprom wrote:
    In HA it looks less clear, grouping or time periods are quite poorly resolved.


    but that's what Grafana is for?

    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
  • #16
    Ibuprom
    Level 26  
    Thanks, these charts are a championship. Do you achieve it with a ready-made template or did you set everything up for yourself? Second question - you have gas consumption on the chart. Will you share the information, what does this consumption measure by the meter?
  • #17
    pablo_banita
    Level 12  
    If the championship is about the authors of Grafana. I set it myself - it's really a few (dozen) clicks.

    Most of the currently used gas meters have a magnet built into the index.
    Ready "pulse transmitters" cost absurd money (considering their design), so I have a Hall sensor to read. Sometimes even a window reed switch in a plastic housing is enough.

    Hall sensor plus ESP8266 and the reading is ready. The disadvantage is that you need a power supply, but you get a better resolution.
    You can also use batteries, but then rather different communication (I used NRF24L01).
  • #18
    chemik_16
    Level 25  
    I am just at the stage of installing current transformers for phase conductors. I had a dozen or so coils from China, supposedly for 50A / 50mA, 48ohm. Cost PLN 1 a piece, we have some sick money for it ...
  • #19
    Ibuprom
    Level 26  
    pablo_banita wrote:
    Most of the currently used gas meters have a magnet built into the index.
    Ready "pulse transmitters" cost absurd money (considering their design), so I have a Hall sensor to read. Sometimes even a window reed switch in a plastic housing is enough.

    Hmmm, and this can be installed by foreign devices at the supplier's meter? The collector "does not rebel"? I also thought that you had a separate sub-meter, but I could not find one on the network with a ready exit.
  • #20
    pablo_banita
    Level 12  
    chemik_16 wrote:
    I am just at the stage of installing current transformers for phase conductors

    I had such plans ...
    Later, I wanted to assemble an IR head for reading the meter (I had some materials on this topic).
    It was a banal solution - counting the blinks! And it turned out that simple solutions are the best. 100% accuracy. Of course, we are talking about measuring the whole without dividing it into sections / devices.

    Added after 25 [minutes]:

    Ibuprom wrote:
    Hmmm, and this can be installed by foreign devices at the supplier's meter? The collector "does not rebel"? I also thought that you had a separate sub-meter, but I could not find one on the network with a ready exit.


    Everyone seems to be oversensitive lately. For that, it's a place in the numerator. A cable comes out of the meter (almost like in the original).
    No collector or even a service technician (and they replaced the meter with a new one - legalization), did not even stumble. After all, it's not neodymium the size of a brick.

    If you want a sub-meter, go ahead - the first one (they write that with a pulse transmitter - you still need a piece of electronics):
    https://sorbex.pl/sklep/155-4465-gazomierz-mi...-metrix.html#/162-wersja-z_nadajniku_impulsow
    or rich:
    http://www.weba.com.pl/pl/produkty/gazomierze...echowy-strong-g10-strong-z-nadajnik-impulsow- detail
  • #21
    Janusz_kk
    Level 34  
    pablo_banita wrote:
    For that, it's a place in the numerator. A cable comes out of the meter (almost like in the original).

    You can take a photo?
  • #22
    pablo_banita
    Level 12  
    Janusz_kk wrote:
    You can take a photo?

    Dark, cold, humid and the meter outside. Maybe tomorrow.
  • #23
    krzbor
    Level 23  
    chemik_16 wrote:
    I am just at the stage of installing current transformers for phase conductors. I had a dozen or so coils from China, supposedly for 50A / 50mA, 48ohm. Cost PLN 1 a piece, we have some sick money for it ...
    I was building a meter (promoted in the footer). The transformer was 20 times more expensive! I wonder how the Chinese ones will do. It is worth paying attention to the phase shift - the power meters must calculate I * U. The current is read indirectly as the voltage across the transformer shorting resistor. However, if there is a phase shift, nothing will come out of a sensible power measurement.
  • #24
    xury
    Automation specialist
    I recommend the PZEM-004t for measuring the current, voltage, power. They work very well with Tasmota. You can even put together three pieces for three-phase measurement.
  • #25
    pablo_banita
    Level 12  
    krzbor wrote:
    I was building a meter (promoted in the footer). The transformer was 20 times more expensive!
    .
    For educational purposes, it is definitely worth it. Nobody can take what you learn.
    Janusz_kk wrote:
    You can take a photo?

    Photo from the archive - after replacing the meter due to a different window, I had to change the sensor. I also found the dimensions of 50x10x10 (mm)
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
  • #26
    Janusz_kk
    Level 34  
    krzbor wrote:
    However, if there is a phase shift, nothing will come out of a sensible power measurement.

    If they are the same, the shift will be the same, but it is not that bad, I bought similar ones as well and they do not differ from those sold in e.g. TME.
    pablo_banita wrote:
    Dark, cold, humid and the meter outside. Maybe tomorrow.

    But it's obvious :) not burning.

    Added after 36 [minutes]:

    pablo_banita wrote:
    Photo from the archive - after replacing the meter due to a different window, I had to change the sensor. I also found the dimensions of 50x10x10 (mm)

    Thanks, and what sensor did you use (I know that hall, but the type because they have different sensitivities) and is there any recommended orientation in this cavity?
  • #27
    krzbor
    Level 23  
    Janusz_kk wrote:
    If they are the same, the shift will be the same, but it is not that bad, I bought similar ones as well and they do not differ from those sold in e.g. TME.

    I don't mean different shifts of different transformers. It's about the method of measurement - we measure the supply voltage and it is a good instantaneous measurement. We measure the voltage at the transformer and the question here is - what current does it correspond to? Ie. what is the time shift of the measured voltage on the transformer and the current flowing in the tested conductor? An important element is also the linearity of the transformer characteristic. I am by no means denying the fact that the Chinese are bad. However, I often find that good Chinese things just don't come cheap.
  • #28
    pablo_banita
    Level 12  
    Janusz_kk wrote:
    and what sensor did you use

    I don't remember the jacket, but the archive says:
    - A1101
    - the wider part down, about 5mm from the right (soldered from the top on the one below - and all this applies to my meter)
    In my meter, the magnetic field is weak and orientation is essential.

    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota

    It is best to buy a Hall module with a diode and experimentally check the location where the diode is on.
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
  • #29
    Janusz_kk
    Level 34  
    Ok thanks for the comprehensive info.
  • #30
    piterek-23
    Level 33  
    I have a little question ...
    Is it possible to somehow transfer data (Xiaomi Mijia 2 sensor) from Home Assistant to another server? If so, how to bite it?