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

Add impersonation support to send_packet service #201

Merged

Conversation

Kars-de-Jong
Copy link
Contributor

This change adds support for impersonation using the send_packet service.

I use it to send fan_demand packets from my faked CO2 sensor, because ramses_rf doesn't support that yet.

I couldn't practically solve this use-case with a remote, because you have to predefine the commands in a remote, which is not very suitable for fan_demand packets, since you specify the demand percentage - you would need to create 100 commands for it.

I submitted this PR before, I hope you would consider merging it. If not, I will have to switch to using my own fork instead.

@Kars-de-Jong
Copy link
Contributor Author

@zxdavb Any reasons for not merging this PR?

@Kars-de-Jong
Copy link
Contributor Author

@zxdavb Hello? I'd appreciate some feedback here...

@zxdavb
Copy link
Owner

zxdavb commented Dec 15, 2024

Rebase it and I will merge it.

@Kars-de-Jong Kars-de-Jong force-pushed the send_packet_impersonation_support branch from 7aa619c to 08f1e82 Compare December 16, 2024 08:22
@Kars-de-Jong
Copy link
Contributor Author

Kars-de-Jong commented Dec 16, 2024

Rebase it and I will merge it.

@zxdavb Done.

@zxdavb
Copy link
Owner

zxdavb commented Dec 25, 2024

Hi, did you run pre-commit install --install-hooks before creating this PR?

@zxdavb
Copy link
Owner

zxdavb commented Dec 27, 2024

Please:

  • pip install -r requirements_dev.txt
  • pre-commit install --install-hooks
  • pre-commit run -a
  • mypy

Your commit should pass the latter two tests. The main one is mypy, which is not one of the pre-commits checks.

@Kars-de-Jong
Copy link
Contributor Author

Alright, I will check this out.

@Kars-de-Jong
Copy link
Contributor Author

Kars-de-Jong commented Dec 28, 2024

@zxdavb Done.

ramses_cc % mypy
Success: no issues found in 10 source files
ramses_cc %

@zxdavb
Copy link
Owner

zxdavb commented Jan 5, 2025

@Kars-de-Jong Can you rebase against the latest master - also run:

pytest

@Kars-de-Jong
Copy link
Contributor Author

@zxdavb After running pip install -r requirements_test.txt I could run pytest.

Some tests fail, but not in any code I touched. They also fail on the master branch (this output is from master):

======================================================= short test summary info ========================================================
FAILED tests/tests_old/test_init_data.py::test_services_entry_ - assert 9 == 13
FAILED tests/tests_old/test_init_data.py::test_services_import - AssertionError: assert 9 == 13
FAILED tests/tests_old/test_services.py::test_put_co2_level - AssertionError: Expected 'async_put_co2_level' to have been called once. Called 0 times.
FAILED tests/tests_old/test_services.py::test_put_dhw_temp - AssertionError: Expected 'async_put_dhw_temp' to have been called once. Called 0 times.
FAILED tests/tests_old/test_services.py::test_put_indoor_humidity - AssertionError: Expected 'async_put_indoor_humidity' to have been called once. Called 0 times.
FAILED tests/tests_old/test_services.py::test_put_room_temp - AssertionError: Expected 'async_put_room_temp' to have been called once. Called 0 times.

Results (21.58s):
      91 passed
       6 failed
         - tests/tests_old/test_init_data.py:141 test_services_entry_
         - tests/tests_old/test_init_data.py:164 test_services_import
         - tests/tests_old/test_services.py:390 test_put_co2_level
         - tests/tests_old/test_services.py:403 test_put_dhw_temp
         - tests/tests_old/test_services.py:416 test_put_indoor_humidity
         - tests/tests_old/test_services.py:429 test_put_room_temp

@Kars-de-Jong Kars-de-Jong force-pushed the send_packet_impersonation_support branch from ee366c4 to 07b143b Compare January 6, 2025 08:04
@zxdavb
Copy link
Owner

zxdavb commented Jan 8, 2025

FAILED tests/tests_old/test_...

This is definitely not your fault.

FAILED tests/tests_old/test_init_data.py::test_services_entry_ - assert 9 == 13
FAILED tests/tests_old/test_init_data.py::test_services_import - AssertionError: assert 9 == 13

The above is due to an issue with the quiesce...

I have added this, for future: https://github.com/zxdavb/ramses_cc/wiki/How-to-submit-a-PR

@zxdavb zxdavb merged commit 832ed0b into zxdavb:master Jan 8, 2025
3 checks passed
@Kars-de-Jong Kars-de-Jong deleted the send_packet_impersonation_support branch January 10, 2025 16:44
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

Successfully merging this pull request may close these issues.

2 participants