Tag: Home Assistant

  • Automation for Home Assistant

    Automation for Home Assistant

    After getting Home Assistant running and hooked up with some device, it is time to start putting automation into the system. For example, I have 10 different light bulbs in my system and I would like to make some automated control over them. Follow along and you may learn how to master yours!

    Before starting the actual automating I want to make some minor adjustments because I noticed all my light bulbs are in one messy bundle in Home Assistant GUI. I would like to have them neatly arranged to indoor and outdoor lights. The groups are there to rescue. Open up groups.yaml -file, which can be found from the same config -folder. Here you can easily group yours entities, for example like this:

    In case you wonder how to know the exact names of the entities, you can find a complete listing of available entities and their attributes by following the second link States located under the Developer Tools menu.

    After saving the groups -file and restarting Home Assistant, you should be able to see the difference:

    Now, similarly the actual automation code can be added to a separate file. Look at the automations.yaml. To automate outdoor lighting according to the status of sun I append the there the following:

    Look at the code. I think you can easily find out what happens there. Note that I have some extra definitions for some light bulbs because I am able to adjust not only their brightness but also color tune. You can find all the possible attributes from the very same page we already looked at for the entity names. Also, you can use the group names as I did for the latter automation.

    I case you are not happy with the timing set exactly to the moment of the sunset event, you have many possibilities to tweak the setup. I give below couple of ideas to try out as alternative triggers:

    Hope you got everything running smoothly. In case you face problems, let me know by adding a comment and I will try to help you further. Also, please comment if you have any other feedback.

  • Customizing Home Assistant

    Customizing Home Assistant

    After successfully installing and steadily running Home Assistant you may wonder where to start setting things up, not only in sense of the user interface preferences but also the actual data inside the system. In this post I will try to give a some sort of feeling of how to tweak things under the hood without touching any home automation device or automation code yet.

    This is how your Home Assistant home screen may look like in your browser window:

    Make sure you have Samba installed. You should, in case you followed my previous blog post. However, if everything is all set, you should be able to find your Home Assistant folder via the Network/Windows share -directory in your local system. On Ubuntu it may look something like this:

    Open up the config -folder. There you can find configuration.yaml -file. Open it in your favorite text editor. I suggest you to do the following:

    1. Add correct latitude and longitude. It is not neccessary yet, but you can easily find them using Google Map. Also elevation may be revised.
    2. Add correct time zone.
    3. Comment out the line 15 introduction:, this will remove the welcome banner on the home screen. Before doing so, it may be good idea to look at the links provided, you may find them useful later.
    4. On line 25 or so, uncomment api_password and create a password. This ensures your UI is not accessible for outsiders.

    Ok, now. Let’s try changing some sensor data. You should have as default the following lines:

    # Weather prediction
    sensor:
    - platform: yr

    Replace them by adding:
    # Weather Prediction
    sensor:
    - platform: time_date
    display_options:
    - 'time'
    - platform: yr
    monitored_conditions:
    - symbol
    - temperature
    - precipitation
    - windSpeed
    - pressure
    - windDirection
    - humidity
    - fog
    - cloudiness
    - dewpointTemperature

    Make sure you use right amount of white spaces, it is very important in yaml syntax. Direct copy pasting the code may not work. If you need a hint, look at the featured picture of this post.

    After saving the changes, you must restart your Home Assistant. You can do it by selecting Restart in Home Assistant domain at Services page under Developer Tools tab in the UI. After rebooting you should see some more small icons on top of the view:

    That is just an example how to configure sensors in your home screen without actually touching any real home automation devices.

    You can continue exploring the possibilities by checking out the official documentation.

    How to set up some real automation will be introduced in my next Home Assistant post, which will be out very soon.

  • Adding IKEA Trådfri to Home Assistant

    Adding IKEA Trådfri to Home Assistant

    This is not a paid advertisement. Most of the stuff I have ever bought from IKEA has turned out being crap in the long run (some very shortly) and that is why I normally keep avoiding their products as long as there are any reasonable alternatives available. However, now I have been satisfied so far after buying a Trådfri smart lighting kit and a punch of smart light bulbs.

    I was inspired by this article. I recommend you to have a look at it. It explains the technology and gives some idea of the overall setup. It is also a good introduction to what we are going to do next in this post. In case you have no idea what is Home Assistant, have a look their web page and also read this article. The aim here is to integrate Trådfri devices into the Home Assistant system.

    Ok, let’s get the basics away. Setting up the Trådfri kit is straight forward, on a pseudo level it goes like this:

    1. Download and install the mobile app
    2. Plugin the gateway to LAN network and power supply
    3. Configure the gateway using the mobile app
    4. Couple the remote control with the gateway
    5. Couple the light bulbs with the remote control

    Coupling the remote control with the other device is easy, basically just keep the device near to each other and press long the button until a light blinking indicates it is ready. The mobile app will guide you through anyway and if you face any problems, look at the detailed Trådfri manuals.

    After you have everything linked together within the Trådfri platform, you may be happy to control the lights with the Trådfri mobile app. Or not, if you wish to get them utilized for more advanced automation. For that, let’s link them to Home Assistant. This naturally requires a properly working instance of Home Assistant software running on a device like raspberry Pi or any other computer constantly serving the software.

    If you followed my previous Home Assistant blog post and you already have hass.io or any other Home Assistant installation running, bear with me and follow along.

    So, open your Home Assistant GUI in your web browser. If everything went as supposed to, you should automatically see Configurator suggesting to configure your Trådri device. If not, try restarting the Home Assistant.

    Click configure and type the security code from the bottom of the hub device.

    Voilà! You should be able to see all your Trådfri light bulbs in the user interface and be able to fully control them!

    Great, now we have them on the same platform as our possible other home automation systems, which opens infinite possibilities what comes to automating them.

    Next you may want to check out some basic light automation tricks by reading this post.

  • Getting on with Hass.io

    Getting on with Hass.io

    The first time I tested Home Assistant software was couple of years ago and it was on Linux desktop. I liked the idea and the execution, and it made me think I would like to able to build my own custom kit for some random home automation. So I decided I will get back to this as soon as I have a suitable platform to constantly run the software on. Later on, I found myself having a spare piece of Raspberry Pi 2 mini computer. Since then I have happily run Home Assistant on my Raspy and used it mostly for some lighting adjustments etc. Back then I installed my Home Assistant as Hassbian, which is a customized operating system for the Raspberry Pi. It was so far the easiest to install and use but requires the traditional command line access for maintenance actions. And now this may have changed. Follow through this tutorial and become a Home Assistant user in no time! All you need is a Raspberry Pi and minimum 4 GB SD card.

    Hass.io is a dedicated operating system that takes care of installing and managing Home Assistant software on Raspberry Pi. It was introduced in H0me Assistant blog post at the end of July 2017.

    Installation

    Let’s dive in. You may start the installation by looking at these instructions. Choose and download the software package depending on which device you are going to install Hass.io on. I went with Raspberry Pi 2. Extract the resinos-hassio-1.0-raspberrypix.img.bz2 file and flask it to your SD card using Etcher. Flashing may take up to 5-10 minutes. At this point we could setup the WiFi or static IP as the instructions suggest as an optional step. However, we go now without it. Since I will be are using an Ethernet connection with a router there should be no configuration required and it should work out of the box. Also, one could consider setting up a static address being not necessary – or even recommended at all. All right, let’s insert the SD card into Raspberry Pi and switch on the device.

    You can open a new browser tab and navigate to http://hassio.local:8123/ and wait couple of minutes. After the reboot ResinOS downloads Home Assistant and starts the installation. You will be soon able to see the following view at your browser window:

    preparing hass.io

    For me it took around 15 minutes Hass.io being setup and running. You will see the default Home Assistant welcome screen in your browser:

    welcome screen

     

    Getting Started

    Nice. Now we have a fresh Home Assistant installation properly running. Obviously the next actions are setting up configurations and automations. To do so, we still need to do some adjustments. The design philosophy of Hass.io seems to be making the management of Home Assistant via web browser GUI as easy as possible. However, as far I know it does not yet support full control over the configuration files. Hence, we need to build some kind of access to the file base. There are couple of options for this but for sake of simplicity we deside not to prefer any command line tool for this but go with Samba add-on, which gives us a way to handle the files on our local desktop environment.

    To install Samba follow these step on your Home Assistant instant opened in browser windows:

    1. On the left hand side menu click on Hass.io tab
    2. You will be noted there are no add-on installed, click on the link to add-on store
    3. Add-on store opens in the same view
    4. Scroll down to Samba Share and select it
    5. Click install
    6. It shows Info and Options but go with the defaults and click Start
    7. On the left menu again, select the first icon (Services) under Developer Tools
    8. Select the Domain as homeassistant and as Service set restart
    9. Then click on Call Service
    10. You will see a notification Connection lost. Reconnecting…
    11. After a minute or two Home Assistant is rebooted and Samba Sharing should be enabled

    Now you are able to find your Hass.io files from your desktop computer that is using the same WiFi network as the Rasbperry Pi. You can browse in the file system Network folder and find HASSIO directory. On Ubuntu it looks like this:

    windows sharing

    There you can find configuration.yaml and automations.yaml-files, which allow you to freely tweak and customized your Home Assistant installation as normally. Look at the tutorial and example resources at Home Assistant website to get started. Also, come back to check my next Home Assistant post I will make for introducing some of the basic and most useful setups. Good luck!