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

Expose detection parameters for SNZB-03P #215

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

carterbox
Copy link

@carterbox carterbox commented Sep 27, 2024

This older(?) PIR occupancy device has some of the same parameters as the newer SNZB-06P. You can manually set them through the zigbee device management menu, but it would be nicer if there was a button in the main UI. The 03P model is a PIR sensor, but it still uses the ultrasonic tagged parameters to control the device. The PIR parameters all have a value of None. These parameters are settable if you have the official Sonoff hub/app.

This older(?) PIR occupancy device has some of the same parameters
as the newer SNZB-06P. You can manually set them through the zigbee
device management menu, but it would be nicer if there was a button in the
main UI. The 03P model is a PIR sensor, but it still uses the ultrasonic
tagged parameters to control the device. The PIR parameters all have a
value of None.
@carterbox
Copy link
Author

I don't know how to test these changes. The recent splitting of zha from homeassistant-core has me confused. I own the device in question, but I'm not sure how to get these changes into my homeassistant instance which is running on a homeassisant green.

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.42%. Comparing base (62ec158) to head (83c4046).
Report is 20 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #215   +/-   ##
=======================================
  Coverage   96.42%   96.42%           
=======================================
  Files          61       61           
  Lines        9390     9390           
=======================================
  Hits         9054     9054           
  Misses        336      336           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dmulcahey dmulcahey changed the title NEW: Expose detection parameters for SNZB-03P Expose detection parameters for SNZB-03P Oct 4, 2024
@TheJulianJES TheJulianJES added the entities Issue or PR about (custom) entities label Oct 18, 2024
@TheJulianJES
Copy link
Contributor

@carterbox There are multiple ways. You could set up a custom zha component, change the manifest (to include a version) and swap out the zha library for a GitHub branch of yours, but that has the potential to break things.

Another (also hacky) way, although likely less error-prone, would be to go into the homeassistant container shell (e.g. via SSH or a Portainer addon, might need to unhide the container from settings there).
Then, you can edit the file via vi for example (or replace it via basic commands by just copying from /config for example). To edit:

  1. Enter the homeassistant container shell either via a Portainer addon from the community or by entering this via SSH or the HA console: login, docker exec -it homeassistant /bin/sh
  2. Enter this: vi /usr/local/lib/python3.12/site-packages/zha/application/platforms/number/__init__.py
  3. Scroll down to the line you want to edit (line numbers are shown at the bottom)
  4. Navigate your cursor to where you want to add your change
  5. Press i for insert mode
  6. Make the change
  7. Press ESC to get out of insert mode
  8. Type :wq (write + quit)
  9. Press enter
  10. Then, restart Home Assistant and see if your change works as expected.

Do note that upgrading Home Assistant will revert that change. Do also note that you can break Home Assistant. Have backups ready.

@carterbox carterbox marked this pull request as ready for review October 20, 2024 17:26
@carterbox
Copy link
Author

Thanks for the help. I was able to edit the files directly once I setup developer access over SSH to the homeassistant host. The SSH add-on does not allow access to the relevent folders the default way.

I've tested these changes. The timeout definitely works. The sensitivity probably works. It's a bit hard to tell the difference with PIR sensors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
entities Issue or PR about (custom) entities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants