-
Notifications
You must be signed in to change notification settings - Fork 32
Domoticz
Jasper Slits edited this page Nov 2, 2021
·
7 revisions
- The CVE/non-CVE unit must be in "standard" or "medium" mode before your Domoticz server can control the add-on
- An MQTT broker (e.g. Mosquitto) the running and available for the add-on to connect to
- Domoticz connected to the MQTT broker
- Domoticz MQTT must be enabled in the add-on web interface under "MQTT".
If Domoticz MQTT support is on, the state topic is domoticz/in and the command topic is domoticz/out. No other topics are available. If Domoticz MQTT support is on the command topic is domoticz/out; in this case commands that originate from other than configured IDX, need to contain the key/value pair "dtype":"ithofan" in order to get processed.
- Add a virtual (MQTT) sensor via the hardware setup in Domoticz you need to note the IDX for both
- fan speed --> switch --> dimmer (in mqtt: itho/state)
- temperature / humidity (in MQTT: itho/sensor) only applicable if the sensor is enabled
- Go to the add-on webpage
- Select on the left menu "mqtt"
- Enable Domoticz option
- Fill in the idx
FYI You can use Node-red to transform data from the Itho-add on to Domoticz
Listen to "itho/sensor" (MQTT in) outputs
{"temp":24.9,"hum":43.0}
Then transform to
{"idx":<idx-number>,"svalue":"24,9"}
What you can send to MQTT (MQTT out) node what connects to Domoticz in
output = '{"idx":79,"svalue":"'+ msg.payload.temp +'"}'
msg.payload = output
return msg;
Example to change speed when there is an increase in humidity, triggered by showering in the bathroom
dzvents code
return
{
on =
{
timer = {'every 1 minutes'}
},
data =
{
previousHumidity = { initial = 100 },
douchen = { initial = false },
oldLevel = { initial = 30 },
target_hum = { initial = 50 }
},
execute = function(domoticz)
local sensor = domoticz.devices(XX)
local setting = domoticz.devices(YY)
if ((sensor.humidity - domoticz.data.previousHumidity) >= 2) or (sensor.humidity >= 75) then
if not domoticz.data.douchen then
-- there was a significant rise
domoticz.data.douchen = true
domoticz.data.target_hum = domoticz.data.previousHumidity + 1
domoticz.data.oldLevel = setting.level
setting.dimTo(100)
domoticz.log("Douche mode detected, target_hum=" .. domoticz.data.target_hum .. "%, old level: " .. domoticz.data.oldLevel .. "%", domoticz.LOG_INFO);
end
elseif domoticz.data.douchen and sensor.humidity <= domoticz.data.target_hum then
domoticz.log("Douche mode ended, current level " .. setting.level .. " restoring to " .. domoticz.data.oldLevel .. " if less than current", domoticz.LOG_INFO);
if ( setting.level > domoticz.data.oldLevel ) then
setting.dimTo(domoticz.data.oldLevel)
end
domoticz.data.douchen = false
end
-- store current value for next cycle
domoticz.data.previousHumidity = sensor.humidity
end
}