Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Question
jodohl 9
Hi!
I am searching for a solution to the following challenge:
I am regulation the heating in my house by Heating Panel. To override the scheduled daytime lowering on weekdays (when e.g. working from home), I have borrowed a virtual device LUA code that works well. It is basically a VD with three buttons, for "Schedule", "Holiday" and "Home" respectively.
This code will however only accept one single override temperatur for all zones. I want my bathrooms at a higher temperature.
It must certainly be possible to amend the LUA code to achieve this. I have tried to manipulate the LUA code by adding duplicates og the core subroutine with changed variables for the zone ID in question, but the code will not run. Not very surprising, since my understanding of LUA is very limited.
Is there anyone out there with better LUA competence who could propose a solution?
The code for the "Home" VD button is given below. My bathrooms are Zone 204, which I want to stay on 24C, not the common 22C temperature.
local zoneIds = {22,23,33,47,204} -- En komma separeret liste med de Zoneid du ønsker at opdatere
local target = 22-- Din target temperatur. 0 = vacation disabled
local HC2 = Net.FHttp("127.0.0.1",11111)
local function updateZone(id)
local response ,status, errorCode = HC2:GET("/api/panels/heating/"..id)
local jsonTable = false
if (status == "200") then
jsonTable = json.decode(response)
end
if (jsonTable ~= false) then
jsonTable.properties.vacationTemperature = target
HC2:PUT("/api/panels/heating/"..id, json.encode(jsonTable))
return true
end
return false
end
for n, zoneId in ipairs(zoneIds) do
if (updateZone(zoneId)) then
fibaro:debug("Updated Zone "..zoneId);
else
fibaro:debug("Failed to Update Zone "..zoneId);
end
end
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.