Ora Funky Cat
Auf dieser Seite wird die EInbindung des E-Autos Ora Funky Cat von GWM (Great Wall Motors aus China) in FHEM über die ODB2-Serviceschnittestelle erläutert.
Benötigte Hardware: MeatPi WiCAN-OBD-C3 Dongle
Der WiCAN kann sich über WLAN mit eine MQTT-Server verbinden. Näheres in obigem Link. Er wird in die ODB2-Serviceschnittestelle (neben Sicherungsfach unterhalb Lenkrad) gesteckt. Am besten über ein Verlängerungskabel oder indem man den Stecker aus der Halterung drückt und den WiCAN ins SIcherungsfach legt.
Die Integration eines MQTT-Servers in FHEM wird hier erklärt.
Ist das Auto eingeschalten und der Dongle gesteckt dann könne über FHEM Fahrzeugwerte abgefragt werden. Hier eine beispielhafte EInrichtung eine MQTT-Devices. Der Ausdruck "XXXXXXXX" muss durch die Identnummer des WiCAN ersetzt werden. Die folgenden Werte werden ausgelesen:
- Mileage: km-Stand - Abfrage über "set wican read_Mileage"
- SoC: Ladezustand Hochvolt-Antriebsbatterie in % - Abfrage über "set wican read_SoC"
- TrueSoC: ein zweiter Wert. Hintergrund ist unbekannt - Abfrage über "set wican read_TrueSoC"
- SoE: Ladezustand Hochvolt-Antriebsbatterie in kW - Abfrage über "set wican read_SoE"
- SoH: Gesundheitszustand der Hochvolt-Antriebsbatterie in % - Abfrage über "set wican read_SoH"
- OperatingVoltage: Spannung Niedervolt-Fahrzeugbatterie in V - Abfrage über "set wican read_OperatingVoltage"
- BatteryVoltage: Spannung Hochvolt-Antriebsbatterie in V - Abfrage über "set wican read_BatteryVoltage"
- TotalCharge: Durch die Batterie aufgenommene Stromleistung in Ah (inklusive Rekuperation während des Fahrens) - Abfrage über "set wican read_Total Charge" Die Multiplikation mit 5 kV scheint die hinzugefügte elektrische Leistung zu ergeben.
- TotalDischarge: Von der Hochvolt-Batterie abgezogene Stromleistung in Ah - Abfrage über "set wican read_TotalDischarge" Die Multiplikation mit 5 kV scheint die abgerufene elektrische Leistung zu ergeben
define wican MQTT2_DEVICE
attr wican alias Ora
attr wican stateFormat B: SoC% M: Mileage km (status)
attr wican event-on-change-reading status
attr wican event-on-update-reading frame_1_data_6,SoC
attr wican DbLogExclude .*
attr wican DbLogInclude SoC:3600
attr wican readingList wican/XXXXXXXX/status:.* {json2nameValue($EVENT)}\
wican/XXXXXXXX/can/rx:.* {json2nameValue($EVENT)}
attr wican setList read_SoC:noArg wican/XXXXXXXX/can/tx {"bus":"0","type":"tx","ts":49539,"frame":[{"id":1931,"dlc":8,"rtr":false,"extd":false,"data":[3,34,32,80,170,170,170,170]}]}\
read_TrueSoC:noArg wican/XXXXXXXX/can/tx {"bus":"0","type":"tx","ts":27825,"frame":[{"id":1931,"dlc":8,"rtr":false,"extd":false,"data":[3,34,3,8,170,170,170,170]}]}\
read_SoH:noArg wican/XXXXXXXX/can/tx {"bus":"0","type":"tx","ts":12016,"frame":[{"id":1931,"dlc":8,"rtr":false,"extd":false,"data":[3,34,32,81,170,170,170,170]}]}\
read_SoE:noArg wican/XXXXXXXX/can/tx {"bus":"0","type":"tx","ts":17777,"frame":[{"id":1930,"dlc":8,"rtr":false,"extd":false,"data":[3,34,208,98,170,170,170,170]}]}\
read_OpVoltage:noArg wican/XXXXXXXX/can/tx {"bus":"0","type":"tx","ts":17645,"frame":[{"id":1931,"dlc":8,"rtr":false,"extd":false,"data":[3,34,208,3,170,170,170,170]}]}\
read_Mileage:noArg wican/XXXXXXXX/can/tx {"bus":"0","type":"tx","ts":35674,"frame":[{"id":1931,"dlc":8,"rtr":false,"extd":false,"data":[3,34,208,4,170,170,170,170]}]}\
read_TotalCharge:noArg wican/XXXXXXXX/can/tx {"bus":"0","type":"tx","ts":28695,"frame":[{"id":1931,"dlc":8,"rtr":false,"extd":false,"data":[3,34,33,113,170,170,170,170]}]}\
read_TotalDischarge:noArg wican/XXXXXXXX/can/tx {"bus":"0","type":"tx","ts":28695,"frame":[{"id":1931,"dlc":8,"rtr":false,"extd":false,"data":[3,34,33,114,170,170,170,170]}]}\
read_BatteryVoltage:noArg wican/XXXXXXXX/can/tx {"bus":"0","type":"tx","ts":58591,"frame":[{"id":1931,"dlc":8,"rtr":false,"extd":false,"data":[3,34,32,3,170,170,170,170]}]}
attr wican userReadings SoC:frame_1_data_6:.* {\
if (ReadingsNum($NAME, 'frame_1_id', 0) == 1995 and ReadingsNum($NAME, 'frame_1_data_1', 0) == 5 and ReadingsNum($NAME, 'frame_1_data_2', 0) == 98\
and ReadingsNum($NAME, 'frame_1_data_3', 0) == 32 and ReadingsNum($NAME, 'frame_1_data_4', 0) == 80 ) {\
return (ReadingsNum($NAME, 'frame_1_data_5', 0) * 256+ReadingsNum($NAME, 'frame_1_data_6', 0))/10.0\
} else {\
return ReadingsNum($NAME, 'SoC', 0)\
}\
},\
SoH:frame_1_data_6:.* {\
if (ReadingsNum($NAME, 'frame_1_id', 0) == 1995 and ReadingsNum($NAME, 'frame_1_data_1', 0) == 5 and ReadingsNum($NAME, 'frame_1_data_2', 0) == 98\
and ReadingsNum($NAME, 'frame_1_data_3', 0) == 32 and ReadingsNum($NAME, 'frame_1_data_4', 0) == 81 ) {\
return (ReadingsNum($NAME, 'frame_1_data_5', 0) * 256 + ReadingsNum($NAME, 'frame_1_data_6', 0))/10.0\
} else {\
return ReadingsNum($NAME, 'SoH', 0)\
}\
},\
TrueSoC:frame_1_data_6:.* {\
if (ReadingsNum($NAME, 'frame_1_id', 0) == 1995 and ReadingsNum($NAME, 'frame_1_data_3', 0) == 3) {\
return (ReadingsNum($NAME, 'frame_1_data_5', 0) * 256 + ReadingsNum($NAME, 'frame_1_data_6', 0))/10.0\
} else {\
return ReadingsNum($NAME, 'TrueSoC', 0)\
}\
},\
Mileage:frame_1_data_6:.* {\
if (ReadingsNum($NAME, 'frame_1_id', 0) == 1995 and ReadingsNum($NAME, 'frame_1_data_1', 0) == 6 and ReadingsNum($NAME, 'frame_1_data_2', 0) == 98\
and ReadingsNum($NAME, 'frame_1_data_3', 0) == 208 ) {\
return ReadingsNum($NAME, 'frame_1_data_6', 0) * 256 + ReadingsNum($NAME, 'frame_1_data_7', 0)\
} else {\
return ReadingsNum($NAME, 'Mileage', 0)\
}\
},\
OperatingVoltage:frame_1_data_6:.* {\
if (ReadingsNum($NAME, 'frame_1_id', 0) == 1995 and ReadingsNum($NAME, 'frame_1_data_1', 0) == 4 and ReadingsNum($NAME, 'frame_1_data_2', 0) == 98\
and ReadingsNum($NAME, 'frame_1_data_3', 0) == 208 ) {\
return ReadingsNum($NAME, 'frame_1_data_5', 0) /10.0\
} else {\
return ReadingsNum($NAME, 'OperatingVoltage', 0)\
}\
},\
TotalCharge:frame_1_data_6:.* {\
if (ReadingsNum($NAME, 'frame_1_id', 0) == 1995 and ReadingsNum($NAME, 'frame_1_data_1', 0) == 7 and ReadingsNum($NAME, 'frame_1_data_2', 0) == 98\
and ReadingsNum($NAME, 'frame_1_data_3', 0) == 33 and ReadingsNum($NAME, 'frame_1_data_4', 0) == 113 ) {\
return round( 2 * ReadingsNum($NAME, 'frame_1_data_7', 0) + ReadingsNum($NAME, 'frame_1_data_8', 0) / 128 , 0)\
} else {\
return ReadingsNum($NAME, 'TotalCharge', 0)\
}\
},\
TotalDischarge:frame_1_data_6:.* {\
if (ReadingsNum($NAME, 'frame_1_id', 0) == 1995 and ReadingsNum($NAME, 'frame_1_data_1', 0) == 7 and ReadingsNum($NAME, 'frame_1_data_2', 0) == 98\
and ReadingsNum($NAME, 'frame_1_data_3', 0) == 33 and ReadingsNum($NAME, 'frame_1_data_4', 0) == 114 ) {\
return round( 2 * ReadingsNum($NAME, 'frame_1_data_7', 0) + ReadingsNum($NAME, 'frame_1_data_8', 0) / 128 , 0)\
} else {\
return ReadingsNum($NAME, 'TotalDischarge', 0)\
}\
},\
BatteryVoltage:frame_1_data_6:.* {\
if (ReadingsNum($NAME, 'frame_1_id', 0) == 1995 and ReadingsNum($NAME, 'frame_1_data_1', 0) == 16 and ReadingsNum($NAME, 'frame_1_data_2', 0) == 9\
and ReadingsNum($NAME, 'frame_1_data_3', 0) == 98 and ReadingsNum($NAME, 'frame_1_data_4', 0) == 32 ) {\
return ( 256 * ReadingsNum($NAME, 'frame_1_data_6', 0) + ReadingsNum($NAME, 'frame_1_data_7', 0)) / 10.0 \
} else {\
return ReadingsNum($NAME, 'BatteryVoltage', 0)\
}\
},\
SoE:frame_1_data_6:.* {\
if (ReadingsNum($NAME, 'frame_1_id', 0) == 1994 and ReadingsNum($NAME, 'frame_1_data_1', 0) == 7 and ReadingsNum($NAME, 'frame_1_data_2', 0) == 98\
and ReadingsNum($NAME, 'frame_1_data_3', 0) == 208 and ReadingsNum($NAME, 'frame_1_data_4', 0) == 98 ) {\
return (256*ReadingsNum($NAME, 'frame_1_data_7', 0)+ReadingsNum($NAME, 'frame_1_data_8', 0)) / 10.0 \
} else {\
return ReadingsNum($NAME, 'SoE', 0)\
}\
}