Hi there,
My first post as newbie to the OpenHab community.
I am running Openhab2 on an RPI3 for a year now, building light, blinds, alarms, doors and recently heating projects.
Since this community has helped me so much in understanding and building my own Openhab home automation, I want to share with you my cool project on controlling a Nefit/Buderus/Junkers/Bosch boiler using an EMS-ESP gateway device and mqtt.
I started the project to save energy by limiting my floor heating pump activity only during active heating (instead of 24x7). An EMS-ESP gateway device allowed me to also read useful boiler metrics and remotely control my thermostat using the EMS bus standards.
I enabled the following functions using Openhab UI and automation rules:
- Read and show boiler metrics (warm water, heating, shower)
- Read/Set thermostat (sync current room temp, set room temp, set manual/auto mode)
- Scheduled activation of floor heating pump (daily intervals and triggered when central heating switches on/off)
Openhab UI:
I have set-up the project using the following configuration:
- Nefit Trendline boiler with Moduline-300 thermostat (can be any combination supporting EMS bus protocols)
- EMS-ESP gateway device (build yourself with ESP8266 or buy from bbqkees-electronics.nl with proddy firmware)
- PowerPlug switch (Mine is a KaKu/Trust; could be any Wifi/433Mhz/Zwave powerplug)
- Local openhab2 mqtt broker (moquette)
- Things file (mqtt topics)
- Items file
- Sitemap file
- Rules file (control floorpump and thermostat mode)
You can use MQTT-explorer (client) to test and explore other useful mqtt topics.
Below the configuration files. Plz check other posts for enabling Openahb2 local mqtt broker.
Please forgive my formatting; this is my first post.
Have fun (surely I did !
â THINGS
Bridge mqtt:systemBroker:embedded-mqtt-broker "Embedded MQTT broker" [ host="127.0.0.1", secure=false ]
{
Thing mqtt:topic:ems-esp "Nefit Proline" @ "boven" {
Channels:
Type string : status "Nefit EMS Status" [ stateTopic="ems-esp/status", on="online", off="offline" ]
Type switch : tapwater_active "Tapwater active" [ stateTopic="ems-esp/tapwater_active", on="1", off="0" ]
Type switch : heating_active "Heating active" [ stateTopic="ems-esp/heating_active", on="1", off="0" ]
//Channels for thermostat topics
Type number : hc1_seltemp "Mod300 HC1 selected temp" [stateTopic="ems-esp/thermostat_data", transformationPattern="JSONPATH:$.hc1.seltemp" ]
Type number : hc1_currtemp "Mod300 HC1 current temp" [stateTopic="ems-esp/thermostat_data", transformationPattern="JSONPATH:$.hc1.currtemp" ]
Type string : hc1_mode "Mod300 HC1 mode" [stateTopic="ems-esp/thermostat_data", transformationPattern="JSONPATH:$.hc1.mode" ]
Type number : thermostat_cmd_temp "Thermostat setpoint temp" [commandTopic="ems-esp/thermostat_cmd_temp" ]
Type switch : thermostat_cmd_mode "Thermostat mode" [commandTopic="ems-esp/thermostat_cmd_mode", on="auto", off="manual" ]
//Channels for boiler parameters (read state)
Type switch : burnGas "Gas burner status" [ stateTopic="ems-esp/boiler_data", transformationPattern="JSONPATH:$.burnGas", on="on", off="off" ]
Type switch : wWHeat "wWHeatValve status" [ stateTopic="ems-esp/boiler_data", transformationPattern="JSONPATH:$.wWHeat", on="on", off="off" ]
Type switch : heatPmp "HeatPump status" [ stateTopic="ems-esp/boiler_data", transformationPattern="JSONPATH:$.heatPmp", on="on", off="off" ]
Type number : wWcurFlow "Warm Water Flow volume (l/min)" [stateTopic="ems-esp/boiler_data", transformationPattern="JSONPATH:$.wWCurFlow" ]
Type number : curFlowTemp "Warm Water Flow temp" [stateTopic="ems-esp/boiler_data", transformationPattern="JSONPATH:$.curFlowTemp" ]
Type number : sysPress "Verwarming druk" [stateTopic="ems-esp/boiler_data", transformationPattern="JSONPATH:$.sysPress" ]
//Channels for shower (timer)
Type string : shower_duration "Shower Duration" [stateTopic="ems-esp/shower_data", transformationPattern="JSONPATH:$.duration" ]
//Channels for mqtt generic command topics
Type switch : shower_coldshot "Coldshot" [commandTopic="ems-esp/generic_cmd", on="shower_coldshot", off="" ]
}
}
â ITEMS
//Nefit Moduline 300 Thermostat items: temp set by thermostat (hc1 group) or EMS bus mqtt (command_temp)
Number Kamer_temp_setpoint "Thermostaat set temp [%.1f °C]" <moduline300> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:hc1_seltemp", channel="mqtt:topic:ems-esp:thermostat_cmd_temp" }
Number Kamer_temp "Kamer temperatuur [%.1f °C]" <temperature> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:hc1_currtemp"}
Switch Thermostat_mode_switch "Thermostaat mode switch" <moduline300> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:thermostat_cmd_mode"}
String Thermostat_mode "Thermostaat mode [%s]" <moduline300> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:hc1_mode"}
//Nefit boiler items
Switch Tapwater_active "Warm tapwater [%s]" <hotwater> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:tapwater_active"}
Switch HeatPump "Boilerpomp [%s]" <humidity> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:heatPmp"}
Switch BurnGas "Gasbrander [%s]" <fire> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:burnGas"}
Switch WWheat_valve "WW / CV klep [%s]" <softener> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:wWHeat"}
Number WWflow_volume "Warm water flow volume [%.1f l/m]" <hotwater> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:wWcurFlow"}
Number WWflow_temp "Warm water flow temp [%.1f °C]" <hotwater> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:curFlowTemp"}
Number Heating_pressure "CV druk [%.1f bar]" <humidity> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:sysPress"}
//Control items
String Douche_timer "Douche timer [%s]" <time> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:shower_duration"}
Switch Coldshot "Coldshot" <hotwater> (GrpV1,GrpHeating) { channel="mqtt:topic:ems-esp:shower_coldshot", expire="2s, state=OFF"}
Switch Vloerpomp "Vloerverwarming pomp [%s]" <pump> (GrpV1,GrpHeating) { lightwaverf="room=6,device=1,type=SWITCH" }
â SITEMAP
Group item=GrpHeating icon="heating" {
Frame label="Thermostaat"
{
//Note: Thermostat_mode_switch auto synced by Heating rule
Setpoint item=Kamer_temp_setpoint minValue=15 maxValue=25 step=0.5
Switch item=Thermostat_mode_switch label="Thermostaat mode[]" mappings=[ON="Auto", OFF="Manual"]
Text item=Kamer_temp
//Text item=Thermostat_set_temp
}
Frame label="Boiler status"
{
Switch item=Tapwater_active
Switch item=HeatPump
Switch item=WWheat_valve label="Warm water / CV klep[]" mappings=[ON="WW", OFF="CV"]
Switch item=BurnGas
}
Frame label="Verwarming status"
{
Switch item=Vloerpomp
Text item=Heating_pressure
Text item=WWflow_volume
Text item=WWflow_temp
}
Frame label="Douche status"
{
Text item=Douche_timer
Switch item=Coldshot
}
}
â RULES
// ----------------------------------------------------------------------------------------------------
// Initialize values
// ----------------------------------------------------------------------------------------------------
var String RuleName = "Trigger_Heating"
var FloorPumpTimer = null
var PumpRunTime = 3 //minutes
// ----------------------------------------------------------------------------------------------------
// Daily start/stop Floorheating pump to prevent pump locking up
// ----------------------------------------------------------------------------------------------------
rule "Heating: Daily Run FloorHeatingPump"
// Enable FloorHeatingPump for 3 minutes daily at 23:55
when
// Time cron "0 55 23 ? * * *"
Time cron "0 0 0/12 1/1 * ? *" // every 12 hours
then
Vloerpomp.sendCommand(ON)
logInfo (RuleName, "FloorHeatingPump scheduled switched ON at {}. WW valve status = {}.", LocalDateTime.now , WWheat_valve.state)
if (FloorPumpTimer === null) {
FloorPumpTimer = createTimer(now.plusMinutes(PumpRunTime)) [|
if (WWheat_valve.state == ON) {
//Valve set to Warm Water (not CV): safe to turn off Pump
sendCommand(Vloerpomp, "OFF")
logInfo (RuleName, "FloorHeatingPump scheduled switched OFF after {} minutes. WW valve status = {}.", PumpRunTime, WWheat_valve.state)
} else {
//Valve set to CV, so CV pump is active: do not turn off FloorHeatingPump
logInfo (RuleName, "FloorHeatingPump scheduled switched OFF ignored. WW valve status = {}.", WWheat_valve.state)
}
FloorPumpTimer = null
]
}
end
// ----------------------------------------------------------------------------------------------------
// Trigger rule to automatically switch Floor Heatpump
// ----------------------------------------------------------------------------------------------------
rule "Heating: FloorHeatingPump trigger ON/OFF by Boiler Gas and Heatpump activity"
when
Item HeatPump changed
then
// Check if HeatPump is on while WW valve is set to CV (OFF). If so, activate Floor Heatpump
if ( HeatPump.state == ON) {
if ( WWheat_valve.state == OFF) {
//Heatpump changed to ON while valve set to CV
Vloerpomp.sendCommand(ON)
logInfo (RuleName, "Floorpump state changed to {}", Vloerpomp.state)
} else {
//Heatpump changed to ON while valve set to WW
}
} else {
//Heatpump changed to OFF
if ( WWheat_valve.state == OFF) {
//BurnGas changed to OFF while valve set to CV
Vloerpomp.sendCommand(OFF)
logInfo (RuleName, "Floorpump state changed to {}", Vloerpomp.state)
}
}
end
// ----------------------------------------------------------------------------------------------------
// Trigger rule to sync Thermostat mode switch on UI when Thermostat_mode changed on Thermostat device
// ----------------------------------------------------------------------------------------------------
rule "Heating: Thermostat device sync manual-auto mode with sitemap UI"
when
Item Thermostat_mode changed
then
if (Thermostat_mode.state == "auto") { Thermostat_mode_switch.postUpdate("ON") }
if (Thermostat_mode.state == "manual") { Thermostat_mode_switch.postUpdate("OFF") }
end