fhempy: xiaomi_gateway3 (Xiaomi Gateway V3)

Begonnen von dominik, 11 Dezember 2020, 19:04:20

Vorheriges Thema - Nächstes Thema

dominik

Kann es sein, dass du ein Device gelöscht oder umbenannt hast? Da ist fhempy noch sehr pingelig. daher nach einem rename/defmod/delete immer fhempy neu starten.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

RockFan

Ja, das stimmt tatsächlich. Ich hatte etwas "aufgeräumt".

Wie starte ich fhempy am besten? Ein Restart im PythonBinding-Device?
Raspbian (Buster) auf Raspberry Pi 4 /  CUL + RFXTRX + TCM / FS20, FHT 80B, S300TH, Intertechno, DMX, Milight, EnOcean, Homematic, AMAD, Home Connect, MiSmartHome, Yeelight, ...

dominik

set fhempyserver_15733 restart

Danach FHEM für 1 Minute in Ruhe lassen, weil wenn man viele Device hat, tut sich da einige beim Starten.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

RockFan

Alles klar. Danke! Bei mir heißt das Device allerdings "Pythonbinding_15733"  ;)
Raspbian (Buster) auf Raspberry Pi 4 /  CUL + RFXTRX + TCM / FS20, FHT 80B, S300TH, Intertechno, DMX, Milight, EnOcean, Homematic, AMAD, Home Connect, MiSmartHome, Yeelight, ...

chris_kmn

#49
Moin moin,

wenn ich mein Xiaomi Gateway 3 abschalte wird das Logfile relativ schnell geflutet obwohl ich das Llogfile auf disable=1 und verbose=0 gesetzt habe.

2022-02-15 22:36:56,660 - WARNING  - fhempy.lib.xiaomi_gateway3.core.mini_miio: 192.168.0.3 | Device offline
2022-02-15 22:37:43,718 - WARNING  - fhempy.lib.xiaomi_gateway3.core.mini_miio: 192.168.0.3 | Device offline
2022-02-15 22:38:30,772 - WARNING  - fhempy.lib.xiaomi_gateway3.core.mini_miio: 192.168.0.3 | Device offline


Kann man das irgendwie unterbinden ? Ich nutze das Gateway nur gelegentlich, will es aber nicht komplett löschen...

Weiterhin kommt beim Restart von fhem immer diese Meldung:

Messages collected while initializing FHEM:configfile: fhempy_log already defined, delete it first

In der fhem config ist das logfile jedoch nur einmal definiert. Soll das so sein ?

dominik

disable wird bei dem Modul leider noch nicht unterstützt.
verbose = 0 sollte nur ERROR liefern, nur sind im xiaomi_gateway3 noch Codeteile die noch nicht den FHEM Logger verwenden und daher nicht beeinflusst werden. Ich werde das noch korrigieren, bitte aber nicht die nächsten Tage erwarten, das ist ein größere Aufwand.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

chris_kmn

Ok alles klar und danke für die schnelle Info

chris_kmn

#52
Könnte man bei dem gateway ein disable attribut einbringen und damit das logging stoppen ?

dominik

Ja, ich schau mir das noch an. Das Modul ist durchaus etwas komplex, daher dauert die Lösung ein paar Tage.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

dominik

Gerade eine Idee gehabt wie ich disable womöglich doch einfach implementieren kann. Ist in paar Minuten online, bitte ausprobieren.

Du musst das disable beim xiaomi_gateway3 setzen, nicht beim xiaomi_gateway3_device. Probier es bitte aus und melde dich.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

chris_kmn


chris_kmn

Scheint noch Probleme zu geben:

2022-02-16 21:08:03,262 - WARNING  - fhempy.lib.xiaomi_gateway3.core.mini_miio: 192.168.0.3 | Device offline
/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3/xiaomi_gateway3.py:201: RuntimeWarning: coroutine 'GatewayEntry.stop' was never awaited
Coroutine created at (most recent call last)
  File "FHEM/bindings/python/bin/fhempy", line 113, in <module>
    fpb.run()
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/fhem_pythonbinding.py", line 507, in run
    asyncio.get_event_loop().run_forever()
  File "/usr/lib/python3.7/asyncio/base_events.py", line 539, in run_forever
    self._run_once()
  File "/usr/lib/python3.7/asyncio/base_events.py", line 1767, in _run_once
    handle._run()
  File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/generic.py", line 158, in Attr
    return await utils.handle_attr(self._conf_attr, self, hash, args, argsh)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/utils.py", line 69, in handle_attr
    return await fct_call(hash)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3/xiaomi_gateway3.py", line 100, in set_attr_disable
    self.gw.stop()
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3/xiaomi_gateway3.py", line 201, in stop
    self.gw.stop()
  self.gw.stop()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2022-02-16 21:08:50,329 - WARNING  - fhempy.lib.xiaomi_gateway3.core.mini_miio: 192.168.0.3 | Device offline

dominik

fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

chris_kmn

#58
Jetzt sieht es gut aus!

Mal wieder super Arbeit 😀😀😀

RockFan

Hallo dominik,

gestern sind endlich die beiden Rauchmelder angekommen, die ich über das Gateway 3 verbinden möchte (siehe Posts vom Februar in diesem Thread).
Nachdem ich sie erfolgreich mit dem Gateway verbunden habe, wurden auch automatisch Devices in FHEM erzeugt.

Beispiel (nach Rename):

{
  "Arg":"og_Rauchmelder",
  "Results": [
  {
    "Name":"og_Rauchmelder",
    "PossibleSets":"",
    "PossibleAttrs":"alias comment:textField-long eventMap:textField-long group room suppressReading userattr userReadings:textField-long verbose:0,1,2,3,4,5   IODev:fhempy_peer_192_168_178_77,fhempy_peer_192_168_178_88,local_pybinding event-aggregator event-min-interval event-on-change-reading event-on-update-reading oldreadings stateFormat:textField-long timestamp-on-change-reading DMX_B DMX_G DMX_R andFHEM_alias appOptions:textField-long assistantName:textField cmdIcon devStateIcon devStateIcon:textField-long devStateStyle gassistantName:textField genericDeviceType:ac_unit,aircondition,airfreshener,airpurifier,awning,bathtub,bed,blender,blinds,boiler,camera,carbon_monoxide_detector,charger,closet,coffee_maker,coffeemaker,cooktop,curtain,dehumidifier,dehydrator,dishwasher,door,drawer,dryer,fan,faucet,fireplace,fryer,garage,gate,grill,heater,hood,humidifier,kettle,light,lock,remotecontrol,mop,mower,microwave,multicooker,network,outlet,oven,pergola,petfeeder,pressurecooker,radiator,refrigerator,router,scene,securitysystem,settop,sensor,shutter,shower,smoke_detector,sousvide,sprinkler,standmixer,switch,tv,thermostat,vacuum,valve,washer,waterheater,waterpurifier,watersoftener,window,yogurtmaker,aircooler,audio_video_receiver,freezer,speaker,streaming_box,streaming_stick,streaming_soundbar,soundbar homebridgeMapping:textField-long icon lightSceneParamsToSave msgContactAudio msgContactLight msgContactMail msgContactPush msgContactScreen msgParams msgPriority msgRecipient msgRecipientAudio msgRecipientLight msgRecipientMail msgRecipientPush msgRecipientScreen msgRecipientText msgTitle msgTitleShrt msgType:text,push,mail,screen,light,audio,queue realRoom:textField realtimePicker room_map sortby webCmd webCmdLabel:textField-long widgetOverride",
    "Internals": {
      "CFGFN": "",
      "DEF": "xiaomi_gateway3_device xiaomigw3_408874251 blt.3.19vsonkj0lc01",
      "DID": "blt.3.19vsonkj0lc01",
      "FHEMPYTYPE": "xiaomi_gateway3_device",
      "FUUID": "6252ac28-f33f-4546-cb92-59fb2e160d61eaa7",
      "GATEWAY": "xiaomigw3_408874251",
      "IODev": "local_pybinding",
      "NAME": "og_Rauchmelder",
      "NR": "7005",
      "PYTHONTYPE": "xiaomi_gateway3_device",
      "STATE": "offline",
      "TYPE": "fhempy"
    },
    "Readings": {      "state": { "Value":"offline", "Time":"2022-04-10 13:12:34" } },
    "Attributes": {
      "IODev": "local_pybinding",
      "group": "xiaomi_gateway3_device",
      "room": "fhempy"
    }
  }  ],
  "totalResultsReturned":1
}


