Hi, I thought I’d share a small DIY project.
I have multiple air conditioners in my house, used for both heating and cooling, and for multiple users. These users are often away, so in that case their airco obviously doesn’t need to be on.
There are two scripts:
Airco Eettafel Operation Control
Determines HOW the airco should operate: mode (heating, cooling), fan speed, swing mode, etc.
If the temperature is within the comfort zone, the airco will not turn on.
Allows fine-tuning of setpoint, fan speed and swing mode.
Whether the airco is allowed to run at all is handled by the Airco Eettafel Power Control script.
Code: Select all
-- =========================================================
-- Airco Eettafel - OPERATION CONTROL
------------------------------------------------------------
-- Bepaalt HOE de airco moet werken, in welke modus (verwarmen, koelen, fan speed etc)
-- Als de temperatuur in de comfortzone zit, gaat de airco niet aan
-- Zorg voor finetuning qua setpoint en fan en swing modus
-- OF de airco moet werken, zie Airco Eettafel Power Control script
-- =========================
-- CONFIGURATIE
-- =========================
local IDX = {
temp = 3991, -- Temperatuur
comfort = 5268, -- Airco Comfort schakelaar (dummy, schakelaar voor de ruimte indien comfort gewenst)
setpoint = 5259, -- Airco Target Setpoint (gewenste temperatuur)
operation = 5257, -- Airco Operation Mode (welke HVAC functie, warmen, koelen etc)
fan = 5260, -- Airco Fan Mode (Ventilator snelheid)
swingUD = 5261, -- Airco Swing Mode Up/Down (blaasrichting omhoog/omlaag, auto)
swingLR = 5262, -- Airco Swing Mode Left/Right (optioneel, blaasrichting links/rechts, rechtdoor)
aircoPower = 5258 -- Airco Power (airco aan/uit schakelaar)
}
return {
on = {
devices = {
IDX.temp,
IDX.comfort
}
},
execute = function(domoticz)
local temp = domoticz.devices(IDX.temp).temperature
local comfort = domoticz.devices(IDX.comfort).state
local airco = domoticz.devices(IDX.aircoPower)
if comfort == 'Off' then
domoticz.log('Airco Operation | Comfort UIT', domoticz.LOG_DEBUG)
return
end
local setpoint = domoticz.devices(IDX.setpoint)
local operation = domoticz.devices(IDX.operation)
local fan = domoticz.devices(IDX.fan)
local swingUD = domoticz.devices(IDX.swingUD)
domoticz.log('Airco Operation | Temp=' .. temp, domoticz.LOG_INFO)
-- =========================
-- VERWARMEN
-- =========================
if temp < 16.5 then
if airco.state == 'Off' then airco.switchOn() end
setpoint.updateSetPoint(20)
operation.setLevel(21) -- Heat
fan.setLevel(30)
swingUD.setLevel(30)
elseif temp >= 16.5 and temp < 19.5 then
if airco.state == 'Off' then airco.switchOn() end
setpoint.updateSetPoint(20)
operation.setLevel(20)
fan.setLevel(20)
swingUD.setLevel(30)
-- =========================
-- COMFORTZONE → niets doen
-- =========================
-- =========================
-- KOELEN
-- =========================
elseif temp > 21.5 and temp <= 26.5 then
if airco.state == 'Off' then airco.switchOn() end
setpoint.updateSetPoint(24)
operation.setLevel(50) -- Cool
fan.setLevel(50)
swingUD.setLevel(60)
elseif temp > 26.5 then
if airco.state == 'Off' then airco.switchOn() end
setpoint.updateSetPoint(25)
operation.setLevel(50)
fan.setLevel(50)
swingUD.setLevel(60)
end
end
}
Airco Eettafel Power Control
-- ============================================================
-- Airco Eettafel – POWER CONTROL
-- Determines IF the airco is allowed to turn on
-- HOW the airco operates → see Airco Eettafel Operation Control script
-- Logic (priority high → low):
-- 1. Frost protection (always active)
-- 2. Comfort OFF → airco OFF
-- 3. If the temperature is within the comfort zone, the airco will not turn on
-- 4. Presence (at least one person present)
-- 5. God Mode (presence override)
-- ============================================================
Code: Select all
-- ============================================================
-- Airco Eettafel - POWER CONTROL
-- ------------------------------------------------------------
-- Bepaalt OF de airco aan mag/gaat
-- HOE de airco werkt → zie Airco Eettafel Operation Control script
-- Logica (prioriteit hoog → laag):
-- 1. Vorstbeveiliging (altijd actief)
-- 2. Comfort UIT → airco UIT
-- 3. Als de temperatuur in de comfortzone zit, gaat de airco niet aan
-- 4. Presence (minstens 1 persoon aanwezig)
-- 5. God Mode (override presence)
-- ============================================================
-- =========================
-- CONFIGURATIE
-- =========================
local IDX = {
-- metingen en bediening
temp = 3991, -- Thermometer van de ruimte
comfort = 5268, -- Airco Comfort schakelaar voor de ruimte
aircoPower = 5258, -- Airco Power, aan/uit van de ruimte
-- Presence, minimaal 1 van onderstaande moet thuis zijn
-- PAS NAMEN AAN IN HET SCRIPT BIJ
--return
-- execute
floris = 5272, -- Aanwezigheid Floris
suzanne = 5273, -- Aanwezigheid Suzanne
-- ben = 5274, -- ← makkelijk toe te voegen, voeg ook toe bij return en execute
-- Override, ook al is er niemand thuis, Godmode aan, airco gaat aan indien nodig
godmode = 5286 -- God Mode
}
local MIN_TEMP = 13.5 -- Vorstbeveiliging aan bij < 13.5
local HYSTERESIS = 1.0 -- Uit bij >= 14.5
local COMFORT_MIN = 19.5
local COMFORT_MAX = 21.5
-- =========================
-- SCRIPT
-- =========================
return {
on = {
devices = {
IDX.temp,
IDX.comfort,
IDX.floris,
IDX.suzanne,
-- IDX.ben,
IDX.godmode
}
},
execute = function(domoticz)
local temp = domoticz.devices(IDX.temp).temperature
local comfort = domoticz.devices(IDX.comfort).state
local airco = domoticz.devices(IDX.aircoPower)
local floris = domoticz.devices(IDX.floris).state == 'On'
local suzanne = domoticz.devices(IDX.suzanne).state == 'On'
-- local ben = domoticz.devices(IDX.ben).state == 'On'
local godmode = domoticz.devices(IDX.godmode).state == 'On'
local someoneHome = floris or suzanne -- or ben
domoticz.log(
string.format(
'Airco Power | Temp=%.1f | Comfort=%s | Home=%s | GodMode=%s | Airco=%s',
temp,
comfort,
tostring(someoneHome),
tostring(godmode),
airco.state
),
domoticz.LOG_DEBUG
)
-- ❄️ Vorstbeveiliging (altijd prioriteit)
if temp < MIN_TEMP then
if airco.state == 'Off' then
airco.switchOn()
domoticz.log('Airco → ON (vorstbeveiliging)', domoticz.LOG_INFO)
end
return
elseif temp >= MIN_TEMP + HYSTERESIS and comfort == 'Off' then
if airco.state == 'On' then
airco.switchOff()
domoticz.log('Airco → OFF (vorst voorbij, comfort uit)', domoticz.LOG_INFO)
end
return
end
-- Comfort UIT = airco UIT
if comfort == 'Off' then
if airco.state == 'On' then
airco.switchOff()
domoticz.log('Airco → OFF (comfort uit)', domoticz.LOG_INFO)
end
return
end
-- Comfort AAN → check presence / God Mode
if not (someoneHome or godmode) then
if airco.state == 'On' then
airco.switchOff()
domoticz.log('Airco → OFF (niemand aanwezig)', domoticz.LOG_INFO)
end
return
end
-- Comfortzone → airco mag UIT blijven
if temp >= COMFORT_MIN and temp <= COMFORT_MAX then
domoticz.log('Airco Power | Comfortzone, airco blijft uit', domoticz.LOG_DEBUG)
return
end
-- Buiten comfortzone → airco AAN
if airco.state == 'Off' then
airco.switchOn()
domoticz.log('Airco → ON (buiten comfortzone)', domoticz.LOG_INFO)
end
end
}