I recently installed Home Assistant on a spare Raspberry Pi to explore its capabilities and see what it could offer. After getting it up and running and configuring it to control a couple of lights, I began to wonder if, and how, Home Assistant could be integrated with PiHome. After some research, I decided to give it a try, and by the end of the day, everything was up and running smoothly!

The goal of this integration is to let PiHome manage the heating system’s logic while enabling Home Assistant to monitor the system’s status and trigger the boost function when needed.

To begin the integration, both Home Assistant and PiHome need to be operational. For the examples provided below, PiHome is running on a Raspberry Pi with the IP address 192.168.1.2, and it’s set up with two zones: “Living Room” and “Bedroom.” When configuring Home Assistant, make sure to update the settings with the correct names of your zones and the IP address of your PiHome Raspberry Pi.

Update PiHome

To get started, the first step is to update your PiHome software to the latest version from GitHub. To do this, log in to your PiHome Raspberry Pi and run the 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:

The status should return the current state of the zone:

  • 0 for OFF
  • 1 for ON

The temp field shows the current temperature of the zone.
The datetime field displays the date and time of the last temperature update for the zone.
The bat_voltage represents the battery voltage of the zone’s temperature sensor.
The bat_level indicates the battery level of the zone’s temperature sensor (in percentage).

3. Activating the Boost Function

In your browser, navigate to the following URL to activate the boost function for the “Living Room” zone:
http://192.168.1.2/api/boostSet.php?zonename=Living%20Room&state=1
(Replace 192.168.1.2 with the actual 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. Deactivating the Boost Function

To deactivate the boost function for the “Living Room” zone, go to:
http://192.168.1.2/api/boostSet.php?zonename=Living%20Room&state=0
(Again, replace 192.168.1.2 with your Raspberry Pi’s IP address and “Living%20Room” with your desired zone name).
The boost function for the “Living Room” zone should deactivate.

If everything works as expected in the above steps, you are now ready to proceed with the Home Assistant configuration.

Home Assistant configuration

o create the Home Assistant entities needed to monitor and control PiHome, you’ll need to edit the configuration.yaml file.

Creating Switch Entities for PiHome Boost Function

To control the PiHome boost function, you must create a switch entity for each zone in Home Assistant. This will use the command_line platform along with the curl command to call the boostSet.php API.

Below is an example of how to add the necessary lines to the configuration.yaml file to set up switch entities for two zones:

Key Notes:

  • Replace 192.168.1.2 with the IP address of your Raspberry Pi running PiHome.
  • Replace "Living%20Room" and "Bedroom" with the actual names of your zones in PiHome.
  • You can add more zones by following the same structure for each additional zone.

Once you’ve updated the configuration.yaml file, restart Home Assistant to apply the changes.

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