10-15 Minuten später beginnt eine endlose Flut mit folgender Meldungskette im FHEM-Log:

2022.04.10 12:18:59 1: ERROR: empty name in readingsBeginUpdate
2022.04.10 12:18:59 1: stacktrace:
2022.04.10 12:18:59 1:     main::readingsBeginUpdate           called by (eval 97791) (1)
2022.04.10 12:18:59 1:     (eval)                              called by ./FHEM/10_BindingsIo.pm (475)
2022.04.10 12:18:59 1:     main::BindingsIo_processMessage     called by ./FHEM/10_BindingsIo.pm (586)
2022.04.10 12:18:59 1:     main::BindingsIo_readWebsocketMessage called by ./FHEM/10_BindingsIo.pm (222)
2022.04.10 12:18:59 1:     main::BindingsIo_Read               called by fhem.pl (3929)
2022.04.10 12:18:59 1:     main::CallFn                        called by ./FHEM/98_freezemon.pm (1235)
2022.04.10 12:18:59 1:     main::freezemon_callFn              called by ./FHEM/98_freezemon.pm (1348)
2022.04.10 12:18:59 1:     main::__ANON__                      called by fhem.pl (781)
Use of uninitialized value $d in hash element at fhem.pl line 4645.
Use of uninitialized value $name in concatenation (.) or string at fhem.pl line 4984.


Im fhempy-Log stehen nun durchgehend folgende Meldungen:

2022-04-10 12:06:45,379 - INFO     - fhempy.lib.pkg_installer: Successfully installed python-miio==0.5.8 update!
2022-04-10 12:07:02,047 - ERROR    - fhempy.lib.xiaomi_gateway3.core.gateway3: Processing MQTT: log/ble b'{"did":"blt.3.19vsonkj0lc01","eid":4106,"edata":"64","pdid":2455,"seq":5}'
Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3/core/gateway3.py", line 650, in on_message
    await self.process_ble_event_fix(msg.json)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3/core/gateway3.py", line 399, in process_ble_event_fix
    await self.process_ble_payload(device, payload)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3/core/gateway3.py", line 414, in process_ble_payload
    await self.add_entity(domain, device, k)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3/core/helpers.py", line 66, in add_entity
    await self.setups[domain](self, device, attr)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3/xiaomi_gateway3.py", line 190, in setup
    await handler(gw, device, attr)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3/xiaomi_gateway3.py", line 172, in create_device
    await self.fhempy_devices[did].initialize(device)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3_device/xiaomi_gateway3_device.py", line 107, in initialize
    await self._fhempy_device.initialize(device)
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/xiaomi_gateway3_device/devices/base.py", line 103, in initialize
    for attr in attr_settings[str(device["model"])]:
KeyError: '2455'


Würde mich freuen, wenn Du dir das ansehen könntest  :)

Viele Grüße
Dieter
Raspbian (Buster) auf Raspberry Pi 4 /  CUL + RFXTRX + TCM / FS20, FHT 80B, S300TH, Intertechno, DMX, Milight, EnOcean, Homematic, AMAD, Home Connect, MiSmartHome, Yeelight, ...