logo smart home family kruse

Kruse Smart Home

Easy living in our smart home & Garden

How to control Homeseer devices with Homey?

Control Homeseer devices with Homey

12 February 2022


1. Introduction

Before explaining how to control Homeseer devices with Homey first some background why we use both Homeseer and Homey to automate our house and garden.

Back in 2007 we bought the domotica software Homeseer to make our first steps in automating our home and garden. Homeseer currently monitors and controls most of our devices as the software is very flexible with a lot of functionality.

Unfortunately it can also be complicated to to setup devices and automate them for people not experienced in the IT world, for example writing scripts. As members of our family also want to automate devices we bought in 2020 a Homey Pro as being a more user friendly home automation hub and still keeping Homeseer for the more advanced home and garden automation.

Unfortunately not all devices connected to Homeseer can be controlled via the Homey Pro. For example our garden irrigation is automated with an OpenSprinkler controller, which is also connected to Homeseer. But for Homey there is currently no app to interface with the OpenSprinkler device.  And we have many Z-Wave protocol based devices connected to Homeseer, which would require a lot of effort to connect them to Homey Pro and get to the same level of home and garden automation.

Fortunately it is possible to control Homeseer devices with Homey Pro via Homey Flows by using urls to control Homeseer devices and fetch their statuses.

2. Requirements to control Homeseer devices with Homey

2.1 Devices & software

The following devices and software are required:

  • Homey Pro
  • Homeseer v3 (should also work with v4)

2.2 Homey apps

The following Homey App must be installed on your Athom Homey:

3. JSON to interface with Homeseer

JSON (JavaScript Object Notation) is a text based data-interchange format that is completely computer language independent. It’s development started in the early 2000s and has nowadays diverse uses in electronic data interchange, including that of web applications with servers.

JSON is an open standard file format and data interchange format that uses human readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other serializable values). JSON is easy to read and write for humans and it is easy for computers to parse and generate.  It is a computer language independent data format for which many modern programming languages include code to generate and parse JSON-format data. JSON filenames use the file extension .json. For more information see Wikipedia.

HomeSeer devices can be controlled using JSON formatted data.  For Homeseer 3 the relevant information can be found in the HS3 Plug-in SDK (system development kit). For Homeseer v4 the JSON information is available in the JSON API documentation in the HS4-plugin SDK.

4. Configure Homeseer for remote control with JSON

Before we can control Homeseer devices with Homey we need to make sure Homeseer is configured to accept remote JSON commands. Go to your Homeseer website and select the menu option Tools | Setup.

Select the tab Network.

Make sure “Enable control using JSON” is enabled.

Test if the remote control of Homeseer via JSON is working by entering the following URL in a internet browser:

http://<HOMESEER SYSTEM IP>/json?request=getsessionconfig

This should show similar output in the browser as:

5. Switching a Homeseer device on and off

As an example how to control Homeseer devices with Homey, we take a Greenwave Powernode power strip (unfortunately not available anymore), which is a Z-Wave device. Each power connector of the power strip can be controlled individually. In our example we want to create a Homey Flow to toggle the power on/off for our Denon AVR, which is connected to one of the six available power outlets of the PowerNode.

For people questioning themselves why we switch off our Denon amplifier completely instead of putting it in standby… Sometimes it was left on quietly for days consuming around 100 Watt/hour. So when we go to bed we tell this Google Home and all not required devices are switched off, including the Denon Amplifier. Saving some energy at the end.

Before we can setup the Homey Flow we need to construct the URL to control the power socket. The URL syntax when Homeseer and Homey Pro are both part of the same home network IP range (for example 192.0.168.xxx) is:

http://<HOMESEER SYSTEM IP>/JSON?request=controldevicebylabel&ref=<DEVICE ID>&label=<ON|OFF>

If this is not the case the user credentials needs to be part of the URL:

http://<HOMESEER SYSTEM IP>/JSON?user=<HOMESEER USER ID>&pass=<HOMESEER USER PASSWORD>&request=controldevicebylabel&ref=<DEVICE ID>&label=<ON|OFF>

The following is required to build a working URL when Homeseer and Homey Pro are part of the same network:

  • the Homeseer server IP address;
  • the Homeseer device ID of the device to control.

5.1 Get the Homeseer server IP address

This is the IP address how you normally access the Homeseer server.

5.2 Find the Homeseer device ID

Within the Homeseer device management page (View – Device Management) we lookup the device Greenwave Powernode device we want to control from a Homey Flow. The image below shows the Greenwave Powernode device and it’s six power sockets. We are interested in the last one (stekkerdoos is Dutch for a power strip).

Click on the device link to open the properties page and select the Advanced tab.

On the Advanced screen the Homeseer device ID is listed.

This number will be used in the highlighted part in the URL:

http://<HOMESEER SYSTEM IP>/JSON?request=controldevicebylabel&ref=<DEVICE ID>&label=<ON|OFF>

5.3 Build and test the URL

Add the collected information to the URL for switching the device on. It will look similar as:

For switching the device off replace ON by OFF.

Note: if the Homeseer IP port is not 80, but for example 88, the URL will look like…

Test the URLs; the device should go on or off based on the URL used in the internet browser. If successful the browser will show the properties of the device in JSON format. If not it will show an error message such as for example:

{ “Response”:”Error, controlling device” }

6. Create a virtual device

We create a virtual switch, which will be used to switch the power outlet of the Homeseer device on/off via a Homey Flow.

Virtual devices can only be created if the Homey App Virtual Devices has been installed. Add a new device to Homey and select “Virtual Devices”. On the screen shown select “Device”. On the next screen click “Connect”. Enter a device name and click on Next. From the icons shown select the one resembling a switch. On the “Device Class” screen select “Socket”. On next screen select only the capability “ON/OFF”. The virtual device has been created.

7. Creating the Homey Flow

As an example how to control Homeseer devices with Homey, we create a virtual switch in Homey to represent the power outlet of the power strip providing power to our Denon AVR. This virtual switch on/off is used as trigger for the Homey Flow we are going to create.

The Homey Flow will perform the following actions:

IF the virtual switch is pressed AND the Denon AVR is on
THEN switch the Homeseer device for the power outlet on AND
select the correct Denon AVR input source after 5 seconds delay
ELSE switch the Homeseer device for the power outlet off

The Homey Flow created is shown below. Each step is explained in more detail later.

Step details:

  1. The virtual device used to switch the power outlet on/off.
  2. As the virtual device has no card to specific indicate if it has been set to on or off, we use the Denon AVR device status indicating if it is turned on or off.
  3. If the virtual switch has changed it’s position and the Denon AVR is turned on, the power outlet is switched off by sending the URL to homeseer instructing to do so. Here the internal Homey Pro functionality was used under System – Logic – Make a HTTP request.
  4. After 5 seconds the input source is set on DVD, which in our situation is connected to a Google Chromecast Ultra. 5 seconds to give the Denon amplifier some time to be ready.
    See How to add a execution delay for a Homey Flow action card?
  5. If the amplifier is on, switch the power outlet off.
    See Using Or and Else in Flows

8. Finally

This article should provide a good basis how to control Homeseer devices with Homey. It is also possible to fetch Homeseer device statuses, start Homeseer events etc.

Article by <a href="https://smarthome.familykruse.eu/author/iamjwk/" target="_self">Jan-Willem</a>

Article by Jan-Willem


Writen by the website owner


Submit a Comment

Your email address will not be published. Required fields are marked *