Thursday, May 17, 2018

Installing Raspbian Stretch on a new Pi

My first pi is fully used and has hit production mode where it runs the house and I can't use it as a play toy anymore. It's running Jessie, which is super stable.

Guess to move on, I've got a 2nd pi which I've decided to put raspbian stretch and here are some notes of the install because it never really goes as planned.

After downloading and running raspi-config to region, etc. apt upgrade failed with hash sum mismatch using the default apt sources. I tried a few and what worked for me was:

deb stretch main contrib non-free rpi

after apt-get upgrade worked, I went on to install java. 
I had some issues as well with  "Error: missing `server' JVM at `/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/arm/server/'." which was fixed with

sudo apt-get purge openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre-headless

sudo apt-get install openjdk-8-jre

Ok, moving on to some software, i prefer a manual installations since I can squeeze more stuff into the pi.

As I mostly use Domoticz, I've decided to muck around with home assistant this time and the installation went smoothly enough.
HomeAssistant -

Next on the list;

  • BLE Beacon presence as detection has a really short range and this can be used for specific room detection.
  • Other stuff that didn't fit on the first pi was syslogd and ELK for log analysis.
  • ffmpeg for converting video streams

Tuesday, May 15, 2018

Displaying a common device status

Once everything is merged, the challenge will be to make sure all devices are reported to the correct status. There are 2 main stores of device state in my setup;

  • Domoticz
  • Fibaro
Basically we want Domoticz to know the state of the Fibaro devices and also Fibaro to be able to know the state of the domoticz devices.

There shouldn't be 2 different master sources of data. As Domoticz seems to be the master controller and other devices, e.g. Philips hue is capable of updating the status in domoticz automatically and homebridge uses the domoticz plugin, I'm going with Domoticz as the master status and everything will just query domoticz for the state.

To do this, there need to be a virtual device for each appliance that will be have it's state reported. Domotics support all sorts of virtual device, the more common ones we will use is 
  • Switches
    • Sockets (On/Off)
    • Motion Sensor
    • Contact Sensors
    • Lamps/Dimmer
  • Temperature
The full list is located here. Most devices will use the standard sockets device, i.e. On or Off. 

The "Ping test"  hardware devices that can be added to domoticz if you wish to check the status of the NAS or the TV or other ping-able device. Note that this does not apply to mobiles or iPhones which need a separate script to update the device status.

HomeBridge Updates

Add the device to the Homekit room and the device will automatically appear in Apple Home. I did not add a ping test device to homebridge directly, but add the actual virtual control device to homebridge and on the backend, use the ping test device to update the actual device.

For devices that I think needed to be on all the time, I can add notifications to when the ping goes down, e.g. if your NAS was turned off instead rather than have an extra icon in Apple Home.

Fibaro Updates

Once the devices are added to Domoticz, in Domoticz go to;

Setup > More Options > Data Push > Fibarolink

This will allow you to send a device state to a Fibaro label. It does not help update the global variable. You will need to create a Fibaro virtual device with a bunch of labels and name it correctly. These labels will be updated with the status of the Domoticz virtual device, e.g. On/Off.

This is probably the easiest way to be able back reporting if you prefer to use the Fibaro app which is much prettier than the domoticz app at this time. If you also like control buttons in Fibaro app, refer to the post on Fibaro virtual devices controlling Domoticz using HTTP commands.

Note, it's also possible to update Fibaro global variables where needed, this can't be done via FibaroLink, but should be easy enough to put into the On/Off action of the virtual device to call a script:/// to use the Fibaro API to update accordingly. I've not done this yet as so far, I haven't found a need for it.

dead pi

Well, I guess it has to happen at some point. the home automation raspberry pi has died. Much to do with the stupid Strontium mini SD card. ...