Ich stelle fest, dass MQTT, JASONPATH und ich nicht wirklich Freunde sind
Falls noch jemand mit der Integration der openWB2 in openhab kämpft, stelle ich hier ein paar Codeschnipsel rein:
Things:
Bridge mqtt:broker:openwbbroker "OpenWBBroker" [ host="192.168.1.173", secure=false, clientID="openhabian",port=1883, username="",password=""]
Thing mqtt:topic:openwb "OpenWB" (mqtt:broker:openwbbroker) {
Channels:
Type number : ladeleistung "Ladeleistung" [stateTopic="openWB/lp/1/W",unit="W"]
Type number : ladestrom "Ladestrom" [stateTopic="openWB/lp/1/APhase1",unit="A"]
Type number : teslasoc "Tesla SoC" [stateTopic="openWB/vehicle/2/get/soc",unit="%"]
Type number : plugstate "plugstate" [stateTopic="openWB/lp/1/boolPlugStat",unit=""]
Type string : chargemode "chargemode" [ stateTopic="openWB/vehicle/template/charge_template/0", commandTopic="openWB/set/vehicle/template/charge_template/0/chargemode/selected"]
Type string : pvmincurrent "pvmincurrent" [ stateTopic="openWB/vehicle/template/charge_template/0", commandTopic="openWB/set/vehicle/template/charge_template/0/chargemode/pv_charging/min_current"]
Type string : sofortcurrent "sofortcurrent" [ stateTopic="openWB/vehicle/template/charge_template/0", commandTopic="openWB/set/vehicle/template/charge_template/0/chargemode/instant_charging/current"]
Items:
String Lademodus_mqtt_owb "[JSONPATH($.chargemode.selected):%s ]" { channel="mqtt:topic:openwb:chargemode" }
String Lademodus_Sendebefehl_mqtt { channel="mqtt:topic:openwb:chargemode" }
Number Lademodus_owb "Lademodus openWB [%.0f]" // [MAP(pvev.map):%s]
Number Ladestrom_owb "aktueller Ladestrom (A) : [%s]" { channel="mqtt:topic:openwb:ladestrom" } //http:url:openWB152_thing:lla1" }
Number Ladeleistung_owb "Ladeleistung [%.0f W]" { channel="mqtt:topic:openwb:ladeleistung" } //http:url:openWB152_thing:mqttladeleistunglp1" }
Number Ladestecker_owb "Status Ladestecker [%s]" { channel="mqtt:topic:openwb:plugstate" } //http:url:openWB152_thing:SteckerLP1" }
String pvmincurrent "[JSONPATH($.chargemode.pv_charging.min_current):%s ]" { channel="mqtt:topic:openwb:pvmincurrent" } // (AutoSolar)
String sofortcurrent "[JSONPATH($.chargemode.instant_charging.current):%s ]" { channel="mqtt:topic:openwb:sofortcurrent" } // (AutoSolar)
String pvmincurrent_Sendebefehl { channel="mqtt:topic:openwb:pvmincurrent" }
Number LadestromPVmin
String sofortcurrent_Sendebefehl { channel="mqtt:topic:openwb:sofortcurrent" }
Number Ladestrom_sofort // (AutoSolar)
Number Tesla_SOC "Tesla SoC [%s]" { channel="mqtt:topic:openwb:teslasoc"} //"http:url:openWB152_thing:soc" }
Rules:
rule "openWB 2.0 Lademodus setzen"
when
Item Lademodus_owb received update
then
if (Lademodus_owb.state==0) {
sendCommand(Lademodus_Sendebefehl_mqtt,"instant_charging")
sendCommand(Echo_TTS,"Lademodus sofort") }
if (Lademodus_owb.state==1) {
sendCommand(Lademodus_Sendebefehl_mqtt,"pv_charging")
sendCommand(Echo_TTS,"Lademodus PV Minimum ")
sendCommand(pvmincurrent_Sendebefehl,"6")}
if (Lademodus_owb.state==2) {
sendCommand(Lademodus_Sendebefehl_mqtt,"pv_charging")
sendCommand(Echo_TTS,"Lademodus PV")
sendCommand(pvmincurrent_Sendebefehl,"0") }
if (Lademodus_owb.state==3) {
sendCommand(Lademodus_Sendebefehl_mqtt,"stop")
sendCommand(Echo_TTS,"Lademodus stop")}
end
rule "Ladestrom PV min setzen"
when
Item LadestromPVmin received update
then
if (LadestromPVmin.state==6) {sendCommand(pvmincurrent_Sendebefehl,"6")}
if (LadestromPVmin.state==7) {sendCommand(pvmincurrent_Sendebefehl,"7")}
if (LadestromPVmin.state==8) {sendCommand(pvmincurrent_Sendebefehl,"8")}
if (LadestromPVmin.state==9) {sendCommand(pvmincurrent_Sendebefehl,"9")}
if (LadestromPVmin.state==10) {sendCommand(pvmincurrent_Sendebefehl,"10")}
if (LadestromPVmin.state==11) {sendCommand(pvmincurrent_Sendebefehl,"11")}
if (LadestromPVmin.state==12) {sendCommand(pvmincurrent_Sendebefehl,"12")}
if (LadestromPVmin.state==13) {sendCommand(pvmincurrent_Sendebefehl,"13")}
if (LadestromPVmin.state==14) {sendCommand(pvmincurrent_Sendebefehl,"14")}
if (LadestromPVmin.state==15) {sendCommand(pvmincurrent_Sendebefehl,"15")}
if (LadestromPVmin.state==16) {sendCommand(pvmincurrent_Sendebefehl,"16")}
end
rule "Ladestrom sofort setzen"
when
Item Ladestrom_sofort received update
then
if (Ladestrom_sofort.state==6) {sendCommand(sofortcurrent_Sendebefehl,"6")}
if (Ladestrom_sofort.state==7) {sendCommand(sofortcurrent_Sendebefehl,"7")}
if (Ladestrom_sofort.state==8) {sendCommand(sofortcurrent_Sendebefehl,"8")}
if (Ladestrom_sofort.state==9) {sendCommand(sofortcurrent_Sendebefehl,"9")}
if (Ladestrom_sofort.state==10) {sendCommand(sofortcurrent_Sendebefehl,"10")}
if (Ladestrom_sofort.state==11) {sendCommand(sofortcurrent_Sendebefehl,"11")}
if (Ladestrom_sofort.state==12) {sendCommand(sofortcurrent_Sendebefehl,"12")}
if (Ladestrom_sofort.state==13) {sendCommand(sofortcurrent_Sendebefehl,"13")}
if (Ladestrom_sofort.state==14) {sendCommand(sofortcurrent_Sendebefehl,"14")}
if (Ladestrom_sofort.state==15) {sendCommand(sofortcurrent_Sendebefehl,"15")}
if (Ladestrom_sofort.state==16) {sendCommand(sofortcurrent_Sendebefehl,"16")}
if (Ladestrom_sofort.state==17) {sendCommand(sofortcurrent_Sendebefehl,"17")}
if (Ladestrom_sofort.state==18) {sendCommand(sofortcurrent_Sendebefehl,"18")}
if (Ladestrom_sofort.state==19) {sendCommand(sofortcurrent_Sendebefehl,"19")}
if (Ladestrom_sofort.state==20) {sendCommand(sofortcurrent_Sendebefehl,"20")}
if (Ladestrom_sofort.state==21) {sendCommand(sofortcurrent_Sendebefehl,"21")}
if (Ladestrom_sofort.state==22) {sendCommand(sofortcurrent_Sendebefehl,"22")}
if (Ladestrom_sofort.state==23) {sendCommand(sofortcurrent_Sendebefehl,"23")}
if (Ladestrom_sofort.state==24) {sendCommand(sofortcurrent_Sendebefehl,"24")}
if (Ladestrom_sofort.state==25) {sendCommand(sofortcurrent_Sendebefehl,"25")}
if (Ladestrom_sofort.state==26) {sendCommand(sofortcurrent_Sendebefehl,"26")}
if (Ladestrom_sofort.state==27) {sendCommand(sofortcurrent_Sendebefehl,"27")}
if (Ladestrom_sofort.state==28) {sendCommand(sofortcurrent_Sendebefehl,"28")}
if (Ladestrom_sofort.state==29) {sendCommand(sofortcurrent_Sendebefehl,"29")}
if (Ladestrom_sofort.state==30) {sendCommand(sofortcurrent_Sendebefehl,"30")}
if (Ladestrom_sofort.state==31) {sendCommand(sofortcurrent_Sendebefehl,"31")}
if (Ladestrom_sofort.state==32) {sendCommand(sofortcurrent_Sendebefehl,"32")}
end
Sitemap:
Selection item=Lademodus_owb label="Lademodus [%s]" icon="sun_clouds" mappings=[0.0="sofort", 1.0="min + PV", 2.0="nur PV", 3.0="stop",4.0="opt. Netz"]
Setpoint item=Ladestrom_sofort label="Ladestrom sofort [%.0f A]" icon="ampere" step=1 minValue=6 maxValue=30 visibility=[Lademodus_owb == "0.0"]
Setpoint item=LadestromPVmin label="Ladestrom PV min [%.0f A]" icon="ampere" step=1 minValue=6 maxValue=16 visibility=[Lademodus_owb == "1.0"]
Ich hoffe, dass das hilfreich sein könnte.
Den 4.0="opt. Netz" gibt es in der openWB nicht. Hiermit habe ich rules um mit Tibber in den optimalen Zeiten zu laden.