Vielleicht für den ein odeer anderen interessant

Ich nutze FHEM mit über 150 verschiedenen Devices (Sensoren, Aktoren, usw.).
Die Integration des Niu Rollers ist wie folgt:
- Über HTTPMOD/CURL binde ich die API an und rufe dort den aktuellen Ladestand, etc. ab
- Das Ladegerät hängt an einem Zwischenstecker (Gosund mit TASMOTA geflashed)
- Der Zwischenstecker schaltet sich grundsätzlich nach 7h aus ("Sicherheits-"schaltung).
- Der Ladestand, die Steuerung und eine Auswahlmöglichkeit für den Zielladestand (80% oder 100%) lässt sich über das Smarthome-Steuerungs-Tablet in den Fluren steuern (siehe Bild)
- Ich sehe wieviel ich bisher "getankt" habe und abhängig von Zielladestand schalte ich den Zwischenstand bei 80% (Erhaltungsladung) oder 100% ( vor der nächsten größeren Fahrt) ab.
Anbei für die Techniker die Devices:
Code: Alles auswählen
defmod niu_api HTTPMOD https://app-api-fk.niu.com/v3/motor_data/index_info?sn=XXXXXXXXXXXXXX
attr niu_api userattr get01JSON reading01JSON reading01Name reading02JSON reading02Name reading03JSON reading03Name reading04JSON reading04Name reading05JSON reading05Name reading06JSON reading06Name requestHeader1
attr niu_api alias Niu Roller
attr niu_api event-on-change-reading .*
attr niu_api extractAllJSON 0
attr niu_api group Außen
attr niu_api reading01JSON data_estimatedMileage
attr niu_api reading01Name estimatedMileage
attr niu_api reading02JSON data_isCharging
attr niu_api reading02Name isCharging
attr niu_api reading03JSON data_batteries_compartmentA_batteryCharging
attr niu_api reading03Name batteryLevel
attr niu_api reading04JSON data_batteries_compartmentA_isConnected
attr niu_api reading04Name isConnected
attr niu_api reading05JSON data_postion_lat
attr niu_api reading05Name gpsLat
attr niu_api reading06JSON data_postion_lng
attr niu_api reading06Name gpsLng
attr niu_api requestHeader1 token: XXXXXXXXXXXXXXXXXXXX
attr niu_api room Steuerung,System
attr niu_api stateFormat Batterie: batteryLevel%, Lädt: isCharging
attr niu_api timestamp-on-change-reading .*
defmod Dummy_Roller_Zielladestand dummy
attr Dummy_Roller_Zielladestand alias Roller Zielladestand
attr Dummy_Roller_Zielladestand cmdIcon 80:measure_battery_75 100:measure_battery_100
attr Dummy_Roller_Zielladestand group Außen
attr Dummy_Roller_Zielladestand room Steuerung
attr Dummy_Roller_Zielladestand setList 80 100
attr Dummy_Roller_Zielladestand webCmd 80:100
defmod EG_Gosund_Roller MQTT2_DEVICE Gosund_IV
attr EG_Gosund_Roller IODev MQTT2_Server
attr EG_Gosund_Roller alias Roller Steckdose
attr EG_Gosund_Roller autocreate 0
attr EG_Gosund_Roller cmdIcon on:general_an off:general_aus
attr EG_Gosund_Roller comment NOTE: For on-for-timer SetExtensions are used. You may add on-for-timer option running on the device. The following is limited to 1h max duration, but will not affect future simple "on" commands:<br>on-for-timer {my $duration = $EVTPART1*10;; 'cmnd/cmnd/Gosund-IV/Backlog POWER1 1;; delay '.$duration.';; POWER1 0'}<br>See the "Praxisbeispiele" in the wiki for "pulseTime1" alternative option and it's restrictions.
attr EG_Gosund_Roller group Außen
attr EG_Gosund_Roller jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 Dimmer:0 Channel_0:0 Channel_1:0 Channel_2:0 Channel_3:0 Channel_4:0 HSBColor:0 Color:0
attr EG_Gosund_Roller model tasmota_basic_state_power1
attr EG_Gosund_Roller readingList tele/Gosund-IV/LWT:.* LWT\
tele/Gosund-IV/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\
tele/Gosund-IV/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\
tele/Gosund-IV/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }\
tele/Gosund-IV/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\
stat/Gosund-IV/POWER1:.* state\
stat/Gosund-IV/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }
attr EG_Gosund_Roller room Gosund,Steuerung
attr EG_Gosund_Roller setList off:noArg cmnd/Gosund-IV/POWER1 0\
on:noArg cmnd/Gosund-IV/POWER1 1\
toggle:noArg cmnd/Gosund-IV/POWER1 2\
setOtaUrl:textField cmnd/Gosund-IV/OtaUrl $EVTPART1\
upgrade:noArg cmnd/Gosund-IV/upgrade 1
attr EG_Gosund_Roller setStateList on off toggle
attr EG_Gosund_Roller stateFormat state<br>ENERGY_Power W / ENERGY_Total kWh
defmod Doif_Roller_Steckdose_Fertig DOIF ([niu_api:batteryLevel] >= 100 && [Dummy_Roller_Zielladestand] == 100)\
(\
set EG_Gosund_Roller off,,\
set Dummy_Roller_Zielladestand 80,,\
)\
DOELSEIF ([niu_api:batteryLevel] >= 80 && [Dummy_Roller_Zielladestand] == 80) \
(\
set EG_Gosund_Roller off,,\
)\
DOELSE\
()
attr Doif_Roller_Steckdose_Fertig group Automatisch
attr Doif_Roller_Steckdose_Fertig room Automatisierung