RobertD502 / home-assistant-petkit

Home Assistant integration for PetKit devices
MIT License
156 stars 24 forks source link

Support for YumShare Solo #49

Closed ydogandjiev closed 7 months ago

ydogandjiev commented 7 months ago

Hello, thank you for the great integration! It's very easy to setup and works really well. I do wonder if you can add support for the YumShare Solo feeder that Petkit just recently released: https://petkit.com/products/yumshare-solo-with-camera

I just bought one on Black Friday but it doesn't show up as one of the my devices when I configure this integration. My Eversweet Solo 2 and cats showed up without any issue so I know the integration is configured correctly. If you need any help getting the API data for the device, please let me know how to collect the necessary information.

Thanks again for building this helpful integration!

RobertD502 commented 7 months ago

Thanks for the support! You aren't mistaken, the feeder isn't supported yet - work is currently in progress for the dual hopper version of the Yum share, but I'll work on getting the solo supported as well. Once I have more time, I'll need to sniff out the communication for the solo to get it integrated.

** Just so I don't get your hopes up, I have to break it to you that the yumshare camera won't be supported due to how they deliver the video stream. PETKIT uses the Agora platform to deliver live streams, which isn't supported by Home Assistant camera entities.

stale[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

xswxm commented 7 months ago

@RobertD502 why not modify the petkitaio module directly and merge it into this intergration directly. Because some devices types, like d4sh (same as d4s, different name in China), are not included in the petkitaio module. And, I believe most devices share the same protocols and have similar json structures.

Here is my modified version, added support for d4sh device and Chinese translation. petkit.zip

xswxm commented 7 months ago

one more thing, the video clips can also be downloaded from the cloud directly (up to 1~2 days) even without subscriptions, the encryption method of the video files is quite easy to be decrypted. However, the live stream, i believe petkit uses tencent xp2p technology, and its pks canbe extracted from the protcols. However, it definetly need more work to make it work without the petkit app.

Another,,,,,,, the petkit feeders use Ingenic T31 chips, which means we can flash the openipc firmware into these machines, but there will another bunch of work to make the wifi & ble chips to work. And I am not good at it.

RobertD502 commented 7 months ago

The petkitaio library will remain as a separate repo with releases pushed to/fetched from PyPi as this is considered best practice for Home Assistant integrations when dealing with external APIs. In addition, the petkitaio library isn't just for this integration - as a separate library it is intended to be open for use by anyone for their own projects. Adding the library directly as part of the integration would mean maintaining the library in two separate places.

Reason for why some petkit devices aren't included:

Although on the surface the d4sh may look to be the exact same as the d4s, there are several things which are handled differently. The most basic differences are several keys which differ between the two (and some exact keys even have completely different possible values, which will determine how the same key is interpreted depending on which feeder you are looking at) and, on the more extreme end of the spectrum, differing API calls for control of each device/some features that are missing on the d4sh that you'd expect to be there since they look to be the same device aside from the camera. Only devices which have had their specific API nuances reverse engineered and the resulting code changes/additions extensively tested make it into the library as supported devices. Adding the device type code to the supported list just for the sake of increasing the number of supported devices can result in incomplete/broken functionality for the device that is being added and at worst a broken petkitaio library and resulting broken Home Assistant integration - this isn't a good user experience, and I am actively avoiding going down this path.

Regarding video clips:

Yes, these are easily downloaded....that is if you are referring to the clips PetKit calls vlogs. Based on my own testing, vlogs are only created when there are enough clips AND the creation of the vlog has been initiated by the user via the app (they aren't automatically created). If you are referring to decrypting the clips which are only accessibly if a user has a subscription then my stance on this is that they will not be included in this integration. From a legality standpoint, I'm not going to provide code to users that is actively used to unlawfully gain access to features which require a paid subscription. This is a surefire way of getting into both legal trouble and giving PetKit a reason to actively pursue killing off this integration.

Regarding live video:

As mentioned in a previous comment above, live streams are delivered via the Agora platform (maybe they deliver streams differently for China-specific devices). I have the credentials necessary to access live streams via the platform, but Home Assistant does not have support for streams handled by the Agora platform. There is a Agora Python SDK which would need to be used to access live streams. However, the resulting stream output is not one which is supported by the Home Assistant camera entity, so, the SDK is useless to us.

If live streams are delivered via a different method to Chinese users, the streams will only work in Home Assistant if the stream url is usable by ffmpeg or if there is a WebRTC option. Whatever the case may be, I won't be able to add such support myself given my region and only having access to the international version of the app.

The only camera specific function which will be in the integration is pulling the most recent picture taken by the camera. For all other functions (live streaming, vlog creation/playback, and, if the user has an active subscription, viewing clips) users will need to use the app with a secondary account that has the feeder shared to it.

I have already been working on support for the d4sh - this may not be evident based on the current state of the repos as I only push the code changes from my local dev environment to the petkitaio and home assistant integration repos once all the work is completed.

Regarding flashing alternative firmware:

That is great news! I'm sure individuals will be interested in following your journey, if that is something that you intend to pursue. As this isn't the goal of this integration/it can lead to cluttering up the repo with discussions not directly related to this project, discussions regarding flashing alternative firmware are more appropriate in another place - if you start a repo documenting your current progress, I bet individuals will follow along and will be more than willing to provide help along the way.

Hope this clears some things up.

stale[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Cyrelion commented 3 months ago

Hello,

is there any update on the Yumshare Solo support? Would be great to get this supported. Video isn’t highly required, the normal sensors and triggering feeding would be absolutely enough for me.

Jezza34000 commented 3 months ago

Hi ! What's new about this feeder support ? I got one, i can help...

Cyrelion commented 3 months ago

I‘ve got a dual hopper now. So anything new?

Jezza34000 commented 3 months ago

I've try the version from @xswxm and it work very well. Did you work on it from this last .zip version ? What do you plan for DS4h support @RobertD502 ? Any help wanted to work on some feature ?

hyperfive commented 1 month ago

I would be willing to contribute / sponsor someone to get the yum dual hopper working

RobertD502 commented 1 month ago

I would be willing to contribute / sponsor someone to get the yum dual hopper working

Dual hopper is being worked on at the moment. Check out the discord development channel where I just shared an update.

shenmirenQUQ commented 1 month ago

@RobertD502为什么不直接修改 petkitaio 模块并将其直接合并到此集成中。因为某些设备类型,如 d4sh(与 d4s 相同,在中国名称不同),不包含在 petkitaio 模块中。而且,我相信大多数设备共享相同的协议并具有相似的 json 结构。

这是我修改后的版本,增加了对 d4sh 设备和中文翻译的支持 。petkit.zip

你好,d4sh是solo那个型号的吗?