THINGS:
Thing mqtt:topic:SpaControl "Spa control" (mqtt:broker:myAuthentificatedBroker) @ "Outside" {
Channels:
Type switch : PowerChannel [stateTopic="spa_control/message", on="1", off="0", transformationPattern="JSONPATH:$.PWR"]
Type switch : BubblesChannel [stateTopic="spa_control/message", commandTopic="spa_control/command", on="1", off="0", transformationPattern="JSONPATH:$.AIR", formatBeforePublish="{\"CMD\":2,\"VALUE\":%s,\"XTIME\":0,\"INTERVAL\":0}" ]
Type number : CurrentTemperatureChannel [stateTopic="spa_control/message", transformationPattern="JSONPATH:$.TMP"]
Type number : TargetTemperatureChannel [stateTopic="spa_control/message", commandTopic="spa_control/command", transformationPattern="JSONPATH:$.TGT", formatBeforePublish="{\"CMD\":0,\"VALUE\":%s,\"XTIME\":0,\"INTERVAL\":0}" ]
Type switch : PumpChannel [stateTopic="spa_control/message", commandTopic="spa_control/command", on="1", off="0", transformationPattern="JSONPATH:$.FLT", formatBeforePublish="{\"CMD\":4,\"VALUE\":%s,\"XTIME\":0,\"INTERVAL\":0}" ]
Type switch : HeaterRedChannel [stateTopic="spa_control/message", on="1", off="0", transformationPattern="JSONPATH:$.RED" ]
Type switch : HeaterGreenChannel [stateTopic="spa_control/message", on="1", off="0", transformationPattern="JSONPATH:$.GRN" ]
Type switch : HeaterControlChannel [ commandTopic="spa_control/command", on="1", off="0", formatBeforePublish="{\"CMD\":3,\"VALUE\":%s,\"XTIME\":0,\"INTERVAL\":0}" ]
Type number : DisplayChar1 [stateTopic="spa_control/message", transformationPattern="JSONPATH:$.CH1" ]
Type number : DisplayChar2 [stateTopic="spa_control/message", transformationPattern="JSONPATH:$.CH2" ]
Type number : DisplayChar3 [stateTopic="spa_control/message", transformationPattern="JSONPATH:$.CH3" ]
}
ITEMS:
/*Lay Z Spa*/
Switch SpaPower "Spa Power" { channel="mqtt:topic:SpaControl:PowerChannel" }
Switch SpaBubbles "Spa Bubbles" { channel="mqtt:topic:SpaControl:BubblesChannel" }
Number SpaCurrentTemperature "Aktuelle Temperatur" (g_LastUpdatebleDate) { channel="mqtt:topic:SpaControl:CurrentTemperatureChannel" }
DateTime SpaCurrentTemperature_LastUpdate "[%1$td-%1$tm-%1$ty %1$ta %1$tT]"
Number SpaTargetTemperature "Zieltemperatur [%.0f]" { channel="mqtt:topic:SpaControl:TargetTemperatureChannel" }
Switch SpaPump "Spa Pumpe" { channel="mqtt:topic:SpaControl:PumpChannel" }
Switch SpaHeaterGreen "Spa heater green" { channel="mqtt:topic:SpaControl:HeaterGreenChannel" }
Switch SpaHeaterRed "Spa heater red" { channel="mqtt:topic:SpaControl:HeaterRedChannel" }
Switch SpaHeater "Spa Heizung"
Switch SpaHeaterControl { channel="mqtt:topic:SpaControl:HeaterControlChannel" }
String SpaHeaterState "Spa heater state"
Number Spa_Display_Char1 "Spa display char 1" (g_SpaDisplayChars) { channel="mqtt:topic:SpaControl:DisplayChar1" }
Number Spa_Display_Char2 "Spa display char 2" (g_SpaDisplayChars) { channel="mqtt:topic:SpaControl:DisplayChar2" }
Number Spa_Display_Char3 "Spa display char 3" (g_SpaDisplayChars) { channel="mqtt:topic:SpaControl:DisplayChar3" }
String Spa_Display_Message "Spa display"
RULES:
rule "SPA heater state"
when
Item SpaHeaterGreen received update or
Item SpaHeaterRed received update
then
if(SpaHeaterGreen.state == ON || SpaHeaterRed.state == ON)
{
SpaHeater.postUpdate(ON);
if(SpaHeaterRed.state == ON){
SpaHeaterState.postUpdate('HEATING')
}
if(SpaHeaterGreen.state == ON){
SpaHeaterState.postUpdate('NOT HEATING')
}
} else {
SpaHeater.postUpdate(OFF);
SpaHeaterState.postUpdate('OFF')
}
end
rule "SPA set heater state"
when
Item SpaHeater received command
then
if(SpaHeaterControl.state != SpaHeater.state)
{
SpaHeaterControl.sendCommand(SpaHeater.state.toString)
}
end
rule "SPA get display message"
when
Member of g_SpaDisplayChars changed
then
var String result = ""
result += Character.toString((Spa_Display_Char1.state as DecimalType).intValue);
result += Character.toString((Spa_Display_Char2.state as DecimalType).intValue);
result += Character.toString((Spa_Display_Char3.state as DecimalType).intValue);
Spa_Display_Message.postUpdate(result.toString);
end
SITEMAP:
Group item=ZF_Whirlpool
{
Frame label="Spa"{
Text item=SpaCurrentTemperature icon="temperature"
Setpoint item=SpaTargetTemperature icon="temperature" minValue=30 maxValue=40 step=1
Text item=SpaHeaterState label="Heater [%s]" icon="heating"
Switch item=SpaPower
Switch item=SpaPump
Switch item=SpaHeater
Switch item=SpaBubbles
Text item=SpaCurrentTemperature_LastUpdate label="Last update"
Text item=Spa_Display_Message label="Message on the display [%s]"
Switch item=SpaHeaterGreen
Switch item=SpaHeaterRed
}
© Urheberrecht. Alle Rechte vorbehalten.
Wir benötigen Ihre Zustimmung zum Laden der Übersetzungen
Wir nutzen einen Drittanbieter-Service, um den Inhalt der Website zu übersetzen, der möglicherweise Daten über Ihre Aktivitäten sammelt. Bitte überprüfen Sie die Details in der Datenschutzerklärung und akzeptieren Sie den Dienst, um die Übersetzungen zu sehen.