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

show vacuum's map as camera #369

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

licheng5625
Copy link
Contributor

Hello,
inspired by and partially copied from project , I would like to show vacuums' map on HASS as a camera.

I have a few problems, I need support from experts.

  1. The state of the camera is always unavailbe, even though I can fetch the snapshot
    image

  2. I cannot open the camera view
    image
    error is :
    2022-01-10 05:13:24 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 172.17.0.1 (172.17.0.1). (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36)
    But I can open the link /api/camera_proxy/camera.rockrobo_v1_7d69_vacuum_map?token=55409880 with browser without issue.

  3. When I implement the camera entity, HA was complaining about entity_picture and access_token are missing. But I checked the orignal project or the simplest camera project. None of them set those attributs. I set them mannuly , it could cause the issue 2.

  4. I hava a rockbot vacuum. I am not able to test ViomiVacuum

@al-one
Copy link
Owner

al-one commented Jan 10, 2022

Thanks for your PR !
xiaomi_cloud_map_extractor is an excellent custom component, and it is always updated. I also use it. Maintaining this code takes a lot of time, and I don't think we should build wheels again.

@licheng5625
Copy link
Contributor Author

I took the parse image part. If they could make it as a reuse library, it could be great.

My motivation is to reduce the number of login to xiaomi server. My experience is it causes unstable and make the app on the phone very laggy. If ask me to choose one central place to integrate things about xiaomi, i choose here.

@al-one
Copy link
Owner

al-one commented Jan 10, 2022

Maybe you can try:

try:
    from custom_components.xiaomi_cloud_map_extractor.xiaomi.map_data_parser import MapDataParserXiaomi
except (ModuleNotFoundError, ImportError):
    MapDataParserXiaomi = None

The camera entity works only when the user installs xiaomi_cloud_map_extractor.

@licheng5625
Copy link
Contributor Author

As the auther mentioned here, he might create a new repo to for parsing the image.

But if you have any time, could you help me with the issue 1 and 2 ?

thank you

self.parent = parent
self._map_raw_data = None
@property
def access_tokens(self) -> str:
Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

3 When I implement the camera entity, HA was complaining about entity_picture and access_token are missing. If I do not offer the token. HA will give an error about access token is missing.

Copy link
Owner

Choose a reason for hiding this comment

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

entity_picture should also be managed by HA core.
And your need init the base Camera: Camera.__init__(self) before this line.

@licheng5625
Copy link
Contributor Author

licheng5625 commented Jan 29, 2022

Thanks a lot for your hints. Camera does not work with Basesubentity. I have no idea why.

Test with Rockbot v1 works. Now you could decide wether to merge or not.
If not, just close this PR.

image

@licheng5625
Copy link
Contributor Author

intergrate with wechat notify
IMG_20220308_202556

@BHARATHCK
Copy link

The Map for ijai.vacuum.v* vacuums are not yet supported by Xiaomi cloud map extractor. LINK

Does the map_data_parser in this PR support those?

Just curious. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants