Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept packets from known devices IDs only causes exception #202

Open
rfcdejong opened this issue Aug 24, 2024 · 4 comments
Open

Accept packets from known devices IDs only causes exception #202

rfcdejong opened this issue Aug 24, 2024 · 4 comments
Assignees

Comments

@rfcdejong
Copy link

rfcdejong commented Aug 24, 2024

Describe the bug
using only the config_flow the slider "Accept packets from known devices IDs only" says there is an error and needs to check the log.

To Reproduce
Set known device IDs and move slider "Accept packets from known devices IDs only" to the right.

My Known device IDs

"18:034927":
  class: HGI
"32:160269":
  class: FAN
  alias: Orchon 500 ExoMax
"37:097626":
  class: REM
  faked: true
  alias: Orchon 15RF remote
  commands:
    request31DA: "RQ --- 37:097626 32:160269 --:------ 31DA 001 00 "
    request10D0: "RQ --- 37:097626 32:160269 --:------ 10D0 001 00 "
    away: " I --- 37:097626 32:160269 --:------ 22F1 003 000007"
    low: " I --- 37:097626 32:160269 --:------ 22F1 003 000107"
    medium: " I --- 37:097626 32:160269 --:------ 22F1 003 000207"
    high: " I --- 37:097626 32:160269 --:------ 22F1 003 000307"
    auto: " I --- 37:097626 32:160269 --:------ 22F1 003 000407"
    auto2: " I --- 37:097626 32:160269 --:------ 22F1 003 000507"
    boost: " I --- 37:097626 32:160269 --:------ 22F1 003 000607"
    disable: " I --- 37:097626 32:160269 --:------ 22F1 003 000707"
    bypass_open: " W --- 37:097626 32:160269 --:------ 22F7 003 00C8EF"
    bypass_close: " W --- 37:097626 32:160269 --:------ 22F7 003 0000EF"
    bypass_auto: " W --- 37:097626 32:160269 --:------ 22F7 003 00FFEF"
    high_60: " I --- 37:097626 32:160269 --:------ 22F3 007 00123C03040404"
    med_60: " I --- 37:097626 32:160269 --:------ 22F3 007 00123C02040404"
    high_30: " I --- 37:097626 32:160269 --:------ 22F3 007 00121E03040404"
    high_15: " I --- 37:097626 32:160269 --:------ 22F3 007 00120F03040404"
    reset_filter: " W --- 37:097626 32:160269 --:------ 10D0 002 00FF"
"32:100470":
  class: CO2
  alias: Orchon CO2 woonkamer
"37:218902":
  class: CO2
  alias: Orchon CO2 slaapkamer

Expected behavior
Expect all other devices to be filtered out

Please complete the following information:
no ramses_cc: section from configuration.yaml

Additional context

Logger: homeassistant.config_entries
Source: config_entries.py:604
First occurred: August 19, 2024 at 1:50:12 PM (5 occurrences)
Last logged: 3:50:03 PM

Error setting up entry RAMSES RF for ramses_cc
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ramses_cc/__init__.py", line 94, in async_setup_entry
    await broker.async_setup()
  File "/config/custom_components/ramses_cc/broker.py", line 146, in async_setup
    await self.client.start(cached_packets=cached_packets())
  File "/usr/local/lib/python3.12/site-packages/ramses_rf/gateway.py", line 184, in start
    load_schema(self, known_list=self._include, **self._schema)  # create faked too
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ramses_rf/schemas.py", line 358, in load_schema
    load_tcs(gwy, ctl_id, schema)  # type: ignore[arg-type]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ramses_rf/schemas.py", line 399, in load_tcs
    ctl = _get_device(gwy, ctl_id)
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ramses_rf/schemas.py", line 341, in _get_device
    check_filter_lists(dev_id)
  File "/usr/local/lib/python3.12/site-packages/ramses_rf/schemas.py", line 337, in check_filter_lists
    raise LookupError(
LookupError: Can't create 01:000730: it is in the schema, but not in the known_list (check the lists and the schema)

After that following error

Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:148
First occurred: August 19, 2024 at 1:51:09 PM (34 occurrences)
Last logged: 3:50:09 PM

Error doing job: Exception in callback PortTransport._read_ready() (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 935, in _read_ready
    self._frame_read(
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 744, in _frame_read
    super()._frame_read(dtm_str, self._regex_hack(frame, self._inbound_rule))  # type: ignore[misc]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 611, in _frame_read
    self._pkt_read(pkt)
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 421, in wrapper
    fnc(self, pkt)
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 950, in _pkt_read
    super()._pkt_read(pkt)
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 622, in _pkt_read
    raise exc.TransportError("Transport is closing or has closed")
ramses_tx.exceptions.TransportError: Transport is closing or has closed
@zxdavb
Copy link
Owner

zxdavb commented Aug 26, 2024

LookupError: Can't create 01:000730: it is in the schema, but not

This is expected behaviour if you do not has a working/valid known list.

@zxdavb
Copy link
Owner

zxdavb commented Aug 26, 2024

I think what is happening is this:

  • you have a cached schema and a cached packet log enabled
  • you have a valid known list, but it is not enforced as an allow list
  • there is a packet in the cache for a device called 01:000730

So, try this:

  • check that 01:000730 is not in your schema
  • start without the packet log cache
  • enforce the known list

Let me know if that works.

@zxdavb zxdavb changed the title Using only config_flow and slider to filter all other out results into an error Accept packets from known devices IDs only causes exception Aug 26, 2024
@zxdavb
Copy link
Owner

zxdavb commented Aug 26, 2024

Actually,

load_schema(self, known_list=self._include, **self._schema)  # create faked too

... the error is in your schema:

  • disable restoring of the cached schema, and
  • check your configured schema

One of them will have a device called 01:000730 in it.

@zxdavb
Copy link
Owner

zxdavb commented Aug 26, 2024

It is not acceptable for ramses_rf* to crash in this scenario.

This is a bug.

@zxdavb zxdavb self-assigned this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants