Hi Marcus,
you found a real bug .
In my code I read 3 pumps and the script of course crashed as you have only 1 pump. Its is in an early stateâŠ
I have uploaded a new version of the script. Can you please replace the client.py with the new version fro the git repository? I now loops over all pumps instead of statically read3 pumps. Then I hope the rest should work and you will see some topic posted on mqtt. BTW, if not already installed, MQTT Explorer is a great tool to check what is ongoing on your broker.
Sorry I over read in your first post your question about the items and and things file. Here they are:
mqtt.things
Bridge mqtt:broker:mySecureBroker "OpenHAB Bridge" [ host="192.168.x.x", secure=false, username="xxx", password="yyy" ]
{
...
// Whirlpool
Thing topic whirlpool "Whirlpool" @ "Garten" {
Channels:
Type string : current_operation "Aktelle Modus" [stateTopic="garten/whirlpool/water_heater/state", transformationPattern="JSONPATH:$.current_operation" ]
Type string : temperature_unit "Temperatureinheit" [stateTopic="garten/whirlpool/water_heater/state", transformationPattern="JSONPATH:$.temperature_unit" ]
Type number : current_temperature "Aktelle Temperatur" [stateTopic="garten/whirlpool/water_heater/state", transformationPattern="JSONPATH:$.current_temperature" ]
Type number : target_temperature "Eingestellte Temperatur" [stateTopic="garten/whirlpool/water_heater/state", transformationPattern="JSONPATH:$.target_temperature",
commandTopic="garten/whirlpool/water_heater/cmnd", min=30, max=41, step=0.5, formatBeforePublish="set_temp=%s"]
Type number : real_target_temperature "Berechnete Temperatur" [stateTopic="garten/whirlpool/water_heater/state", transformationPattern="JSONPATH:$.real_target_temperature" ] Type string : reachable "Online" [ stateTopic="haus/sonoff-basic-0102/tele/LWT"]
Type string : watercare_time "Wasserpflege Modus" [stateTopic="garten/whirlpool/water_care/state", transformationPattern="JSONPATH:$.Time"]
Type number : watercare_mode_i "Wasserpflege Modus" [stateTopic="garten/whirlpool/water_care/state", transformationPattern="JSONPATH:$.['mode']"]
Type string : watercare_mode "Wasserpflege Modus" [stateTopic="garten/whirlpool/water_care/state", transformationPattern="JSONPATH:$.['mode(txt)']"]
Type string : test "Test " [stateTopic="garten/whirlpool/water_care/state", transformationPattern="JSONPATH:$"]
Type switch : pump1 "Pumpe 1" [stateTopic="garten/whirlpool/pumps/state", transformationPattern="JSONPATH:$.['Pump 1']", on="HIGH", off="OFF"]
Type switch : pump2 "Pumpe 2" [stateTopic="garten/whirlpool/pumps/state", transformationPattern="JSONPATH:$.['Pump 2']", on="HIGH", off="OFF"]
Type switch : pump3 "Pumpe 3" [stateTopic="garten/whirlpool/pumps/state", transformationPattern="JSONPATH:$.['Pump 3']", on="HIGH", off="OFF"]
Type switch : circulation_pump "UmwÀlzpumpe" [stateTopic="garten/whirlpool/pumps/state", transformationPattern="JSONPATH:$.['Circulating Pump']", on="ON", off="OFF"]
Type switch : lights "Beleuchtung" [stateTopic="garten/whirlpool/lights/state", transformationPattern="JSONPATH:$.Lights", on="HI", off="OFF",
commandTopic="garten/whirlpool/lights/cmnd", formatBeforePublish="set_lights=%s"]
Type number : rinse_filter "Filter spĂŒhlen" [stateTopic="garten/whirlpool/reminders/state", transformationPattern="JSONPATH:$.RinseFilter" ]
Type number : clean_filter "Filter reinigen" [stateTopic="garten/whirlpool/reminders/state", transformationPattern="JSONPATH:$.CleanFilter" ]
Type number : change_water "Wasserwechsel" [stateTopic="garten/whirlpool/reminders/state", transformationPattern="JSONPATH:$.ChangeWater" ]
Type number : check_spa "Spa kontrollieren" [stateTopic="garten/whirlpool/reminders/state", transformationPattern="JSONPATH:$.CheckSpa" ]
Type switch : filter_status_clean "Filter Status:Clean" [stateTopic="garten/whirlpool/filter_status/state", transformationPattern="JSONPATH:$.['Filter Status:Clean']", on="true", off="false"]
Type switch : filter_status_purge "Filter Status:Purge" [stateTopic="garten/whirlpool/filter_status/state", transformationPattern="JSONPATH:$.['Filter Status:Purge']", on="true", off="false"]
}
....
}
whirpool.items
/*
* Gecko controler from Whirlpool
*/
Group Whirlpool "Whirlpool"
Group Whirlpool_Temperaturen "Whirlpool_Temperaturen"
Group Whirlpool_Pumpen "Whirlpool_Pumpen"
Group Whirlpool_FilterStatus "Filter Status"
String Whirlpool_Current_Operation "heizungmodus" (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:current_operation" }
String Whirlpool_Temp_Unit "Temperatur Einheit" (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:temperature_unit" }
Number:Temperature Whirlpool_Current_Temp "Aktuelle Temperatur" <temperature> (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:current_temperature" }
Number Whirlpool_Target_Temp "Gesetzte Temperatur" (Whirlpool, Whirlpool_Temperaturen) { channel="mqtt:topic:mySecureBroker:whirlpool:target_temperature" }
Number:Temperature Whirlpool_Real_Target_Temp "Berechnete Temperatur" <temperature> (Whirlpool, Whirlpool_Temperaturen) { channel="mqtt:topic:mySecureBroker:whirlpool:real_target_temperature" }
String Whirlpool_Watercare_Mode "Wasserpflege Modus" (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:watercare_mode" }
Number Whirlpool_Watercare_Mode_I "Wasserpflege Modus" (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:watercare_mode_i" }
Switch Whirlpool_Filter_Status_Clean "Filter Status:Reiningen" (Whirlpool, Whirlpool_FilterStatus) { channel="mqtt:topic:mySecureBroker:whirlpool:filter_status_clean" }
Switch Whirlpool_Filter_Status_Purge "Filter Status:DurchspĂŒhlen" (Whirlpool, Whirlpool_FilterStatus) { channel="mqtt:topic:mySecureBroker:whirlpool:filter_status_purge" }
Switch Whirlpool_Pump1 "Pumpe 1" (Whirlpool, Whirlpool_Pumpen) { channel="mqtt:topic:mySecureBroker:whirlpool:pump1" }
Switch Whirlpool_Pump2 "Pumpe 2" (Whirlpool, Whirlpool_Pumpen) { channel="mqtt:topic:mySecureBroker:whirlpool:pump2" }
Switch Whirlpool_Pump3 "Pumpe 3" (Whirlpool, Whirlpool_Pumpen) { channel="mqtt:topic:mySecureBroker:whirlpool:pump3" }
Switch Whirlpool_Circulation_Pump "UmwÀlzpumpe" (Whirlpool, Whirlpool_Pumpen) { channel="mqtt:topic:mySecureBroker:whirlpool:circulation_pump" }
Switch Whirlpool_Lights "Beleuchtung" <light> (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:lights" }
Number Whirlpool_Reminder_RinseFilter "Filter spĂŒhlen" (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:rinse_filter" }
Number Whirlpool_Reminder_CleanFilter "Filter reinigen" (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:clean_filter" }
Number Whirlpool_Reminder_ChangeWater "Wasser wechseln" (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:change_water" }
Number Whirlpool_Reminder_CheckSpa "Spa kontrollieren" (Whirlpool) { channel="mqtt:topic:mySecureBroker:whirlpool:check_spa" }
// Generic items for sidemap
String Whirlpool_Filter_Status "Filter-Status"
String Whirlpool_Heater_Status "Heizung-Status"
String Whirlpool_WaterCare_Status "Wasserpflege-Status"
Number Whirlpool_Chart_Period "Chart Period"
whirlpool.rules
/**
* Whirlpool reminders rules
*
*/
val mailWhirlpoolReminderEmpf = "abc.def@yyy.com"
rule "Initials values"
when System started
then
Whirlpool_Heater_Status.postUpdate("")
Whirlpool_Filter_Status.postUpdate("")
Whirlpool_WaterCare_Status.postUpdate("")
end
/**
* Change status message
*/
rule "Heater changed"
when Item Whirlpool_Current_Operation changed or
Item Whirlpool_Real_Target_Temp changed
then
if (Whirlpool_Current_Operation.state == NULL) {
return
}
// Heater
if (Whirlpool_Current_Operation.state == "Idle") {
Whirlpool_Heater_Status.postUpdate("GewĂŒnschte Temeratur erreicht")
} else if (Whirlpool_Current_Operation.state.toString == "Cooling") {
Whirlpool_Heater_Status.postUpdate("AbkĂŒhlen auf " + (Whirlpool_Real_Target_Temp.state as QuantityType<Temperature>).format("%.1f%unit%"))
} else if (Whirlpool_Current_Operation.state == "Heating") {
Whirlpool_Heater_Status.postUpdate("Aufheizen auf " + (Whirlpool_Real_Target_Temp.state as QuantityType<Temperature>).format("%.1f%unit%"))
}
end
rule "Watercare changed"
when Item Whirlpool_Watercare_Mode changed
then
if (Whirlpool_Watercare_Mode.state == NULL) {
return
}
if (Whirlpool_Watercare_Mode.state == "Away From Home" ) {
Whirlpool_WaterCare_Status.postUpdate("Sparmodus aktiviert")
} else if (Whirlpool_Watercare_Mode.state == "Standard" ) {
Whirlpool_WaterCare_Status.postUpdate("Spa lÀuft normal")
} else if (Whirlpool_Watercare_Mode.state == "Energy Saving" ) {
Whirlpool_WaterCare_Status.postUpdate("Sparmodus aktiviert")
} else if (Whirlpool_Watercare_Mode.state == "Super Energy Saving" ) {
Whirlpool_WaterCare_Status.postUpdate("Super Sparmodus aktiviert")
} else if (Whirlpool_Watercare_Mode.state == "Weekender" ) {
Whirlpool_WaterCare_Status.postUpdate("Wochenenmodus aktiviert")
}
end
rule "Filter changed"
when Item Whirlpool_Filter_Status_Clean changed or
Item Whirlpool_Filter_Status_Purge changed
then
if (Whirlpool_Filter_Status_Clean.state == ON) {
Whirlpool_Filter_Status.postUpdate("Filter aktiviert")
} else if (Whirlpool_Filter_Status_Purge.state == ON) {
Whirlpool_Filter_Status.postUpdate("DurchspĂŒhlen aktiviert")
} else {
Whirlpool_Filter_Status.postUpdate("")
}
end
/**
* Check reminders and send notification mails when needed
*/
rule "Whirpool remindes"
when
Time is noon
then
var rinseFilter = false
var cleanFilter = false
var changeWater = false
var checkSpa = false
var mailText = ""
var mailSubject = "Whirpool: "
var mailActions = getActions("mail","mail:smtp:50ed7d74")
if (Whirlpool_Reminder_RinseFilter.state != NULL) {
if (Whirlpool_Reminder_RinseFilter.state < 1) {
rinseFilter = true
}
}
if (Whirlpool_Reminder_CleanFilter.state != NULL) {
if (Whirlpool_Reminder_CleanFilter.state < 1) {
cleanFilter = true
}
}
if (Whirlpool_Reminder_ChangeWater.state != NULL) {
if (Whirlpool_Reminder_ChangeWater.state < 1) {
changeWater = true
}
}
if (Whirlpool_Reminder_CheckSpa.state != NULL) {
if (Whirlpool_Reminder_CheckSpa.state < 1) {
checkSpa = true
}
}
if (rinseFilter && !cleanFilter) {
mailSubject += "Filter durchspĂŒhlen"
if (Whirlpool_Reminder_RinseFilter.state > -2)
mailText += " * Filter durchspĂŒhlen"
else
mailText += " * Filter durchspĂŒhlen ĂŒberfĂ€llig seit " + (-1 * Whirlpool_Reminder_RinseFilter.state as Number) + " Tagen"
} else if (cleanFilter) {
mailSubject += "Filter reinigen"
if (Whirlpool_Reminder_CleanFilter.state > -2)
mailText += " * Filter in Lösung gereinigen"
else
mailText += " * Filter in Lösung gereinigen ĂŒberfĂ€llig seit " + (-1 * Whirlpool_Reminder_CleanFilter.state as Number) + " Tagen"
}
if (changeWater) {
if (mailSubject.length > 11) {
mailSubject += " - "
mailText += "\n"
}
mailSubject += "Wasser wechslen"
if (Whirlpool_Reminder_ChangeWater.state >-2)
mailText += " * Wasser wechselen"
else
mailText += " * Wasser wechseln ĂŒberfĂ€llig seit " + (-1 * Whirlpool_Reminder_ChangeWater.state as Number) + " Tagen"
}
if (checkSpa) {
if (mailSubject.length > 11) {
mailSubject += " - "
mailText += "\n"
}
mailSubject += "Spa ĂŒberprĂŒfen lassen"
if (Whirlpool_Reminder_CheckSpa.state >-2)
mailText += " * Spa ĂŒberprĂŒffen lassen"
else
mailText += " * Spa ĂŒberprĂŒffen lassen ĂŒberfĂ€llig seit " + (-1 * Whirlpool_Reminder_CheckSpa.state as Number) + " Tagen"
}
if (mailSubject.length > 11) {
mailText ="Hallo liebe Bubblerfreunde,\n\nich brÀuchte mal wieder folgende Wartung(en):\n\n" + mailText + "\n\n Dein Whirlpool"
mailActions.sendMail(mailWhirlpoolReminderEmpf, mailSubject, mailText)
}
end