Home Assistant – Dirty Optics https://dirtyoptics.com Jack of all trades, Master of none Wed, 09 Sep 2020 05:13:18 +0000 en-US hourly 1 Batrium integration with Home Assistant https://dirtyoptics.com/batrium-integration-with-home-assistant/ https://dirtyoptics.com/batrium-integration-with-home-assistant/#comments Sun, 06 Sep 2020 11:07:39 +0000 https://dirtyoptics.com/?p=54815 The ultimate goal is to be able to monitor my power-wall in the Home Assistant (HA) dashboard. In my case, HA runs on a 10″ android tablet out in the Kitchen. Firstly, I need to throw some recognition to a couple of people. The first being @Wolf. Absolute legend helped me out with some Node-red issues, and basically, without him, the 2-3 days development time would have turned into weeks. A Full list of recognition is at the bottom of the past! Enjoy!

Oh and yes I could have done this whole install on Docker/Portainer and I most likely will go down that route, but for now, this is the down-and-dirty version line by line.

Prerequisites

  • Ubuntu 20.04 LTS Server Installed on a VM or PC.
  • A Batrium Watchmon on the same network as your VM/PC.
  • Node-Red Flow (JSON file) Download Here.
  • Grafana Dashboard (JSON File) Download Here.

Step 1 – Update/Upgrade

Step 2 – Install Grafana

Step 3 – Install InfluxDB and Chronograf

INFLUXDB Install

CHRONOGRAF Install (Not Essential, but good for fault finding.)

CREATE INFLUX DATABASE (For use with Grafana)

Step 4 – Install Node-Red

NODE-RED BOOT ON STARTUP

Step 5 – Configure Node-Red

Once Node-Red is installed we need a few additional packages installed to allow Node-Red to interpret the UDP data coming from the Batrium Watchmon. The 3 packages are:

  • Binary-Parser (Install via Linux CLI)
  • node-red-contrib-influxdb (Installed in Node-Red GUI)
  • node-red-dashboard (Installed in Node-Red GUI)

The latter two items can be installed via the “Manage Palette” function in the Node-Red Settings. The Binary Parser function needs to be installed via the CLI.

Now you need to import the Flow into Node-Red. You can download the flow here. Of note here is that this flow is set up to listen for the Batrium UDP data on port 18542. We opened up this UDP port during the Node-Red install. This flow is also set up for a string of 14 longmons. If you have more as I do, then you will need to edit some of the nodes to reflect this.

 

node-red influx configWe now need to configure a couple of nodes in Node-Red. The main configuration is pointing node-red influx flow to the database we created after we installed influxDB. In this tutorial we created a database called “batrium” and we know that the port for influx is 8086.

 

deploy and debugNow we need to Deploy the Node-Red flow and check the debug tab for any errors. If you see some “TypeErrors” then it is usually because the Binary-Parser was not installed correctly. Also, you can toggle the green msg.payload debug filters on and off to see the data being received in the debug window.

Step 6 – Configure Grafana

We now need to set up Grafana. In a nutshell, we need to do two things. First, add the influxdb data source. Secondly, import the Dashboard that Mr @Wolf has been nice enough to allow us to share. You can find a copy of the JSON file here.

Setup Data Source:

Import Dashboard:

grafana dashboardDepending on your battery type, amount of longmons, etc. you will need to play around with the visualization. If you have come this far I’ll let you figure out your ideal settings.

Step 7 – Configure Home Assistant

We are going to add the Grafana dashboard into Home Assistant using an embed from Grafana. Log back into your Grafana instance and locate the share button on your dashboard.

Find the Grafana Dashboard share/embed tab:

Use the link created in Grafana to create a new entity in HA. I also append the following to my link to ensure it opens in ‘fullscreen’ and ‘kiosk’ mode in HA. &kiosk&fullscreen 

If your dashboard does not show up in HA, read on below to fix.

Dashboard embed fix – From what I have found online, most users report that just enabling the ‘allow_embedding = true’ function sorted the issue. I had to allow anonymous logins also. But that is probably because I have not set up a user in Grafana for Home Assistant. Use the anonymous logins at your own risk.

Well it’s been emotional, thanks for sticking with me. If you find something wrong here let me know and I’ll fix it up asap. I hope it helps and again, thanks to the contributors.

Batrium in Home Assistant

Recognition

https://github.com/Bloats/Powerwall-stuff – Bloats for the original Flow

https://secondlifestorage.com/showthread.php?tid=8645&pid=59143 – Of course, the Second Life Storage Forum!

