Friday, 13 January 2017

Hive Home OpenHAB2

display hive home temperatures in OpenHAB2
I started on a crude PHP class to return Hive current temperature and setpoint to OpenHAB2

Make sure PHP>=5.6 is installed and working, along with CURL and SSL certificates

I had to configure php.ini to add the line:
then download the and save to above store.
If on windows, then replace with something like
see stack exchange

then in your /conf/script directory, store the script and class
git clone
cd /opt/openhab2/conf/scripts
chown openhab:openhab HiveHomeAPI-PHP
cd HiveHomeAPI-PHP
chown openhab:openhab

then create a new php script for, e.g current temperature in your /conf/scripts/HiveHomeAPI-PHP directory,
nano currenttemp.php
/*example code - replace your credentials below with your hivehome details*/
include ("class.hivehome.php");
$hive = new HiveHome("hiveusername", "hivepw");
print $hive->getCurrentTemperature()."\n";
//print "Target Temp: ".$hive->getCurrentTemperature()."\n";
set ownership and permissions
sudo chown openhab:openhab currenttemp.php
sudo chmod +x currenttemp.php

then create a new Item in your /conf/items

Number Temperature_Hive "Temperature [%.1f °C]" <temperature> (gHiveTemps1) [ "CurrentTemperature" ] {exec="<[php /opt/openhab2/conf/scripts/HiveHomeAPI-PHP/currenttemp.php:60000:REGEX((.*?))]"}

then add it to your sitemap.

No comments:

Post a Comment