From 4c65bde6cc003e9dd828ef22fb56e0c82d7dee08 Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Wed, 3 Feb 2021 23:02:39 +0100 Subject: [PATCH] Add deprecation warning --- README.md | 139 +++++++++++---------------- custom_components/prosenic/vacuum.py | 3 + info.md | 93 +++++++++--------- release.sh | 0 4 files changed, 106 insertions(+), 129 deletions(-) mode change 100644 => 100755 release.sh diff --git a/README.md b/README.md index 015a0e7..850eae3 100644 --- a/README.md +++ b/README.md @@ -1,83 +1,68 @@ -[![License][license-shield]](LICENSE.md) ![Project Maintenance][maintenance-shield] +[![License][license-shield]](LICENSE.md) -[![hacs][hacsbadge]][hacs] +# [DEPRECATED] Prosenic Home Assistant component -# Prosenic Home Assistant component -## My prosenic vacuum broke some days ago and I bought a vacuum robot from a different manufacturer. I will discontinue this component, but leave it on HACS. +## My prosenic vacuum broke and I bought a vacuum robot from a different manufacturer. I will archive this component and therefore also remove it from HACS. Feel free to fork it and take over. -A full featured Homeassistant component to control Prosenic vacuum cleaner locally without the cloud. +A full featured Homeassistant component to control Prosenic vacuum cleaner locally without the cloud. This component is based on the underlying PyTuya library available [here][pytuya]. ## Towards Homeassistant official integration -My personal goal is to make this component fully compliant with Homeassistant, so -that it may be added as the official library to handle Prosenic vacuum cleaners. + +My personal goal is to make this component fully compliant with Homeassistant, so +that it may be added as the official library to handle Prosenic vacuum cleaners. However, before pushing a PullRequest to the official Homeassistant repository, I would like to share it to some users. -In this way we can test it massively, check it for any bug and make it **robust enough** to be seamlessly integrated +In this way we can test it massively, check it for any bug and make it **robust enough** to be seamlessly integrated with Homeassistant. -For now, the component has been integrated as a custom component into [HACS][hacs]. - ## Installation -You can install this component in two ways: via HACS or manually. -HACS is a nice community-maintained components manager, which allows you to install git-hub hosted components in a few clicks. -If you have already HACS installed on your HomeAssistant, it's better to go with that. -On the other hand, if you don't have HACS installed or if you don't plan to install it, then you can use manual installation. - -## Option A: Installing via HACS -Search for "Prosenic Vacuum Cleaner" and click on Install: when done, proceed with component setup. - -## Option B: Classic installation (custom_component) -1. Download the latest zip release archive from [here][release-zip] (or clone the git master branch) -1. Unzip/copy the prosenic direcotry within the `custom_components` directory of your homeassistant installation. -The `custom_components` directory resides within your homeassistant configuration directory. -In other words, the configuration directory of homeassistant is where the configuration.yaml file is located. -After a correct installation, your configuration directory should look like the following. - ``` - └── ... - └── configuration.yaml - └── secrects.yaml - └── custom_components - └── prosenic - └── __init__.py - └── const.py - └── ... - ``` - - **Note**: if the custom_components directory does not exist, you need to create it. - -## Component setup + +You can install this component manually. + +1. Download the latest zip release archive from [here][release-zip] (or clone the git master branch) +2. Unzip/copy the prosenic direcotry within the `custom_components` directory of your homeassistant installation. + The `custom_components` directory resides within your homeassistant configuration directory. + In other words, the configuration directory of homeassistant is where the configuration.yaml file is located. + After a correct installation, your configuration directory should look like the following. + `└── ... └── configuration.yaml └── secrects.yaml └── custom_components └── prosenic └── __init__.py └── const.py └── ...` + + **Note**: if the custom_components directory does not exist, you need to create it. + +## Component setup + Once the component has been installed, you need to configure it in order to make it work. First we need to find out the _device_id_, _ip address_ and _local key_ of your prosenic vacuum cleaner. Todo that you have multiple options: - * Use *mitmproxy* to intercept the connection between the prosenic app and the tuya cloud (Described below and I used this approach) - * Read the following [link][tuyaapi-docs] - + +- Use _mitmproxy_ to intercept the connection between the prosenic app and the tuya cloud (Described below and I used this approach) +- Read the following [link][tuyaapi-docs] + ### Extracting the required data with mitmproxy. 1. First we need to setup mitmproxy. The easiest way is to setup a docker container. Other installation type can be found [here][mitmproxy-install] - Below the docker-compose script, which will setup mitmproxy on port 8080 with the web interface on port 8081 - ```yaml - version: "3.3" - services: - mitmweb: - ports: - - "8080:8080" - - "127.0.0.1:8081:8081" - image: mitmproxy/mitmproxy - entrypoint: "mitmweb --web-iface 0.0.0.0" - ``` -1. - * If you have an iPhone or iPad, use please one of these device as the setup is easier there. - Setup the proxy to point to your docker container. A tutorial can be found [here][ios-proxy]. - Afterwards go to _mitm.it_ and install the certificate. The tutorial for this step can be found [here][mitmproxy-certs] - * If yoi have a rooted Android device, then you can install the certificate nearly the same way as iOS. Only be sure you install it as System Certificate. - * If you have a "normal" (not rooted) Android device, please refer to this tutorial [here][mitmproxy-android] - + Below the docker-compose script, which will setup mitmproxy on port 8080 with the web interface on port 8081 + ```yaml + version: "3.3" + services: + mitmweb: + ports: + - "8080:8080" + - "127.0.0.1:8081:8081" + image: mitmproxy/mitmproxy + entrypoint: "mitmweb --web-iface 0.0.0.0" + ``` +1. - If you have an iPhone or iPad, use please one of these device as the setup is easier there. + Setup the proxy to point to your docker container. A tutorial can be found [here][ios-proxy]. + Afterwards go to _mitm.it_ and install the certificate. The tutorial for this step can be found [here][mitmproxy-certs] + - If yoi have a rooted Android device, then you can install the certificate nearly the same way as iOS. Only be sure you install it as System Certificate. + - If you have a "normal" (not rooted) Android device, please refer to this tutorial [here][mitmproxy-android] + 1. Open the prosenic app and refresh all your devices -1. On the computer, where your mitmproxy docker container is running, open the following link [http://localhost:8081](http://localhost:8081) +1. On the computer, where your mitmproxy docker container is running, open the following link [http://localhost:8081](http://localhost:8081) 1. There you should see some request to the tuya cloud. Depending on your region, you should see request to tuyaeu.com or similar. -Click on the first of these requests and a detail view will be open on the right hand sight. Go to the response and search for _localKey_ -You should get similar result as the follwoing: + Click on the first of these requests and a detail view will be open on the right hand sight. Go to the response and search for _localKey_ + You should get similar result as the follwoing: + ```json ... "result": [{ @@ -108,15 +93,18 @@ You should get similar result as the follwoing: }] ... ``` + You will need the _localKey_ and the _devId_ (device id). ### Find out the local ip address of your vacuum robot There are multiple ways to find out the local ip address of your vacuum robot: -* Login into your router or dhcp server and check there for the assigned ip address -* Run nmap to find all devices in your network. -The Prosenic (Cocosmart) 820T has the open port 6668. -So we can search for devices, which have open this port with the following script. Please adjust the command, that nmap is searching your network. + +- Login into your router or dhcp server and check there for the assigned ip address +- Run nmap to find all devices in your network. + The Prosenic (Cocosmart) 820T has the open port 6668. + So we can search for devices, which have open this port with the following script. Please adjust the command, that nmap is searching your network. + ```shell script nmap -p 6668 192.168.0.0/24 --open ``` @@ -124,16 +112,9 @@ nmap -p 6668 192.168.0.0/24 --open ### Configuration via editing configuration.yaml 1. Enable the component by editing the configuration.yaml file (within the config directory as well). -Edit it by adding the following lines: - ```yaml - vacuum: - - platform: prosenic - host: YOUR_IP - device_id: YOUR_DEVICE_ID - local_key: YOUR_KEY - remember_fan_speed: false #Optional, default false - ``` - **Note!** If you have already configured other vacuum robot, add your configuration there. + Edit it by adding the following lines: + `yaml vacuum: - platform: prosenic host: YOUR_IP device_id: YOUR_DEVICE_ID local_key: YOUR_KEY remember_fan_speed: false #Optional, default false ` + **Note!** If you have already configured other vacuum robot, add your configuration there. 1. Reboot hassio 1. Congrats! You're all set! @@ -148,19 +129,15 @@ The integration is communicating locally only, so you can block the access of yo If you find a problem/bug or you have a feature request, please open an issue. - ## What's next? + - Better error handling - Automated test -[hacs]: https://hacs.xyz -[hacsbadge]: https://img.shields.io/badge/HACS-DEFAULT-inactive?style=for-the-badge [license-shield]: https://img.shields.io/github/license/edenhaus/ha-prosenic?style=for-the-badge -[maintenance-shield]: https://img.shields.io/badge/Maintainer-Robert%20Resch-blue?style=for-the-badge [pytuya]: https://github.com/clach04/python-tuya [tuyaapi-docs]: https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md [release-zip]: https://github.com/edenhaus/ha-prosenic/releases/latest/download/prosenic.zip - [mitmproxy-install]: https://docs.mitmproxy.org/stable/overview-installation/ [mitmproxy-certs]: https://docs.mitmproxy.org/stable/concepts-certificates/ [mitmproxy-android]: https://docs.mitmproxy.org/stable/howto-install-system-trusted-ca-android/ diff --git a/custom_components/prosenic/vacuum.py b/custom_components/prosenic/vacuum.py index de8058d..57d3106 100644 --- a/custom_components/prosenic/vacuum.py +++ b/custom_components/prosenic/vacuum.py @@ -152,6 +152,9 @@ class FanSpeed(Enum): async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Prosenic vacuum cleaner robot platform.""" + _LOGGER.warn("Component is not maintained anymore and will be removed from HACS soon.") + _LOGGER.warn("The repository of this component will be archived soon.") + if DATA_KEY not in hass.data: hass.data[DATA_KEY] = {} diff --git a/info.md b/info.md index 3631f27..1921dad 100644 --- a/info.md +++ b/info.md @@ -1,42 +1,47 @@ -[![License][license-shield]](LICENSE.md) ![Project Maintenance][maintenance-shield] +[![License][license-shield]](LICENSE.md) -# Prosenic Home Assistant component -A full featured Homeassistant component to control Prosenic vacuum cleaner locally without the cloud. +# [DEPRECATED] Prosenic Home Assistant component + +## My prosenic vacuum broke and I bought a vacuum robot from a different manufacturer. I will archive this component and therefore also remove it from HACS. Feel free to fork it and take over. + +A full featured Homeassistant component to control Prosenic vacuum cleaner locally without the cloud. This component is based on the underlying PyTuya library available [here][pytuya]. -## Component setup +## Component setup + Once the component has been installed, you need to configure it in order to make it work. First we need to find out the _device_id_, _ip address_ and _local key_ of your prosenic vacuum cleaner. Todo that you have multiple options: - * Use *mitmproxy* to intercept the connection between the prosenic app and the tuya cloud (Described below and I used this approach) - * Read the following [link][tuyaapi-docs] - + +- Use _mitmproxy_ to intercept the connection between the prosenic app and the tuya cloud (Described below and I used this approach) +- Read the following [link][tuyaapi-docs] + ### Extracting the required data with mitmproxy. 1. First we need to setup mitmproxy. The easiest way is to setup a docker container. Other installation type can be found [here][mitmproxy-install] - Below the docker-compose script, which will setup mitmproxy on port 8080 with the web interface on port 8081 - ```yaml - version: "3.3" - services: - mitmweb: - ports: - - "8080:8080" - - "127.0.0.1:8081:8081" - image: mitmproxy/mitmproxy - entrypoint: "mitmweb --web-iface 0.0.0.0" - ``` -1. - * If you have an iPhone or iPad, use please one of these device as the setup is easier there. - Setup the proxy to point to your docker container. A tutorial can be found [here][ios-proxy]. - Afterwards go to _mitm.it_ and install the certificate. The tutorial for this step can be found [here][mitmproxy-certs] - * If yoi have a rooted Android device, then you can install the certificate nearly the same way as iOS. Only be sure you install it as System Certificate. - * If you have a "normal" (not rooted) Android device, please refer to this tutorial [here][mitmproxy-android] - + Below the docker-compose script, which will setup mitmproxy on port 8080 with the web interface on port 8081 + ```yaml + version: "3.3" + services: + mitmweb: + ports: + - "8080:8080" + - "127.0.0.1:8081:8081" + image: mitmproxy/mitmproxy + entrypoint: "mitmweb --web-iface 0.0.0.0" + ``` +1. - If you have an iPhone or iPad, use please one of these device as the setup is easier there. + Setup the proxy to point to your docker container. A tutorial can be found [here][ios-proxy]. + Afterwards go to _mitm.it_ and install the certificate. The tutorial for this step can be found [here][mitmproxy-certs] + - If yoi have a rooted Android device, then you can install the certificate nearly the same way as iOS. Only be sure you install it as System Certificate. + - If you have a "normal" (not rooted) Android device, please refer to this tutorial [here][mitmproxy-android] + 1. Open the prosenic app and refresh all your devices -1. On the computer, where your mitmproxy docker container is running, open the following link [http://localhost:8081](http://localhost:8081) +1. On the computer, where your mitmproxy docker container is running, open the following link [http://localhost:8081](http://localhost:8081) 1. There you should see some request to the tuya cloud. Depending on your region, you should see request to tuyaeu.com or similar. -Click on the first of these requests and a detail view will be open on the right hand sight. Go to the response and search for _localKey_ -You should get similar result as the follwoing: + Click on the first of these requests and a detail view will be open on the right hand sight. Go to the response and search for _localKey_ + You should get similar result as the follwoing: + ```json ... "result": [{ @@ -67,15 +72,18 @@ You should get similar result as the follwoing: }] ... ``` + You will need the _localKey_ and the _devId_ (device id). ### Find out the local ip address of your vacuum robot There are multiple ways to find out the local ip address of your vacuum robot: -* Login into your router or dhcp server and check there for the assigned ip address -* Run nmap to find all devices in your network. -The Prosenic (Cocosmart) 820T has the open port 6668. -So we can search for devices, which have open this port with the following script. Please adjust the command, that nmap is searching your network. + +- Login into your router or dhcp server and check there for the assigned ip address +- Run nmap to find all devices in your network. + The Prosenic (Cocosmart) 820T has the open port 6668. + So we can search for devices, which have open this port with the following script. Please adjust the command, that nmap is searching your network. + ```shell script nmap -p 6668 192.168.0.0/24 --open ``` @@ -83,16 +91,9 @@ nmap -p 6668 192.168.0.0/24 --open ### Configuration via editing configuration.yaml 1. Enable the component by editing the configuration.yaml file (within the config directory as well). -Edit it by adding the following lines: - ```yaml - vacuum: - - platform: prosenic - host: YOUR_IP - device_id: YOUR_DEVICE_ID - local_key: YOUR_KEY - remember_fan_speed: false #Optional, default false - ``` - **Note!** If you have already configured other vacuum robot, add your configuration there. + Edit it by adding the following lines: + `yaml vacuum: - platform: prosenic host: YOUR_IP device_id: YOUR_DEVICE_ID local_key: YOUR_KEY remember_fan_speed: false #Optional, default false ` + **Note!** If you have already configured other vacuum robot, add your configuration there. 1. Reboot hassio 1. Congrats! You're all set! @@ -106,20 +107,16 @@ The integration is communicating locally only, so you can block the access of yo If you find a problem/bug or you have a feature request, please open an issue. - ## What's next? + - Better error handling - Automated test -[hacs]: https://hacs.xyz -[hacsbadge]: https://img.shields.io/badge/HACS-DEFAULT-inactive?style=for-the-badge [license-shield]: https://img.shields.io/github/license/edenhaus/ha-prosenic?style=for-the-badge -[maintenance-shield]: https://img.shields.io/badge/Maintainer-Robert%20Resch-blue?style=for-the-badge [pytuya]: https://github.com/clach04/python-tuya [tuyaapi-docs]: https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md [release-zip]: https://github.com/edenhaus/ha-prosenic/releases/latest/download/prosenic.zip - [mitmproxy-install]: https://docs.mitmproxy.org/stable/overview-installation/ [mitmproxy-certs]: https://docs.mitmproxy.org/stable/concepts-certificates/ [mitmproxy-android]: https://docs.mitmproxy.org/stable/howto-install-system-trusted-ca-android/ -[ios-proxy]: http://www.iphonehacks.com/2017/02/how-to-configure-use-proxy-iphone-ipad.html \ No newline at end of file +[ios-proxy]: http://www.iphonehacks.com/2017/02/how-to-configure-use-proxy-iphone-ipad.html diff --git a/release.sh b/release.sh old mode 100644 new mode 100755