Drayton Wiser heating control

Published: | by Julian Knight Reading time ~7 min.
📖 Kb | 📎 Development, Internet of Things (IoT) | 🔖 Node-RED, Internet of Things, IoT, Heating, Home Automation

Drayton are a very widely used manufacturer of heating controls. They make the “Wiser” control system which is low cost and easily fitted. This article shows you how to use Node-RED to query and control the system.

Drayton’s Wiser smart heating controller is a low-cost system for controlling boilers and radiators. Note that Drayton is part of Schneider-Electric

It has the lowest cost thermostatic radiator valves (TRV’s, smart radiator controls) of any of the smart home systems - around half the price of other systems. The control unit is also low-cost.

It also has the advantage of not requiring the Internet or the Drayton cloud servers for the system to keep running so you are not dependent on Drayton keeping the Wiser cloud service active. This was a really important point for me when choosing a smart heating controller since it is all too easy to end up with a “brick” instead of a working system.

However, the disadvantage of the Wiser system is that it isn’t as sophisticated as some others and clearly Drayton don’t have the resources to rapidly develop it as some other manufacturers have (such as Honeywell for example).

Of course, if you are reading this, you are probably already somewhat knowledgeable about home automation. You may also be aware of Node-RED which is a tool well suited for creating custom home automation systems with a minimum of knowledge and little to no coding required.

We can easily use Node-RED to help get information from the Wiser system and even use it to add smarter controls such as connecting to other sensors or to other systems and services.

At the end of this article is some code that you can import into your own Node-RED service and start working with the Wiser system straight away.

Connecting to your controller πŸ”—︎

You will need to get a couple of pieces of information before you can start working with your Wiser system and Node-RED.

Once you have this information, you can configure the example Node-RED flow at the end of this article and you should be able to query information and override some settings at will. Once you have mastered the basics, you will be able to do pretty much anything you want to using the power of Node-RED.

IP Address πŸ”—︎

When your Wiser system connects to your home Wi-Fi, it will be given an IP address and we need to know that before we can talk to it. There is no really easy way to do this. The address will generally be set by your Internet router (or Wi-Fi access point) so you should start by checking your router’s web interface for “DHCP”. Hopefully you will see a list of assigned DHCP IP addresses, the Wiser controller is likely to be the highest number if you have just connected it.

You should configure your router to give the controller a fixed IP address otherwise it may change if the router is restarted.

System Secret πŸ”—︎

In order to interface with the controller, you need to know a very long string of random characters that is its system secret.

You can get the system secret by doing the following (reference):-

  1. Press the setup button on your HeatHub, the light will start flashing

  2. Look for the Wi-Fi network (SSID) called ‘WiserHeatXXX’ where XXX is random

  3. Connect to the network from a Windows PC

  4. Once connected run the following command in PowerShell

    Invoke-RestMethod -Method Get -UseBasicParsing -UriΒ http://192.168.8.1/secret/

    If you are using a different type of operating system, you will need a tool that will return data from a web query.

  5. This will return a string which is your system secret

  6. Press the setup button on the HeatHub again and it will go back to normal operations

  7. Copy the secret and save it somewhere.

Node-RED flow to configure IP address and System Secret πŸ”—︎

To save having to repeatedly enter the IP address and system secret into your flows, use the following flow to put them into memory. The query and control example flows will use this later on. This flow will run automatically every time you start Node-RED.

Don’t forget to change the change node (the 2nd node in this flow) to the information you obtained above.

Example Wiser Configuration Flow

[{"id":"738ed75a.9b0dc8","type":"inject","z":"fb0c842.c87fc78","name":"Save controller configuration for Wiser",
"topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":230,"y":460,
"wires":[["d34f3b88.6b3008"]]},{"id":"d34f3b88.6b3008","type":"change","z":"fb0c842.c87fc78",
"name":"Set Wiser Variables (Secret and Host)","rules":[{"t":"set","p":"wiserSecret","pt":"flow",
"to":"<Change_this_to_your_systems_secret_string>","tot":"str"},{"t":"set","p":"wiserHost","pt":"flow","to":"<your_controllers_ip_address>",
"tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":460,"wires":[[]]}]

Copy the code in the black box and use the “Import” menu in Node-RED.

Controlling the system πŸ”—︎

The following sections contain basic information about how to control the Wiser system.

Don’t forget that the system may be controlled by other applications (like the mobile app) or services such as Google Home or Amazon Alexa integrations.

Note that you do not need the Internet for this at all. You only need your local network. All of this will work even if your Internet connection is down or the Wiser cloud service stops working.

Each entry below has a “path” such as ‘/data/domain/System/RequestOverride’ and some text or JSON in a grey box. In the example flows, the information in the grey box goes into the payload property (msg.payload) and the the path goes into the path property (msg.path). These property values are then used by the flow and sent to the controller. These property values are set in the node that follows the inject node, they are the second node in each flow, they are called “change” nodes.

Room ID’s πŸ”—︎

The Wiser system mainly works by controlling “rooms”. In the mobile app, these are all named and you can find the names in the data you can query as well. However, in order to control the system from Node-RED or any other home automation system, we need to know the ID of the room.

Wherever you see <roomNumber> in the information below, this is the ID not the offset in the /data/domain/Room array.

Temperature values πŸ”—︎

The values use to control and query temperatures are multiplied by 10. So 200 equals 20.0Β°C, 195 equals 19.5Β°C. Note that the value will be rounded to the nearest Β½ a degree by the controller.

Set or cancel an override of the thermostatic temperature for a Room πŸ”—︎

Path: /data/domain/Room/<roomNumber>

Payload: {"RequestOverride":{"Type":"Manual","SetPoint":195}}

This will be permanent until something else changes the setting.

Set/cancel Boost for a Room πŸ”—︎

/data/domain/Room/<roomNumber>

{"RequestOverride":{"Type":"Manual","DurationMinutes": 30, "SetPoint":200, "Originator":"App"}}

{"RequestOverride":{"Type":"None","DurationMinutes": 0, "SetPoint":0, "Originator":"App"}}

Note: Duration is in minutes. The returned info includes a OverrideTimeoutUnixTime property, to convert this to a real time, you can use the Unix timestamp converter website.

Set/Cancel Manual mode for a room πŸ”—︎

/data/domain/Room/<roomNumber>

{"Mode":"Manual"} or {"Mode":"Auto"}

Set/Cancel window state detection for a room πŸ”—︎

/data/domain/Room/<roomNumber>/WindowDetectionActive

true or false

Set/cancel Away Mode πŸ”—︎

/data/domain/System/RequestOverride

{"type":2,"setPoint":100}

{"type":0,"setPoint":0}

Note: Sets the min temperature to 10Β°C

Also note that you should cancel manual overrides for all rooms.

References πŸ”—︎

Much of the above was gleaned from the following reference code.

Example control and query code πŸ”—︎

Copy the code and import it into Node-RED. You will need the configuration flow as well.

The configuration flow sets the flow variables flow.wiserHost and flow.wiserSecret.

Query the current settings πŸ”—︎

Query everything or query a single room πŸ”—︎

The top inject will return everything that the controller can tell us. It is useful in helping understand what data is available and how it is structured. The bottom inject queries a single room, change the room ID in the first change node.

[{"id":"3822a01a.859ea","type":"inject","z":"fb0c842.c87fc78","name":"","topic":"Wiser QUERY","payload":"","payloadType":"str",
"repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":620,"wires":[["2dfd4a60.601b06"]]},{"id":"fcb37ac1.cb36f8",
"type":"http request","z":"fb0c842.c87fc78","name":"","method":"use","ret":"obj","url":"","tls":"","x":770,"y":620,
"wires":[["c21166d6.4784c8"]]},{"id":"c21166d6.4784c8","type":"debug","z":"fb0c842.c87fc78","name":"","active":true,
"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":950,"y":620,"wires":[]},{"id":"a9652fa4.60f24",
"type":"change","z":"fb0c842.c87fc78","name":"","rules":[{"t":"set","p":"method","pt":"msg","to":"GET","tot":"str"},
{"t":"set","p":"url","pt":"msg","to":"\"http://\" & $flowContext('wiserHost') & $.path","tot":"jsonata"},{"t":"set",
"p":"headers","pt":"msg","to":"{\t    \"SECRET\": $flowContext('wiserSecret'),\t    \"HOST\": $flowContext('wiserHost') & \":80\"\t}",
"tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":620,"wires":[["fcb37ac1.cb36f8"]]},
{"id":"2dfd4a60.601b06","type":"change","z":"fb0c842.c87fc78","name":"","rules":[{"t":"set","p":"path","pt":"msg",
"to":"/data/domain/","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":620,
"wires":[["a9652fa4.60f24"]]},{"id":"9b02c89.7609c38","type":"inject","z":"fb0c842.c87fc78","name":"",
"topic":"Wiser QUERY Room","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,
"x":180,"y":680,"wires":[["38d8c719.5ae978"]]},{"id":"38d8c719.5ae978","type":"change","z":"fb0c842.c87fc78","name":"",
"rules":[{"t":"set","p":"path","pt":"msg","to":"/data/domain/Room/6","tot":"str"}],"action":"","property":"","from":"",
"to":"","reg":false,"x":370,"y":680,"wires":[["a9652fa4.60f24"]]}]

Get a simplified view of all of the rooms πŸ”—︎

This flow queries the ‘/data/domain/Room/’ path and then simplifies the output using JSONata

[{"id":"c8566325.8a07b","type":"inject","z":"fb0c842.c87fc78","name":"","topic":"Start Query","payload":"",
"payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":800,"wires":[["82a69e2d.bd5a1"]]},
{"id":"a3f3790.4883288","type":"http request","z":"fb0c842.c87fc78","name":"","method":"use","ret":"obj",
"url":"","tls":"","x":630,"y":800,"wires":[["2887038d.8bd21c"]]},{"id":"55b4a3e7.8eb21c","type":"debug",
"z":"fb0c842.c87fc78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload",
"x":950,"y":800,"wires":[]},{"id":"a8da7133.b0ced","type":"change","z":"fb0c842.c87fc78","name":"","rules":[{"t":"set",
"p":"method","pt":"msg","to":"GET","tot":"str"},{"t":"set","p":"url","pt":"msg","to":"\"http://\" & $flowContext('wiserHost') & $.path",
"tot":"jsonata"},{"t":"set","p":"headers","pt":"msg",
"to":"{\t    \"SECRET\": $flowContext('wiserSecret'),\t    \"HOST\": $flowContext('wiserHost') & \":80\"\t}",
"tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":800,"wires":[["a3f3790.4883288"]]},
{"id":"82a69e2d.bd5a1","type":"change","z":"fb0c842.c87fc78","name":"","rules":[{"t":"set","p":"path","pt":"msg",
"to":"/data/domain/Room","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":289,"y":800,
"wires":[["a8da7133.b0ced"]]},{"id":"5d6dc6ef.f8cae8","type":"comment","z":"fb0c842.c87fc78",
"name":"Get basic room info for all rooms","info":"","x":190,"y":760,"wires":[]},{"id":"2887038d.8bd21c",
"type":"change","z":"fb0c842.c87fc78","name":"trim output","rules":[{"t":"set","p":"payload","pt":"msg",
"to":"payload{ \t    $.Name : {\t        \"id\": $.id,\t        \"Name\": $.Name,\t        \"CurrentTemperature\": $.CalculatedTemperature/10,\t        \"DesiredTemperature\": $.CurrentSetPoint/10,\t        \"Override\": $.OverrideType?\"Yes\":\"No\",\t        \"OverrideTimeout\": $.OverrideType?$split($split($fromMillis($.OverrideTimeoutUnixTime),\"T\")[1],\".\")[0]:\"N/A\"\t    }\t}\t",
"tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":800,"wires":[["55b4a3e7.8eb21c"]]}]

The output looks like:

{
  "Bedroom 2": {
    "id": 5,
    "Name": "Bedroom 2",
    "CurrentTemperature": 19.2,
    "DesiredTemperature": 12.5,
    "Override": "No",
    "OverrideTimeout": "N/A"
  },
  "Master Bedroom": {
    "id": 6,
    "Name": "Master Bedroom",
    "CurrentTemperature": 19.2,
    "DesiredTemperature": 12.5,
    "Override": "Yes",
    "OverrideTimeout": "18:09:42"
  }
}

Control the system πŸ”—︎

These flows show you how to make changes to the controller from Node-RED.

Boost the temperature in a room for 30 minutes πŸ”—︎

Applies a 30 minute boost to 18.5Β°C for room id 1.

[{"id":"9d700a39.ebbaa8","type":"http request","z":"fb0c842.c87fc78","name":"","method":"use","ret":"obj","url":"",
"tls":"","x":770,"y":560,"wires":[["58845d6d.bf2a24"]]},{"id":"32c33bee.cf6c24","type":"inject","z":"fb0c842.c87fc78",
"name":"Wiser SET","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,
"x":140,"y":560,"wires":[["855deb47.8df6f8"]]},{"id":"58845d6d.bf2a24","type":"debug","z":"fb0c842.c87fc78",
"name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":930,"y":560,
"wires":[]},{"id":"6ec2a88e.839598","type":"change","z":"fb0c842.c87fc78","name":"","rules":[{"t":"set","p":"method",
"pt":"msg","to":"PATCH","tot":"str"},{"t":"set","p":"url","pt":"msg",
"to":"\"http://\" & $flowContext('wiserHost') & $.path","tot":"jsonata"},{"t":"set","p":"headers","pt":"msg",
"to":"{\t    \"SECRET\": $flowContext('wiserSecret'),\t    \"HOST\": $flowContext('wiserHost') & \":80\"\t}",
"tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":560,"wires":[["9d700a39.ebbaa8"]]},
{"id":"855deb47.8df6f8","type":"change","z":"fb0c842.c87fc78","name":"","rules":[{"t":"set","p":"payload","pt":"msg",
"to":"{\"RequestOverride\":{\"Type\":\"Manual\",\"Originator\":\"App\",\"DurationMinutes\":30,\"SetPoint\":185}}",
"tot":"json"},{"t":"set","p":"path","pt":"msg","to":"/data/domain/Room/1","tot":"str"}],"action":"","property":"",
"from":"","to":"","reg":false,"x":340,"y":560,"wires":[["6ec2a88e.839598"]]}]

The output from this contains updated room info.

You can easily amend the payload and path to any of the settings listed in the controlling the system section above.


comments powered by Disqus