https://discourse.nodered.org/t/flow-to-decode-binary-data-and-a-walk-through-on-how-to-install-the-npm-module/5174 – Binary-Parser info

https://github.com/daromer2 – For his initial work with the UDP listener!

]]>
https://dirtyoptics.com/batrium-integration-with-home-assistant/feed/ 10
Home Assistant – Amazon Fire Tablet Kiosk https://dirtyoptics.com/home-assistant-amazon-fire-tablet-kiosk/ https://dirtyoptics.com/home-assistant-amazon-fire-tablet-kiosk/#comments Sat, 18 Jan 2020 08:21:03 +0000 https://dirtyoptics.com/?p=54570 The Home Assistant setup I have is pretty basic at the moment. The biggest problem  I have with the whole automation thing is accessibility. I want to be able to turn on or off automation without having to get my phone out. We use our phones enough, adding to it was something I want to try and avoid if I can. It was a pretty easy decision to try and set up a tablet in the most common area of our house. The idea for the tablet was to allow anyone to be able to control lights, security cameras, etc.

So what tablet did I go with?

amazon fire tablet 10 inchThe choice was pretty easy, the Amazon Fire HD tablets come in 7″, 8″ and 10″. If you do go investigate your own Amazon Fire tablet, pay particular attention to the generation of the tablet. Amazon has been able to produce a tablet at a reduced cost. The caveat to this is that it runs its own Fire OS (Operating System) which has a fair bit of advertising throughout. However, we will be bypassing a lot of these adverts, you will not even notice it’s on Fire OS by the time we are done with it. Check out the wiki here for a list of generations and the specs on each one.

amazon fire tablet generation list

The price of the tablet varies, obviously the newer the more expensive, however, we decided on the Fire HD 10, 5th generation. The price seemed right for the specs. To be honest, the tablet running Home Assistant doesn’t need a whole lot of resources. (Found one locally for $99)

The Mount

amazon fire tablet wall mountI could have gone in a few directions for the mount. I did think about using an articulated arm so that it could swing out and face the kitchen, however that would make it stick out from the wall. I wanted a very seamless/minimalist look when mounted on the wall. I ended up going down the magnet path as I figured it could be taken off the wall easily enough if it was to be used elsewhere. I did look around for a suitable tablet magnet and gave this one a try. Turns out to be brilliant and very sturdy. (I suggest cleaning all surfaces with rubbing alcohol prior to installation.)

tablet mounted on wallOn the wall side, it mounts directly to a Clipsal electrical wall plate. I did make up a small acrylic spacer to also attach to the wall plate. This would give it just a bit extra clearance for the USB angled connector.

Depending on how you want to power your device, I ended up using an old phone wall port and converting it to a mains powered USB port. (Note: Electrician may be required for this connection!) Usually, these kinds of  USB ports are jumped from a 240v outlet, however, I did not want this and got its own line run in the wall cavity.

Fully Kiosk Browser App

fully kioskfire apkThis is the bees-knees of kiosk apps. It looks simple but is very powerful. To get it installed, check out the website here first. Have a bit of a read. Hopefully, if you had a good read you will notice that they do a different APK (That’s the app executable/install file) for different operating systems. Grab yourself a copy of the “Fully Kiosk Browser APK (For Fire OS)” Using this method means you will not have to install google play onto your tablet, it also has some additional features that work only with the Amazon tablet.

I’m not going to explain how to sideload an APK onto an android device, there are plenty of tutorials already on the net, either google it or try this one.

Now that you have the app on your tablet:

When you first open the Fully Kiosk browser app, you will be asked to put in a URL to the page you want it to load. Insert your Home Assistant IP including the port number.

The next two settings work hand-in-hand with each other to provide a couple of benefits. That is the camera motion detection and the screensaver. The screensaver is set so that the tablet is never locked, and the motion detection by the camera is used to turn the screen saver off.

fully kiosk browser motion dectectionSet up motion detection. To set the screensaver, swipe the left side of the screen to reveal the “Fully Kiosk App” settings.

 

 

 

Fully Kiosk screensaverI suggest setting the screensaver up and making it use a black background. This effectively turns the screen off (kind of.) it will also stop any burn-in on the screen. Having the screensaver become active eliminates the chances of the tablet from locking. This then allows the motion detection to work without a user having to swipe through a lock screen. Also, the added benefit is that it stops us from having to view any advertising on the lock screen.

These are the main settings I am using on my tablet thus far, feel free to have a play around. I did end up purchasing a pro copy of the app so that I could mess around with all the settings. Some may not be available on the free version.

What now?

Start working on the home assistant UI to get the layout that works for you. The 10″ version can hold a lot more cards and is a bit easier to work with. Have a good think about what you use the most and have this on the first screen.

I also ended up using a right-angled USB connector to power the tablet from the wall. It took me a while to find the correct one (It’s not pictured.) I ended up using these from amazon. You get two in a pack and they allow you to go either way, left or right.

If you got this far, you are now where I am at. Happy hacking, and feel free to show me your tablet/wall mount builds!

Gallery

 

 

]]>
https://dirtyoptics.com/home-assistant-amazon-fire-tablet-kiosk/feed/ 2
What is Home Assistant? https://dirtyoptics.com/what-is-home-assistant/ https://dirtyoptics.com/what-is-home-assistant/#respond Tue, 12 Nov 2019 11:57:35 +0000 https://dirtyoptics.com/?p=54449 Home Assistant is an open-source home automation platform that is powered by a massive community of makers, tinkerers, and DIY enthusiasts. The software itself runs on numerous hardware and software platforms including the Raspberry Pi, Tinkerboard, Odroid, and Intel NUCs. You can even run the Home Assistant OS (HassOS) from inside a virtual machine if you wish. I run an Intel Nuc with multiple VM’s. One of which is the HassOS and to be honest I do not remember ever having to turn the VM on/off or reset. It has been solid as a rock! At first, I did install Home Assistant on the Raspberry Pi to test with but decided that I did not want another piece of hardware lying about and opted for the VM. I have not looked back since. For a full list of hardware and (VM Images), check out the HassOS installation section here.

So what were my first thoughts about Home Assistant? Well, the installation of HassOS on the hardware of choice is actually the easy part. The Learning Curve for configuration of the devices you want to add to Home Assistant was easily the most challenging. My aim for this post is to help you out a bit with the on-boarding. Here are my top tips for an easier onboarding experience to Home Assistant:

What are (Device) integrations?

Ok, so now that HassOS is installed we navigate around the software and easily start to get confused about what the heck we are meant to configure. If you head over to this webpage, you will be greeted by sheer volumes of possible devices and hardware that Home Assistant allows you to control. For example, your goal may be to use Home Assistant to Automate some lighting. Under the “Light” tab you will see 76 different integrations. Ranging from IKEA Tradfri smart bulbs through to the more common LifX and Phillips Hue integrations. These integrations pages are basically guides or configurations that you must follow to allow Home Assistant to control the devices.

What is YAML?

YAML stands for “Yet Another Markup Language”. It is a human-readable, data serialization language. It is commonly used for configuration files and yes, we use YAML for the configuration of our Integrations! In a nutshell, YAML is not a programming language, but a configuration language. It certainly is not hard to pick up and if I can manage to nut it out, then I’m sure you can too.YAML configuration exactly like above, be it a very simple example, the idea is the same throughout. Of note is the configuration.yaml document. The majority of all your integrations will end up inside this file, or similar .yaml files. YAML does follow a certain syntax, I would suggest having a read through the Home Assistant YAML page prior to diving in.

What are Entities?

Each individual device you add to Home Assistant via an Integration and Entity ID. (Yes, every single item, device, switch and automation, even non-physical items can have entities!) When you first install HassOS and run it, you may find that some devices are automatically found on your network are assigned an entity. As long as you remember that an entity represents a particular device then you cannot go wrong. For example, you may have 15 Phillips Hue Globes on the network, (Via a Bridge) each globe will have its own entity. It is this entity that defines the particular device. example “light.lounge” represents the Phillips Hue light in the lounge and you will need to reference that in your configuration integration.

Love Lace UI

You will hear the term ‘Love Lace UI” thrown around the forums and web a fair bit. This User Interface is somewhat newish to Home Assistant and is the main user interface that we see on the startup of Home Assistant. Everything we do generally speaking is via the Love Lace UI. A Demo of the Love Lace Ui can be found here.

The User Interface is made up of a few components:

  • Cards – These are a bit like tiles that can be laid out in the UI to display different information. HA has 24 predefined cards. The HA community, however, has many more. I use cards to display switches which I can tap to turn lights on and off. I also use cards to show the current weather forecast and check the temperatures around the house. One card even lets me view the IP CCTV cameras I have around the house.
  • Customization – The customization section allows you to change the layout of the cards to suit the view you want. You can add tabs and change the layout as you see fit. If you decide to run the Love Lace UI on a tablet, then you may need to customize the look and feel.

Well, I hope I have not scared you off or bored you to death, but these are the things I wish were explained to me a bit better before getting stuck into Home Assistant. Stay tuned for more on Home Assistant!

]]>
https://dirtyoptics.com/what-is-home-assistant/feed/ 0