webdjoe / pyvesync_v2

Python Library for controlling vesync API for all etekcity smart outlets, switches and bulbs and Levoit Air Purifier
MIT License
30 stars 17 forks source link

Install on Hassio? #13

Open ThirteenTX opened 4 years ago

ThirteenTX commented 4 years ago

If I wanted to install this on Hassio could I just copy the files from the src folder into the custom components folder on hassio? The air purifier settings I have been using are under the mark perdue pyvesync project but it doesn't support sleep. I wanted to test and see if this fixes it. There is no PIP on hassio that I can tell.

webdjoe commented 4 years ago

No there is definitely no pip on hassio. I don't know too much about the hassio plugins, I use docker myself. I know there is a custom plugin (plugin) that allows you to install custom plugins from a github repo. You might want to look into that. For the sleep mode issue, I'm using packet captures sent to me by someone with the air purifier. The user did test the functions out and indicated everything was functioning properly. From what I can tell, calling device.sleep_mode() should set the air purifier into sleep mode. If you want to capture the packets toggling sleep mode from the app, I will take a look to see if I'm missing anything.
And the feature you requested to turn display on/off has been added and the new pypi package is uploaded 👍

ThirteenTX commented 4 years ago

Still trying to work this out. So far I found that trying to pull this with the "git pull" add-on wipes your config replacing it with only the files from the repo and you have to reload from backup. I tried using

pip3 install pyvesync_v2

from the "SSH & Web Terminal" add-on and it says it installs successfully but nothing seems to happen. I'll try some more things tomorrow and see if I can get it worked out. I tried comparing it to the other repo as his works by putting it in the custom_components folder but nothing seems to happen there when I put these files instead. I'll update you if I figure out anything.

ThirteenTX commented 4 years ago

So I noticed there is no manifest.json in yours so I tried to make my own.

    {
      "domain": "vesync",
      "name": "pyvesync_v2",
      "documentation": "https://github.com/webdjoe/pyvesync_v2",
      "dependencies": [],
      "codeowners": ["@markperdue", "@webdjoe"],
      "requirements": ["pyvesync_v2==1.1.0"]
    }

It seems to do something because it creates a pycache folder. It still doesn't add anything devices though. I'm sure there is a lot I don't understand because I am not a developer and I just started doing python tutorials so I could try and understand this better. I'll keep trying to plug along and see if I can get it working though.

webdjoe commented 4 years ago

I've been there, I haven't been working with python very long myself so I'm learning as I go as well. This repo is the library that an HA component can interact with to control your devices. It provides methods and properties (turn_on(), turn_off(), etc.) that allow you to control and monitor your devices from a program, whether it be HA or your own custom script. HA needs a way to communicate with this library and that's where the HA components come into play. There is a vesync component already built in to HA but it only currently supports the outlets. The HA devs made a rule that you can only add support for one platform at a time, so the outlets were the initial goal and I haven't gotten a chance to make it much further. You might have luck trying to use the custom component from https://github.com/markperdue/pyvesync/tree/master/home_assistant/custom_components and following the directions here https://github.com/markperdue/pyvesync#integration-with-home-assistant. Just make sure you update the requirements key in manifests.json to reference this pypi package as you did in yours