MyHOME icon indicating copy to clipboard operation
MyHOME copied to clipboard

Formatting error in MyHOMEGatewayHandler.sending_loop()

Open f18m opened this issue 1 year ago • 1 comments

I managed to get this custom integration to expose a cover present in my house into HA. However when I try to send the command "close" I see in HA logs the following:

2024-02-07 15:45:54.030 DEBUG (MainThread) [custom_components.myhome] [MyHomeServer1 gateway - 192.168.1.6] Message `*2*2*51##` was successfully queued.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/logging/handlers.py", line 1498, in emit
    self.enqueue(self.prepare(record))
                 ^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/core/homeassistant/util/logging.py", line 30, in prepare
    record = super().prepare(record)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/logging/handlers.py", line 1480, in prepare
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/logging/__init__.py", line 953, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/logging/__init__.py", line 687, in format
    record.message = record.getMessage()
                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/logging/__init__.py", line 377, in getMessage
    msg = msg % self.args
          ~~~~^~~~~~~~~~~
TypeError: not all arguments converted during string formatting
Call stack:
  File "/home/vscode/.local/bin/hass", line 8, in <module>
    sys.exit(main())
  File "/workspaces/core/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/workspaces/core/homeassistant/runner.py", line 188, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
    handle._run()
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/workspaces/core/config/custom_components/myhome/gateway.py", line 380, in sending_loop
    LOGGER.debug(
  File "/usr/local/lib/python3.11/logging/__init__.py", line 1477, in debug
    self._log(DEBUG, msg, args, **kwargs)
  File "/usr/local/lib/python3.11/logging/__init__.py", line 1634, in _log
    self.handle(record)
  File "/usr/local/lib/python3.11/logging/__init__.py", line 1644, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.11/logging/__init__.py", line 1706, in callHandlers
    hdlr.handle(record)
  File "/workspaces/core/homeassistant/util/logging.py", line 48, in handle
    self.emit(record)
Message: '%s Message `%s` was successfully unqueued by worker %s.'
Arguments: ('MyHomeServer1 Gateway', '192.168.1.6', *2*2*51##, 0)

f18m avatar Feb 07 '24 15:02 f18m

Please note that the PR https://github.com/anotherjulien/MyHOME/pull/109 contains the fix for this.

f18m avatar Feb 09 '24 14:02 f18m