I recently installed Home Assistant on a spare Raspberry Pi to play a bit with it and see what this system could offer. Once I got it running and configured it to control a couple of lights I started wondering if and how Home Assistant could be integrated with PiHome. After doing some researches I decided to give it a try, and by the end of the day everything was up and running!

The idea of this implementation is to leave PiHome handle all the heat system’s logic while being able to monitor the status of the system and trigger the boost function from Home Assistant.

The starting point for the integration is to have both Home Assistant and PiHome up and running. The examples illustrated below have PiHome running on a Raspberry Pi with IP address of 192.168.1.2 and setup with two zones called respectively “Living Room” and “Bedroom”. The Home Assistant configuration will need to be adjusted based on the actual name of your zones and with the correct IP address of your PiHome Raspberry Pi.

Update PiHome

To get started first of all update your PiHome software to latest version from Github. Login into your PiHome Raspberry Pi and issue following commands:

Go to /var/www/api/ and check that you have the following files:

Check PiHome’s setup

Before proceeding with the Home Assistant configuration let’s do a few checks to ensure the PiHome APIs are working correctly.

1. Open a browser and go to http://192.168.1.2/api/getBoiler.php (replace 192.1.168.1.2 with the IP address of your Raspberry Pi running PiHome). You should get a response like the following:

State should return the current status of your boiler (ON or OFF).

2. In the browser go to http://192.168.1.2/api/getZoneStatus.php?zonename=Living%20Room (replace 192.1.168.1.2 with the IP address of your Raspberry Pi running PiHome and “Living%20Room” with the name of one of your zones). You should get a response like the following:

Status should return the current status of the zone (0 >> OFF and 1 >> ON), temp the current temperature of the zone, datetime the date and time of the last temperature update for the zone, bat_voltage the battery voltage of the zone’s temperature sensor and bat_level the battery level of the zone’s temperature sensor (in percentage).

3. In the browser go to http://192.168.1.2/api/boostSet.php?zonename=Living%20Room&state=1 (replace 192.1.168.1.2 with the IP address of your Raspberry Pi running PiHome and “Living%20Room” with the name of one of your zones). The boost function for the “Living Room” zone should activate.

4. In the browser go to http://192.168.1.2/api/boostSet.php?zonename=Living%20Room&state=0 (replace 192.1.168.1.2 with the IP address of your Raspberry Pi running PiHome and “Living%20Room” with the name of one of your zones). The boost function for the “Living Room” zone should deactivate.

If everything in the checks above worked as expected you are ready to continue with the Home Assistant configuration.

Home Assistant configuration

To create the Home Assistant entities needed to monitor and control PiHome the configuration.yaml file needs to be edit.

To control the PiHome boost function a switch entity needs to be created in Home Assistant for each zone. The command_line platform will be used together with the curl command to call the boostSet.php API. The example below shows the lines that need to be added to the configuration.yaml file to setup the switch entities for two zones. Replace 192.1.168.1.2 with the IP address of your Raspberry Pi running PiHome. While “Living%20Room” and “Bedroom” should be replaced with the actual names of your zones in PiHome. Additional zones can be added in the same way.

Sensor entities need to be created in Home Assistant to monitor the status of the boiler and of the zones. The rest platform will be used to call the getBoiler.php and the getZoneStatus.php APIs.

To monitor the status of the boiler a simple binary_sensor entity is needed. While for zones templates will be needed to create sensor entities for the zone’s status, temperature, battery voltage and battery level. The example below shows the lines that need to be added to the configuration.yaml file to setup the sensor entities for two zones. Replace 192.1.168.1.2 with the IP address of your Raspberry Pi running PiHome. While “Living%20Room” and “Bedroom” should be replaced with the actual names of your zones in PiHome. Additional zones can be added in the same way.

Save the changes made to the configuration.yaml file and restart Home Assistant. Once Home assistant has been restarted navigate to Configuration > Entities and you should be able to see the entities created.

PiHome Home Assistant Configuration

PiHome Home Assistant Configuration

Using the Home Assistant entities
The entities created can now be used to create dashboards to monitor the status of the heating system and trigger the boost function of each zone. The following entities will be available:

  • – Boiler Status (binary sensor)
  • – Zone Boost (switch)
  • – Zone Status (binary sensor)
  • – Zone Temperature (sensor)
  • – Zone Sensor Battery Level (sensor)
  • – Zone Sensor Battery Voltage (sensor)

Below are some examples of the dashboard cards that can be created with these entities.

1. Zone boost switches to activate the boost function for each zone

PiHome Home Assistant Zone boost switches

PiHome Home Assistant Zone boost switches

2. Zone temperature gauges and charts

PiHome Home Assistant Zone Temperature gauges and charts

PiHome Home Assistant Zone Temperature gauges and charts

3. Sensors’ battery info

PiHome Home Assistant Sensors Info

PiHome Home Assistant Sensors Info

4. Boiler status, Zone status and Zone Boost history graph

PiHome Home Assistant Zone

PiHome Home Assistant Zone

Once created the dashboards will of course be available also in the Home Assistant Companion Apps for iOS and Android.

Home Assistant Companion Apps for iOS and Android

Home Assistant Companion Apps for iOS and Android

Home Assistant Companion Apps for iOS and Android

Home Assistant Companion Apps for iOS and Android

Possible applications

Several applications are possible once PiHome statuses and booster triggers are available in Home Assistant. Automations can be created using the temperature sensors as inputs and/or to trigger the PiHome boost function. E.g. turn on the boost for a certain zone when your phone with the Home Assistant Companion App leaves your workplace.

In addition, the PiHome sensors and boost switches will be available to all Home Assistant integrations. For example, with the HomeKit integration for Home Assistant the PiHome sensors and booster switches will be automatically pushed to the HomeKit app on your iOS phone. This will allow you to control PiHome using Siri without the need of installing Homebridge.
With the Google Assistant SDK add-on for Home Assistant you should be able to control PiHome directly from a microphone and speakers connected to your Home Assistant device. Integration with Alexa should also be possible.

Thank you https://github.com/JSa1987 for sharing this with community