grimmpp / enocean-device-manager

enocean-device-manager
MIT License
9 stars 2 forks source link

Connection problem #48

Open tofuSCHNITZEL opened 3 weeks ago

tofuSCHNITZEL commented 3 weeks ago

Hi, I'm connected via usb to a FGW14-USB (mode 5) and I can see the port COM5 and if I connect with a serial monitor I can see packets getting received. In eo_man I try to detect serial ports and it finds a FAM USB on COM5 (despite me being connected to an FGW) and I get the following error if I try to connect...

2024-10-29 18:24:39,248 INFO eo_man Start Application eo_man
2024-10-29 18:24:40,833 INFO eo_man Name: eo_man
Version: 0.1.37
Summary: Tool to managed EnOcean Devices and to generate Home Assistant Configuration.
Author: Philipp Grimm
License: MIT
Requires-Python: >=3.7
Lastest_Available_Version: 0.1.37

2024-10-29 18:25:06,061 INFO eltakobus.serial Serial communication started
2024-10-29 18:25:06,074 INFO eltakobus.serial Established serial connection to COM5 - baud rate: 9600
2024-10-29 18:25:06,781 INFO eo_man FAM-USB detected on serial port COM5,(baudrate: 9600)
2024-10-29 18:25:06,939 INFO eltakobus.serial Serial communication stopped
2024-10-29 18:25:52,565 INFO eltakobus.serial Serial communication started
2024-10-29 18:25:52,585 INFO eltakobus.serial Established serial connection to COM5 - baud rate: 9600
2024-10-29 18:25:53,089 INFO eo_man Serial connection established. serial port: COM5, baudrate: 9600
2024-10-29 18:25:56,195 ERROR eo_man Failed to get information about FAM-USB!!!
2024-10-29 18:25:56,197 ERROR root Failed to get information about FAM-USB!!!
Traceback (most recent call last):
  File "C:\Users\TobiasPerschon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\eo_man\controller\serial_controller.py", line 359, in async_create_fam_usb_device
    tcm_sw_v = '.'.join(str(n) for n in response.body[2:6])
                                        ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'body'
2024-10-29 18:25:56,239 ERROR eo_man Establish connection for FAM-USB (ESP2) on port COM5 failed!
2024-10-29 18:25:56,239 ERROR root Establish connection for FAM-USB (ESP2) on port COM5 failed!
Traceback (most recent call last):
  File "C:\Users\TobiasPerschon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\eo_man\controller\serial_controller.py", line 245, in establish_serial_connection
    asyncio.run( self.async_create_fam_usb_device() )
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\TobiasPerschon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\eo_man\controller\serial_controller.py", line 373, in async_create_fam_usb_device
    raise e
  File "C:\Users\TobiasPerschon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\eo_man\controller\serial_controller.py", line 359, in async_create_fam_usb_device
    tcm_sw_v = '.'.join(str(n) for n in response.body[2:6])
                                        ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'body'
2024-10-29 18:25:56,342 INFO eltakobus.serial Serial communication stopped

any hints?

okay I tried to connect to the FAM instead and now the connection works and I tried to read devices/export ha config but I run into a different error:

2024-10-29 19:00:54,369 INFO eo_man Start Application eo_man
2024-10-29 19:00:55,880 INFO eo_man Name: eo_man
Version: 0.1.37
Summary: Tool to managed EnOcean Devices and to generate Home Assistant Configuration.
Author: Philipp Grimm
License: MIT
Requires-Python: >=3.7
Lastest_Available_Version: 0.1.37

2024-10-29 19:00:57,521 INFO eltakobus.serial Serial communication started
2024-10-29 19:00:57,542 INFO eltakobus.serial Established serial connection to COM6 - baud rate: 9600
2024-10-29 19:00:57,570 INFO eo_man FAM14 detected on serial port COM6,(baudrate: 9600)
2024-10-29 19:00:57,680 INFO eltakobus.serial Serial communication stopped
2024-10-29 19:01:21,109 INFO eltakobus.serial Serial communication started
2024-10-29 19:01:21,128 INFO eltakobus.serial Established serial connection to COM6 - baud rate: 57600
2024-10-29 19:01:21,160 INFO eo_man Serial connection established. serial port: COM6, baudrate: 57600
2024-10-29 19:01:22,215 INFO eo_man Found device: <FAM14 (08 ff) at 255 size 1 version (1, 10, 0, 0)>
2024-10-29 19:01:31,271 INFO root Received Telegram: RPSMessage from 00-00-18-03, data: 50, status: 00
2024-10-29 19:01:31,487 INFO root Received Telegram: RPSMessage from 00-00-18-04, data: 50, status: 00
2024-10-29 19:01:31,629 INFO root Received Telegram: RPSMessage from 00-00-18-05, data: 50, status: 00
2024-10-29 19:01:31,676 INFO root Received Telegram: RPSMessage from 00-00-18-06, data: 50, status: 00
2024-10-29 19:01:32,135 INFO root Received Telegram: RPSMessage from 00-00-18-07, data: 50, status: 00
2024-10-29 19:01:32,319 INFO root Received Telegram: RPSMessage from 00-00-18-08, data: 50, status: 00
2024-10-29 19:01:32,684 INFO root Received Telegram: RPSMessage from 00-00-18-09, data: 50, status: 00
2024-10-29 19:01:33,057 INFO root Received Telegram: RPSMessage from 00-00-18-0A, data: 50, status: 00
2024-10-29 19:01:33,425 INFO root Received Telegram: RPSMessage from 00-00-18-0B, data: 50, status: 00
2024-10-29 19:01:33,804 INFO root Received Telegram: RPSMessage from 00-00-18-0C, data: 50, status: 00
Exception in thread Thread-5:
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "C:\Users\TobiasPerschon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\eltakobus\serial.py", line 176, in run
    self.__callback(parsed_msg)
  File "C:\Users\TobiasPerschon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\eo_man\controller\serial_controller.py", line 183, in _received_serial_event
    if isinstance(message.address, int):
                  ^^^^^^^^^^^^^^^
AttributeError: 'ESP2Message' object has no attribute 'address'

Thanks!

tofuSCHNITZEL commented 1 week ago

maybe there are some weird messages on the bus...

I added this in eo_man/controller/serial_controller.py


    def _received_serial_event(self, message) -> None:
        if isinstance(message, ESP2Message):
            return

so the app does not crash anymore when receiving an ESP2 Message on the bus...