
Vielen Dank nochmal und viele Grüße!
PS: Der Log Output war ja nur dazu gedacht überhaupt mal zu schauen was abgeht... das habe ich jetzt wieder rausgenommen

Code: Alles auswählen
sendHttpPostRequest(String url, String contentType, String content)
Code: Alles auswählen
Text.sendCommand(SOC.state.toString + "%")
Code: Alles auswählen
/ICONS/batterievoll.gif
Code: Alles auswählen
Thing topic awtrix01 "AwTrix Schreibtisch" @ "mqtt" [
availabilityTopic="awtrix3_1/stats/device",
payloadNotAvailable="offline",
payloadAvailable= "online"
]{
Type string : settings "Settings" [ commandTopic="awtrix3_1/settings" ]
Type string : notify "Notify" [ commandTopic="awtrix3_1/notify" ]
Type string : dismiss "Dismiss" [ commandTopic="awtrix3_1/notify/dismiss" ]
Type string : appsel "Select app" [ commandTopic="awtrix3_1/switch" ]
Type string : timer "Timer" [ commandTopic="awtrix3_1/timer" ]
Type string : car "Custom car" [ commandTopic="awtrix3_1/custom/car",retained="true" ]
Type string : strom "Custom strom" [ commandTopic="awtrix3_1/custom/strom" ]
Type string : stats "Stats" [ stateTopic="awtrix3_1/stats" ]
Type switch : power "Anzeige" [ commandTopic="awtrix3_1/power",on="true",off="false",formatBeforePublish="{'power':%2s}"]
Type trigger : btnLeft "Taste links" [ stateTopic="awtrix3_1/stats/buttonLeft" ]
Type trigger : btnRight "Taste rechts" [ stateTopic="awtrix3_1/stats/buttonRight" ]
Type trigger : btnSelect "Taste mitte" [ stateTopic="awtrix3_1/stats/buttonSelect" ]
Type color : ind1 "oben" [ commandTopic="awtrix3_1/indicator1",formatBeforePublish="{\"color\":[%1$d,%2$d,%3$d]}",colorMode="RGB" ]
Type color : ind2 "mitte" [ commandTopic="awtrix3_1/indicator2",formatBeforePublish="{\"color\":[%1$d,%2$d,%3$d]}",colorMode="RGB" ]
Type color : ind3 "unten" [ commandTopic="awtrix3_1/indicator3",formatBeforePublish="{\"color\":[%1$d,%2$d,%3$d]}",colorMode="RGB" ]
}
Code: Alles auswählen
String AwTrixSchreibtischSettings "Settings" (gAwTrix) ["Control"] {channel="mqtt:topic:mymqtt:awtrix01:settings"}
String AwTrixSchreibtischNotify "Notify" (gAwTrix) ["Control"] {channel="mqtt:topic:mymqtt:awtrix01:notify"}
String AwTrixSchreibtischDismiss "Notify" (gAwTrix) ["Control"] {channel="mqtt:topic:mymqtt:awtrix01:dismiss"}
String AwTrixSchreibtischAppsel "Select app" (gAwTrix) ["Control"] {channel="mqtt:topic:mymqtt:awtrix01:appsel"}
String AwTrixSchreibtischTimer "Timer" (gAwTrix) ["Control"] {channel="mqtt:topic:mymqtt:awtrix01:timer"}
String AwTrixSchreibtischStats "Stats" (gAwTrix) ["Status"] {channel="mqtt:topic:mymqtt:awtrix01:stats"}
String AwTrixSchreibtischCar "Custom car" (gAwTrix) ["Status"] {channel="mqtt:topic:mymqtt:awtrix01:car"}
String AwTrixSchreibtischStrom "Custom Strom" (gAwTrix) ["Status"] {channel="mqtt:topic:mymqtt:awtrix01:strom"}
Switch AwTrixSchreibtischPower "Anzeige" (gAwTrix) ["Switch"] {channel="mqtt:topic:mymqtt:awtrix01:power"}
Color AwTrixSchreibtischInd1 "Oben" (gAwTrix) ["Status"] {channel="mqtt:topic:mymqtt:awtrix01:ind1"}
Color AwTrixSchreibtischInd2 "Mitte" (gAwTrix) ["Status"] {channel="mqtt:topic:mymqtt:awtrix01:ind2"}
Color AwTrixSchreibtischInd3 "Unten" (gAwTrix) ["Status"] {channel="mqtt:topic:mymqtt:awtrix01:ind3"}
Code: Alles auswählen
rule "Awtrix ein" // morgens um 6 Uhr Anzeige einschalten
when
Time cron "0 0 6 * * ?"
then
logInfo("awtrix","Anzeige ein")
AwTrixSchreibtischPower.sendCommand(ON)
end
rule "Awtrix aus"
when
Time cron "0 0 2 * * ?" // Um 2 Uhr Anzeige ausschalten
then
logInfo("awtrix","Anzeige aus")
AwTrixSchreibtischPower.sendCommand(OFF)
end
rule "Grid Power changed" // Bezug/Lieferung geändert -> Stromapp aktualisieren
when
Item PVPowerflowchannelpgrid changed
then
if(!(newState instanceof Number))
return;
var Number nPFlow = (newState as Number).floatValue / 1000
var strColor = "#FF0000"
var strIcon = "52715" // Icon für Bezug
if(nPFlow < 0) {
strColor = "#00FF00"
nPFlow = - nPFlow
strIcon = "52648" // Icon für Lieferung
}
val strZahl = String.format("%.1f",nPFlow).replace(',','.')
var json='{"pos" : 3,"text" : "' + strZahl + 'kW","icon" : ' + strIcon + ',"duration" : 9,"color" : "' + strColor + '"}'
AwTrixSchreibtischStrom.sendCommand(json)
end
rule "ID.3 Batterie SOC"
when
Item VWDomChargeSOC changed or
Item VWDomChargeStatState changed or
Item VWParkingPosition changed
then
var strColor = "#FF0000"
var strIcon = "53423"
switch(VWDomChargeStatState.state.toString) {
case "notReadyForCharging" : strColor = "#FF7070"
case "readyForCharging" : strColor = "#60AF80"
case "charging" : {strColor = "#00FF00" strIcon="53424"}
case "chargePurposeReachedAndConservation" : strColor = "#0000FF"
case "chargePurposeReachedAndNotConservationCharging" : strColor = "#FFFFFF"
case "conservation" : strColor = "#7F7FFF"
}
val strSOC = VWDomChargeSOC.state.toString
var json='{"pos" : 2,"text" : "' + strSOC + '","icon" : ' + strIcon + ',"duration" : 9,"color" : "' + strColor + '"}'
if(bCarAway)
json = ''
AwTrixSchreibtischCar.sendCommand(json)
end
rule "Vigor Offline"
when
Item Vigor165Online changed from ON
then
var iCount = 0
if(Vigor165OfflineCount.state instanceof Number)
iCount = (Vigor165OfflineCount.state as Number).intValue
iCount += 1
Vigor165OfflineCount.postUpdate(iCount)
var json='{"text" : "OFFLINE! (' + iCount.toString + ')", "hold" : true, "color" : "#FF0000", "blinkText" : 500}'
AwTrixSchreibtischNotify.sendCommand(json)
end
rule "get last offline timestamp"
when
Item Vigor165Online changed from OFF to ON
then
logInfo("online","Wieder online!")
var dtOnline = Vigor165Online.previousState(true,"jdbc").timestamp
if(dtOnline === null) dtOnline = now
Vigor165OnlineTimestamp.postUpdate(new DateTimeType(dtOnline))
AsteriskRestartRun.sendCommand(ON)
AwTrixSchreibtischDismiss.sendCommand("")
end
Code: Alles auswählen
Thing awtrixclock awtrix01 "Awtrix Schreibtisch" [
appLockTimeout=10,
discoverDefaultApps=false,
basetopic="awtrix3_1",
lowBatteryThreshold=25
]
Code: Alles auswählen
Number AwtrixSchreibtischBatterylevel "Batterieladung" (gAwTrixNew) ["Status"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:batterylevel"}
Switch AwtrixSchreibtischLowBattery "Niedriger batteriestatus" (gAwTrixNew) ["Status"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:low-battery"}
Switch AwtrixSchreibtischDisplay "Betrieb" (gAwTrixNew) ["Switch"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:display"}
Number:Dimensionless AwtrixSchreibtischHumidity "Luftfeuchtigkeit" (gAwTrixNew) ["Status"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:humidity"}
Number:Illuminance AwtrixSchreibtischLux "Lux" (gAwTrixNew) ["Status"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:lux"}
Switch AwtrixSchreibtischAutoBrightness "Automatc brightness" (gAwTrixNew) ["Switch"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:autoBrightness"}
Number:Dimensionless AwtrixSchreibtischBrightness "Display brightness" (gAwTrixNew) ["Status"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:brightness"}
Number:Temperature AwtrixSchreibtischTemperature "Innentemperatur" (gAwTrixNew) ["Status"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:temperature"}
Number:Dimensionless AwtrixSchreibtischRssi "Wi fi signal" (gAwTrixNew) ["Status"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:rssi"}
String AwtrixSchreibtischApp "Active app" (gAwTrixNew) ["Status"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:app"}
//Image AwtrixSchreibtischScreen "Screen mirror" (gAwTrixNew) ["Status"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:screen"}
Switch AwtrixSchreibtischIndicator1 "Indicator" (gAwTrixNew) ["Switch"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:indicator1"}
Switch AwtrixSchreibtischIndicator2 "Indicator" (gAwTrixNew) ["Switch"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:indicator2"}
Switch AwtrixSchreibtischIndicator3 "Indicator" (gAwTrixNew) ["Switch"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:indicator3"}
String AwtrixSchreibtischSound "Play melody from melodies folder" (gAwTrixNew) ["Control"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:sound"}
String AwtrixSchreibtischRtttl "Play rtttl" (gAwTrixNew) ["Control"] {channel="mqtt:awtrixclock:mymqtt:awtrix01:rtttl"}