Ansible role hass for installing Home Assistant

As described in the last article I use the manual installation of Home Assistant. To get a system up and runing very quick I prefer to use Ansible. For the installatino of Home Assistant I wrote a role. You can find my Ansible role on Github. In the same repository (in the near future) you can also find some other roles which might be useful when installing Home Assistant. The variables whcih can be used to configure the role are described in the README of the role.

Read more →

Introduction to Home Assistant and installation variants

My first encounter with home automation was to measure temperatures and later switching power sockets working with 433 MHz radio these and these). To be able to view the temperatures and to control the outlets I wrote a small web server in python. But To do real home automation it is better to use a system which is already used by many people and you have some kind of community who can help you if there are problems. My choice for this is Home Assistant.

Screenshot meiner Home Assistant Installation

Home Assistant is based on python and open source. It allows to control many home automation devices from different manufactures. These devices are used as Components. For these components you can create automations which can be executed automatically in case triggers and conditions (Trigger) are matched. For example you can play music automatically when you get home. The section Components gives you an overview about which devices Home Assistant supports (e.g. Sonos). Systems similar to Home Assistant are openHAB, ioBroker and FHEM.

Read more →

Dynamc DNS client for IPv6

Dynamic DNS is used to automatically update the DNS record of a host which IP changes often. This allows you to provide web services from a host at home behind your personal (V)DSL connection with a non-changing name. There are several providers for DDNS. I use SPDyn. The update of the DNS record is handled by a client like ddclient or directly by your router (e.g. Fritzbox). For IPv4 this is easy. The IP is always the external IP of the router which forwards ports to hosts on your local network. Since my ISP uses Dual-Stack and also provides me IPv6 I created an AAAA-record in the past pointing to the IPv6 address of my local host. When doing so I didn’t realise my ISP changes the IPv6 prefix with every reconnect. Because of this the IPv6 address of my local host changes quite regularly and the AAAA-record created got invalid. I noticed this due to an error when renewing a Let’s Encrypt certificate (post about acme-tiny).

If an AAAA-record is available Let’s Encrypt prefers it for validation of the domain (API Announcements). Because my AAAA-record was not valid anymore the renewal of the certificate threw an error:

Parsing account key...
Parsing CSR...
Registering account...
Already registered!
Traceback (most recent call last):
  File "", line 199, in 
  File "", line 195, in main
    signed_crt = get_crt(args.account_key, args.csr, args.acme_dir, log=LOGGER,
  File "", line 150, in get_crt
    domain, challenge_status))
ValueError: challenge did not pass: {u'status': u'invalid', u'validationRecord': [{u'addressesResolved': [u'', u'2003:86:2455:9c00:d1:3ff:fe81:bd3f'], u'url': u'', u'hostname': u'', u'addressesTried': [], u'addressUsed': u'2003:86:2455:9c00:d1:3ff:fe81:b46f', u'port': u'80'}], u'keyAuthorization': u'PDUNtwiHq5dncDrvs4V2NE9nSR9vLF2WhnAbX1jQ7f0.YW7Ac9LxjjuWvWzD542ZzSKxcFKDIdehVVzAuYA0vHI', u'uri': u'', u'token': u'PDUNtwiHq5dncDrvs4V2NE9nSR9vLF2WhnAbX1jQ7f0', u'error': {u'status': 400, u'type': u'urn:acme:error:connection', u'detail': u'Fetching Timeout'}, u'type': u'http-01'}

You can see the IPv6 address is used when looking at addressUsed. Because the address is invalid a timeout is reached.

To correct this and be able to access my local host via IPv6 in addition to the A-record for IPv4 the AAAA-record for IPv6 also has to be updated.

Read more →

Transfer rate when accessing Samba share from Mac OS X

I use my Cubietruck as a Samba server. Some day I noticed the transfer rate when copying files from my Mac with OS X El Captian was only around 10 MB/s. As the Cubietruck has a gigabit ethernet port the transfer rate should be much higher. I also remembered the transfer rate to be around 30 MB/s in the past. Not as fast as gigabit can deliver but I guess CPU load is a factor here.

Read more →

PowerShell Scripts with WhatIf

Sometimes you want to simulate the execution of a PowerShell script. Instead of actually doing the things defined in the script you just want to see what would have been done. Many Cmdlets understand the parameter -WhatIf. If you use it e.g. when creating a directory it actually will not be created. Instead you get a message describing what would have been done:

New-Item -ItemType Directory -Name "test" -Path "c:\temp" -WhatIf
PS C:\> New-Item -ItemType Directory -Name "test" -Path "c:\temp" -WhatIf
What if: Performing the operation "Create Directory" on target "Destination: C:\temp\test".

Read more →