-
-
Notifications
You must be signed in to change notification settings - Fork 50
Adding methods to set "indoor only" and "outdoor" states to a pet #223
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
base: dev
Are you sure you want to change the base?
Conversation
Adding the ability to set a pet as "indoor only" or "outdoor"
|
How is the "outdoor" mode supposed to work? Does this still allow the cat to get out but not in again? Or is it the same like unassigning the cat from the corresponding flap? And is it possible that this functionality is not available in the Sure flap application itself? Because I think it is a missed feature there. |
Outdoor means that the cat is allowed outdoors, indoor only essentially blocks the cat leaving but always let's them in. This allows multi pet household to allow some in and out. The surepet app has this ability but you have to manually trigger it. I am in a situation where I want to stop one of my cats going out at night. Curfew mode stops ALL cats leaving, so I had to manually trigger this mode each night, now with this HA config I can automatically call the service to set it. |
|
So individually set-able for each cat
? |
Not quite, outdoor is just "normal" as in the cat is an outdoor cat. Yes these are in the app but not exposed to homeassistant as not in the API currently. |
|
Ahh now I see - sorry that took me too long. But a feature like "outdoor only" would also be surprising since the App does not support that either. But the app supports a different feature: Unassigning and Reassigning cats to the flap. I think this is also not possible yet with surepy and SureHA. |
|
Hi, thanks a lot for maintaining this project! I’d really love to see this PR merged, it would help a lot with my setup. |
|
Thanks to @bushbrother for making this change. I've been needing this feature since literally forever. If this could be merged @benleb then that would be incredible! |
|
@bechu89 - Thanks! You can manually do this by downloading the client.py raw file and swapping it on your system? I only updated that single file. |
Thanks for the quick response. I'm not sure exactly how to do that unfortunately - any pointers would be very much appreciated. I only really know how to edit the sureha files. |
|
@bechu89 - what is your setup? I assume running Homeassistant? You need to find surepy library in HA machine. I am running supervised and HA as a VM, but the path should be the same regardless. /usr/local/lib/python3.13/site-packages/surepy/ You need to reboot HA to take effect. If you update HA core you will need to do this again. You can then use my repo to pull my modified SureHA (awaiting merge still), that should then expose these functions in HA. |
|
Thanks @bushbrother. I'm using VMware Workstation to run Home Assistant on a virtual machine. I managed to replace the client.py file in surepy (the path was the same!). I also used your fork of SureHa too. My issue now is that I can't set up a SureHa integration. Every time I login I get "authentication_failed". The error from the log is: Logger: custom_components.sureha.config_flow Source: custom_components/sureha/config_flow.py:47 integration: SureHA (documentation, issues) First occurred: 9:28:04 PM (2 occurrences) Last logged: 9:28:35 PM I'm definitely putting in the right credentials though! |
|
@bechu89 I had this same issue a couple of times. No idea what causes it, but you can fix by removing and re-adding surepy, use pip uninstall surepy and then pip install surepy within your VM. Then replace the client.py file again. |
|
@bushbrother thanks again. I've taken the following steps. I'm getting the same results though. Am I doing something wrong? Do I need to remove SureHa too? Step 1: Remove SurePy |
|
You may need to restart after the reinstall of surepy. Also check chmod and chown for client.py, should be same as other files in that directory |
It works! Thank you so much @bushbrother - you're a life saver. |
|
@bechu89 That is great to hear! Does the SureHA work as expected? I have only had my own setup to try against. You should have a switch for each cat exposed to set the mode and then 2 additional attributes within the cat data showing which mode they are set as. Note that it can take some seconds to update the switch due to surepetcare.io taking a while to do it's thing. |
|
It does indeed work as expected. I can confirm that there is a mode switch, with the logbook updating as the mode is switched on (indoor mode enabled) and off (indoor mode disabled). Automations to enable mode and disable mode work as intended. |
|
Excellent! Thanks for the feedback!
…On Thu, 11 Sept 2025, 11:36 bechu89, ***@***.***> wrote:
*bechu89* left a comment (benleb/surepy#223)
<#223 (comment)>
It does indeed work as expected. I can confirm that there is a mode
switch, with the logbook updating as the mode is switched on (indoor mode
enabled) and off (indoor mode disabled). Automations to enable mode and
disable mode work as intended.
—
Reply to this email directly, view it on GitHub
<#223 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXZIYJQWWANGQX33TEL3D33SFGBHAVCNFSM6AAAAAB6GWD3YSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENZZHAZDKOBZGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Out of interest. What is the different profiles, what is the purpose for it? Instead of number can it be a enum to clearly describe it instead of a number? |
|
@FredrikM97 - The mode attribute is the enum of the profile ID. 2 is Outdoor, 3 is Indoor only. I exposed the id number and the enum into the attributes in SureHA. The API requires it as a number against the pet, in the logs it's clearly labeled. |
|
Meant that either Where 2 instead is an Enum in case of API changes. I also noticed in the swagger api that there is a endpoint to fetch devices for a pet. Could be used for validation/fetching available devices to reduce complexity in SureHA. |
|
Got you, happy for you to modify the code ... just didn't think those would
ever change
…On Wed, 17 Sept 2025, 21:57 Fredrik Mårtensson, ***@***.***> wrote:
*FredrikM97* left a comment (benleb/surepy#223)
<#223 (comment)>
Meant that either
The methods could be one method and take the profile as input with a Enum
type for validation. Alternatively
response and response.get("data", {}).get("profile") == 2:
Where 2 instead is an Enum in case of API changes. I also noticed in the
swagger api that there is a endpoint to fetch devices for a pet. Could be
used for validation/fetching available devices to reduce complexity in
SureHA.
—
Reply to this email directly, view it on GitHub
<#223 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXZIYKZP3CC2OXENNZKGM33THDKBAVCNFSM6AAAAAB6GWD3YSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMBUGUZTSOBWG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Made my own integration instead which include a similar solution. Just wanted to point out so this integration is easy to maintain in the future. Overall it is a great idea and nice that you found it! |
|
Can you share the link? Thanks
…On Fri, 19 Sept 2025 at 12:08, Fredrik Mårtensson ***@***.***> wrote:
*FredrikM97* left a comment (benleb/surepy#223)
<#223 (comment)>
Made my own integration instead which include a similar solution. Just
wanted to point out so this integration is easy to maintain in the future.
—
Reply to this email directly, view it on GitHub
<#223 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXZIYPBYFTFWVIENON5F3T3TPP3BAVCNFSM6AAAAAB6GWD3YSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMJRG43TMNJUGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Sure https://github.com/FredrikM97/hass-surepetcare and https://github.com/FredrikM97/py-surepetcare At first I hoped that I could merge py-surepetcare with surepy but I think dont think it is possible to due the difference in structure. |
|
For those interested, I have opened a PR for home-assistant/core which implements this feature without requiring changes to this library. See home-assistant/core#158073 It's working well for me |
Is it possible to do the same for this repository as I'm using it outside of HomeAssistant? |
That's what this PR from @bushbrother does, however it would need one of the maintainers to review and merge in (which I am not). That's why I've opened the HA PR in a way which doesn't depend on changes to this library, to hopefully get this feature into HA quicker. |
Adding the ability to set a pet as "indoor only" or "outdoor"