📜 ⬆️ ⬇️

Fibaro Home Center 2 and thermostat for floor heating HeatIt. How to raise the temperature

I faced the task of managing a warm floor from the interface of Fibaro Home Center 2. It seems to be the simplest task, but no. At the request of the customer thermostats should be repelled by the temperature of the floor. It was decided to use HeatIt thermostats.

image

They are most suited to customer requirements:


Having studied the materials in the network a little bit, I found out that the “cool” Fibaro Home Center 2 cannot nominally set the temperature on the thermostats to> 30 degrees in the web interface and> 28 degrees in the mobile application. That for the maximum temperature of the floor, of course not enough.

image

At the same time Thermostats HeatIt make it possible to set up to 40 degrees. The question arises why Fibaro does not allow the installer to set the range of possible temperatures. Well, okay, I thought, think of something. There was even an idea to shift the readings of the NTC sensor with an additional resistor, but then the customer would have to get used to the temperature readings in conventional “parrots”, which is not good.

There was a thought, but what if you take and send in some way greater value?

The exchange between the web client and Home Center 2 is described in the Fibaro REST API
But it turned out to be easier for me to intercept all the commands in Wireshark.

Specifically for HeatIt:
POST / api / devices / 9 / action / setMode {"args": [1]}
POST / api / devices / 9 / action / setSetpointMode {"args": [1]}
POST / api / devices / 9 / action / setThermostatSetpoint {"args": [1,27]}
Description
setMode - mode selection (arguments: 1 - on, heating, 11 - economical heating, 0 - off)
setSetpointMode — selects which mode the set temperature is displayed from (the arguments are the same)
setThermostatSetpoint - setting the target temperature for the mode (respectively, the first argument is the mode, the second is the temperature)

You can also send requests like:
GET / api / callAction? DeviceID = ID & name = setThermostatSetpoint & arg1 = MODE & arg2 = TEMP VALUE
etc.

You can also find out all the commands and values ​​for all installed devices using the REST request:
GET / api / devices
So, we send the thermostat a temperature of 35 degrees, and, oh, a miracle, the thermostat accepted it.

Now the task is to come up with a replacement for the standard thermostat control.

The first option is the Fibaro virtual device.

I sketched the form:



Let's start writing scripts:

To begin, let us know the ID of all devices of interest to us, for this you need to go to the settings of each “device” relating to our thermostat and look at the ID on the page or in the address bar of the browser.

In my case, the device for setting the target temperature (setPoint) - ID: 7

Floor Temperature Sensor - ID: 8

Select thermostat operation mode - ID: 9





Also, our virtual device also has its ID, it can be seen only in the address bar of my browser, it is ID 12 . Then each element of the virtual device also has its own ID, in my case:

“Current temp.” I have ID “ Label1 ”, “Target temperature” - ID “ Label2
The “+” and “-” buttons are ID “ Button1 ” and ID “ Button2 ”, respectively. “Mode” - ID “ Label1 ”.
Well, the buttons "OFF", "ECO" and "ON" - ID “ Button3 ”, ID “ Button4 ” and ID “ Button5 ”, respectively.

Main loop:

-- запрашиваем текущую температуру пола и целевую температуру, а так же выбранный режим работы термостата: floor_temp = fibaro:getValue(8, 'value') currentSetPoint = tonumber(fibaro:getValue(7, 'value')) mode = fibaro:getValue(9, 'mode') -- здесь отображаем текущую температуру fibaro:call(12, "setProperty", "ui.Label1.value", floor_temp) -- в зависимости от выбранного режима отображаем целевую температуру и сам режим в соответствующих полях if (mode == '1') then fibaro:call(12, "setProperty", "ui.Label3.value", "ON") fibaro:call(12, "setProperty", "ui.Label2.value", currentSetPoint) elseif (mode == '11') then fibaro:call(12, "setProperty", "ui.Label3.value", "ECO") fibaro:call(12, "setProperty", "ui.Label2.value", currentSetPoint) elseif (mode == '0') then fibaro:call(12, "setProperty", "ui.Label3.value", "OFF") fibaro:call(12, "setProperty", "ui.Label2.value", "OFF") end 

Next, write scripts for the buttons:
With the mode selection buttons, everything is simple:
“OFF”:

 fibaro:call(9, 'setMode',0) 

“ECO”:

 fibaro:call(9, 'setMode',11) fibaro:call(7, 'setSetpointMode',11) 

“ON”:

 fibaro:call(9, 'setMode',1) fibaro:call(7, 'setSetpointMode',1) 

For the "+" button:

 -- узнаем текущую целевую температуру currentSetPoint = tonumber(fibaro:getValue(7, 'value')) -- прописываем условие, что бы температуру нельзя было увеличить более 40 градусов if (currentSetPoint < 40) then setPoint = currentSetPoint + 1 else setPoint = 40 end -- отправляем новую температуру в термостат fibaro:call(7, 'setThermostatSetpoint',11, setPoint) 

For the "-" button:

 currentSetPoint = tonumber(fibaro:getValue(7, 'value')) if (currentSetPoint > 5) then setPoint = currentSetPoint - 1 else setPoint = 5 end fibaro:call(7, 'setThermostatSetpoint',11, setPoint) 

In general, everything.

It works fine, the only problem is the delay after pressing the button. If managed from a local network, it is 1-2 seconds, but if managed remotely, the delay can be up to 10 seconds. Those. if necessary, add or lower the temperature by a dozen degrees remotely, it may take a couple of minutes.

In general, this is of course a crutch, but so far there is no other way out. In other matters, running into before I say, the whole system will eventually come under the control of Iridium Mobile, so this is a temporary solution.

Source: https://habr.com/ru/post/436344/