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

✨ [feature] Add support for Shock sensor #143

Merged
merged 16 commits into from
Jan 13, 2024
Merged

✨ [feature] Add support for Shock sensor #143

merged 16 commits into from
Jan 13, 2024

Conversation

pbuckley4192
Copy link
Contributor

Hi,

First off, thanks for writing this App. It saved my IQPanel 2 from the scrap heap!

I noticed my setup uses "shock" sensors which werent supported by the App.

Error Seen:
2024-01-05 14:15:43.717826 WARNING qolsys_panel: sensor of unknown type: {'id': '170-7272', 'type': 'Shock', 'name': 'Upstairs Shock Detector', 'group': 'shock', 'status': 'Closed', 'state': '0', 'zone_id': 14, 'zone_physical_type': 12, 'zone_alarm_type': 0, 'zone_type': 107, 'partition_id': 0}

I've added the code needed locally and tested it against my setup. It functions as expected.

More than open to feedback!

Copy link
Owner

@xaf xaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello!

Thank you for contributing!
Could you please add the relevant test and fixtures too?

You should have the following files modified by this PR to ensure we're testing the right stuff:

  • apps/qolsysgw/mqtt/updater.py
  • apps/qolsysgw/qolsys/sensors.py
  • tests/end-to-end/test_qolsysgw.py
  • tests/integration/test_qolsys_events.py
  • tests/mock_modules/testutils/fixtures_data.py

apps/qolsysgw/mqtt/updater.py Outdated Show resolved Hide resolved
apps/qolsysgw/qolsys/sensors.py Show resolved Hide resolved
@pbuckley4192
Copy link
Contributor Author

I'll take care of these on Monday! Thanks for the feedback!

@pbuckley4192
Copy link
Contributor Author

All files updated.

  • apps/qolsysgw/mqtt/updater.py
  • apps/qolsysgw/qolsys/sensors.py
  • tests/end-to-end/test_qolsysgw.py
  • tests/integration/test_qolsys_events.py
  • tests/mock_modules/testutils/fixtures_data.py

Note: I found a missing dependency in requirements-tools.txt. Took the chance to add it.

Copy link
Owner

@xaf xaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another few comments, and there's two tests failing.
One of them related to the expected number of sensors in the tests, since this adds one :)

tests/requirements-tools.txt Outdated Show resolved Hide resolved
apps/qolsysgw/mqtt/updater.py Outdated Show resolved Hide resolved
tests/integration/test_qolsys_events.py Show resolved Hide resolved
@pbuckley4192
Copy link
Contributor Author

Made the required changes, thanks for the feedback

@xaf
Copy link
Owner

xaf commented Jan 12, 2024

Still some failing tests, are you able to fix that? :)

@pbuckley4192
Copy link
Contributor Author

Done, that failing test should work now.

@xaf
Copy link
Owner

xaf commented Jan 13, 2024

It seems to be failing at the e2e tests now :(

It is because the group here is written with a capital S: https://github.com/XaF/qolsysgw/pull/143/files#diff-94f35fef3f4d094a51239e392ab0d740b53bfb8f3462e6ec246865437e0799c5R382
While the end-to-end tests are written with a lowercase s.

According to your message in the PR description, I believe it's supposed to be a lowercase s for shock, which means you will need to update it at the line I quoted, as well as in the unit tests! Thanks a lot for your time in contributing this :)

I'll try to apply the changes from GitHub directly and re-run the tests!

apps/qolsysgw/qolsys/sensors.py Show resolved Hide resolved
tests/integration/test_qolsys_events.py Outdated Show resolved Hide resolved
tests/mock_modules/testutils/fixtures_data.py Outdated Show resolved Hide resolved
tests/integration/test_qolsys_events.py Outdated Show resolved Hide resolved
@xaf
Copy link
Owner

xaf commented Jan 13, 2024

Ok, we're good! 🎉
Thanks for the PR!

@xaf xaf changed the title Enable Shock Sensor Support ✨ [feature] Add support for Shock sensor Jan 13, 2024
@xaf xaf merged commit b324b54 into xaf:main Jan 13, 2024
8 checks passed
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