Hooking up the UVR1611 Data Logger over Wifi

So I went to look around in the internet to find a tool that would help me hook my freely programmable UVR1611 heating controller up to Home Assistant. It is connected to the internet over a BL-NET device and the only library I found that works with the UVR1611 over Wifi and not only directly connected to the current computer is UVR1611 Data Logger Pro. So I based a sensor on this awesome tool that I’d like to share with you.

( I originally wanted to share my tool here completely [with links and images and stuff] but as I’m disallowed to post more than 1 image and two links the complete tutorial can be found here: http://nielstron.de/home-assistant/?us=uvr1611 )

It uses the UVR1611 Data Logger Pro as library for access to the BL-NET (or a CMI, but I don’t yet know if the data provided by the CMI works with my script, you could try this out and post your result!). Therefore you need to set it up on a machine in your network (for me it’s the raspberry pi on which home assistant is running, so yes that works too). Detailed instructions on how to do that can be found at Github (link missing…).
If you are feel like tinkering you can actually only include the /lib and /config folder in your installation and set up only php and webhosting related tools (lighttpd), so skip the database setup (config.ini should be correctly set up, but omit the database part). This way you save space but also miss the cool UVR1611 Data Logger Pro page…

( I originally wanted to share my tool here completely [with links and images and stuff] but as I’m disallowed to post more than 2 images and one link the complete tutorial can be found here: http://nielstron.de/home-assistant/?us=uvr1611 )

Now add a php script to the base directory of the UVR1611 Data Logger Pro installation. This is where index.php, install.php and editChart.php lie (together with many others). The PHP file you should put there ist uvr1611.php:

Download uvr1611.php.txt (link missing…)

Now you’ll want to assign each sensor of your UVR1611 an own friendly name (for example analog sensor 1 measures the current temperature of the reservoir so you’d want it to show as ‘temperature reservoir’). To do so edit uvr1611.php.txt and scroll to the part that is similar to the code below. Change or add the strings on the right side to fitting names for your device (you should now the correct names from your installation, if not try reading them from the website hosted by your BL-NET / CMI )

//collect friendly names / meanings 
//Add your names here, examples are already filled in
$friendly_names = array(
		'analog1' 	=> "",
		'analog2' 	=> "Temperatur Speicher oben",
		'analog3' 	=> "Temperatur Speicher unten",
		'analog4' 	=> "Temperatur Heizkr Vorlauf",
		'analog5' 	=> "Temperatur Außen",
		'analog6' 	=> "Temperatur Raum",
		'analog7' 	=> "",
		'analog8' 	=> "",
		'analog9' 	=> "",
		'analog10' 	=> "",
		'analog11' 	=> "",
		'analog12' 	=> "",
		'analog13' 	=> "",
		'analog14' 	=> "",
		'analog15' 	=> "",
		'analog16' 	=> "",
		'digital1' 	=> "",
		'digital2' 	=> "Pumpe Heizkr",
		'digital3' 	=> "",
		'digital4' 	=> "zu",
		'digital5' 	=> "Anf. Kessel",
		'digital6' 	=> "r",
		'digital7' 	=> "",
		'digital8' 	=> "",
		'digital9' 	=> "",
		'digital10' 	=> "Warmwasser Pumpe",
		'digital11' 	=> "",
		'digital12' 	=> "",
		'digital13' 	=> "",
		'digital14' 	=> "",
		'digital15' 	=> "",
		'digital16' 	=> "",
		'speed1'	=> "",
		'speed2'	=> "",
		'speed3'	=> "",
		'speed4'	=> "",
		'energy1'	=> "",
		'energy2'	=> "",
		'power1'	=> "",
		'power2'	=> "",
		'current_energy1' => "",
		'current_energy2' => "",
);

Set? Okay the get ready for the final steps. The page you just added prints out all available data as JSON when called. Now we set up a sensor in home assistant that reads the data and presents it correctly. I wrote a custom component for this, based on the JSONRest module by mad_ady (link missing…).

Copy the text here (link missing…) into a file called uvr1611.py and place it in the custom component folder of you home assistant installation as sensor. (normal file path: your home assistants home directory -> ./custom_component/sensor)

Now you only have to set up the uvr1611 sensor in your configurations.yaml like this:

   -sensor    
      # UVR1611 Data
      - platform: uvr1611
        resource: http://UVR1611_DATA_LOGGER_PRO_INSTALLATION_IP/FILE_PATH/uvr1611.php

for me this was

   -sensor    
      # UVR1611 Data
      - platform: uvr1611
        resource: http://localhost/uvr1611/uvr1611.php
        scan_interval: 180

The result can be seen at the top :wink: