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

Hydrawise: Error during setup #31957

Closed
SeraphimSerapis opened this issue Feb 18, 2020 · 51 comments · Fixed by #34448
Closed

Hydrawise: Error during setup #31957

SeraphimSerapis opened this issue Feb 18, 2020 · 51 comments · Fixed by #34448

Comments

@SeraphimSerapis
Copy link
Contributor

The problem

The hydrawise integration started throwing errors (see below) and doesn't seem to be able to connect to their API anymore.

Environment

  • Home Assistant release with the issue: 0.105.5
  • Last working Home Assistant release (if known): 0.105.4
  • Operating environment (Hass.io/Docker/Windows/etc.): Docker
  • Integration causing this issue: hydrawise
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/hydrawise/

Problem-relevant configuration.yaml

hydrawise:
  access_token: !secret hydrawise_api

Traceback/Error logs

Error during setup of component hydrawise
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 174, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/hydrawise/__init__.py", line 77, in setup
    hydrawise = Hydrawiser(user_token=access_token)
  File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 42, in __init__
    self.update_controller_info()
  File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 65, in update_controller_info
    self.user_id = self.controller_status['user_id']
KeyError: 'user_id'

Additional information

I noticed the problem started on Mon, Feb 17th. This may not be connected to my upgrade to 0.105.5 from 0.105.4.

I also noticed another user having the same issue in #26918

@ccorderod
Copy link

@SeraphimSerapis same problem here. Restoring last snapshot with 0.105.4 does not fix the problem.

@macleodit
Copy link

I have the same issue but I know why it happened.

Last night I logged into my Hydrawise account and they said they were upgrading my portal and my controller would be working offline until it was done.

For the developer, here is the main error:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 174, in _async_setup_component component.setup, hass, processed_config # type: ignore File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/hydrawise/__init__.py", line 77, in setup hydrawise = Hydrawiser(user_token=access_token) File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 42, in __init__ self.update_controller_info() File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 65, in update_controller_info self.user_id = self.controller_status['user_id'] KeyError: 'user_id'

@IanAdd
Copy link

IanAdd commented Feb 18, 2020

Me too. Notification - Invalid Config - Could not setup integration Hydrawise.
Running 0.105.4, tried 105.5 no difference. Did update OS to 3.10 and then 3.11 - related ??

@txwindsurfer
Copy link

Same problem/error report as above starting 2/17/2020. Running OS 3.10 and Hassio 0.105.3. No change in my OS or Hassio configuration from the time it worked fine until errors reported. Component no longer loads after reboot.

@Nick-Adams-AU
Copy link
Contributor

I suspect that the API format has actually changed. Not sure how though as the previous API documentation link is dead so I can't compare.

Looks as though the data is still available, however it is in a different format.

@macleodit
Copy link

Whoever makes this API, here is the response from Hunter:

Hi David, thank you we can see it is working.

http://app.hydrawise.com/api/v1/statusschedule.php?api_key=[myapikey]&hours=168

we are however no longer sending back information that was undocumented.

  • Forecast etc.
    What are you missing?

@edif30
Copy link
Contributor

edif30 commented Feb 19, 2020

@ptcryan was the originating author of the PR - #14055

@codypet
Copy link

codypet commented Feb 20, 2020

Same problem/error report as above starting 2/17/2020. Running OS 3.10 and Hassio 0.105.3. No change in my OS or Hassio configuration from the time it worked fine until errors reported. Component no longer loads after reboot.

Same issue, and I'm using 0.105.3 as well.

2020-02-19 20:27:58 ERROR (MainThread) [homeassistant.setup] Error during setup of component hydrawise
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/setup.py", line 174, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/hydrawise/__init__.py", line 77, in setup
    hydrawise = Hydrawiser(user_token=access_token)
  File "/srv/homeassistant/lib/python3.7/site-packages/hydrawiser/core.py", line 42, in __init__
    self.update_controller_info()
  File "/srv/homeassistant/lib/python3.7/site-packages/hydrawiser/core.py", line 65, in update_controller_info
    self.user_id = self.controller_status['user_id']
KeyError: 'user_id'
2020-02-19 20:28:00 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform hydrawise.binary_sensor: Unable to set up component.
2020-02-19 20:28:00 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform hydrawise.switch: Unable to set up component.
2020-02-19 20:28:05 WARNING (MainThread) [homeassistant.setup] Setup of zone is taking over 10 seconds.
2020-02-19 20:28:06 ERROR (MainThread) [custom_components.eufyrobovac.vacuum] Failed to update RoboVac status: unpack requires a buffer of 2 bytes
2020-02-19 20:28:06 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for mail_and_packages which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-02-19 20:28:06 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform hydrawise.sensor: Unable to set up component.

@CanD42
Copy link

CanD42 commented Feb 22, 2020

I think they introduced now v2 of their api and v1 stopped working, e.g.
https://app.hydrawise.com/api/v1/customerdetails.php?api_key=...&type=controllers
is returned an empty result.

@edif30
Copy link
Contributor

edif30 commented Feb 22, 2020

curl https://app.hydrawise.com/api/v1/statusschedule.php?api_key=???

For me still returns values.

@Nick-Adams-AU
Copy link
Contributor

V1 still works and is now a supported API according to what I have heard.

@edif30
Copy link
Contributor

edif30 commented Feb 22, 2020

@Nick-Adams-AU where is this info? Is this just individual email? Would be good if there was some official communication from Hunter.

@Nick-Adams-AU
Copy link
Contributor

@Nick-Adams-AU where is this info? Is this just individual email? Would be good if there was some official communication from Hunter.

Unfortunately, yes this is just via email. I keep asking them to do some kind of official release management and notification but they won't commit to anything.

Here's what I got from them:

However, having spoken to several customers about the complexity and details required for a GraphQL and oAuth API integration, we recently decided to keep the RESTful API. However, we had to make changes for it to continue and our recent update all of the connecting code for the old RESTful API was removed to allow for a cleaner and neater code structure. The previous API used linking code that was not tested and hard to maintain. The new API uses direct code and is fully tested, however some previous API functions are not available, in this RESTful API.

@CanD42
Copy link

CanD42 commented Feb 23, 2020

yes, the v1 API is still in place but somehow broken. For instance the status schedule API is working:

https://app.hydrawise.com/api/v1/statusschedule.php?api_key=...&hours=24

but the customer details API isn't returning something for me, maybe the renamed it?

https://app.hydrawise.com/api/v1/customerdetails.php?api_key=...&type=controllers

@Nick-Adams-AU
Copy link
Contributor

Both seem to work fine for me @CanD42.

@txwindsurfer
Copy link

Both v1 API links are also working for me. Not sure if this following information is useful at all to anyone as it is far beyond by ability to dig into the code to correct for the changed api. However, I wanted to pass along the little bit I could just in case it helps regarding hassio.

In Hassio I edited the hydrawiser core.py file located in /usr/local/lib/python3.7/site-packages/hydrawiser/core.py and commented out lines:

65 self.user_id = ...
68 self.name = ...
69 self.water_time = ...

Without these lines the hydrawise component loads and the switch device type appears to work as a toggle turning a watering zone one or off.

Binary_sensor device types do not load giving the following error:

Error while setting up hydrawise platform for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 159, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/hydrawise/binary_sensor.py", line 37, in setup_platform HydrawiseBinarySensor(hydrawise.controller_status, sensor_type) File "/usr/src/homeassistant/homeassistant/components/hydrawise/__init__.py", line 118, in __init__ self.data["name"], KeyError: 'name'

Sensor device types load but produce 1 error per zone looking for a "nicetype" attribute:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/hydrawise/sensor.py", line 58, in update if relay["nicetime"] == "Not scheduled": KeyError: 'nicetime'

@sarge31
Copy link

sarge31 commented Feb 26, 2020

Looks like the response no longer has those attributes 'user_id', 'name' and 'watering_time'. The data looks like it is still there. 'watering_time' now appears to be called 'run'. Not sure what was in the other attributes. Does anyone know what the response used to look like?

Edit: Just noticed that the developer has updated the core package that fixes the attributes. Not sure how to update the docker image though :)
[https://github.com/ptcryan/hydrawiser/tree/master/hydrawiser]

@sarge31
Copy link

sarge31 commented Feb 27, 2020

I made some changes to get rid of the errors but some of the sensors may not be setup correctly due to the changes in the API response. Including the changes I made for in case others want to fix or if it helps one of the developers attack the issue.
As I mentioned above, the hydrawiser package, core.py, was updated and removed the self.user_id and self.watering_time attributes. self.name was fixed to pull from the correct value in the json response. All good however when the sensors are being setup for the controller, they are expecting the name in the status attributes. I added:

  `self.controller_status['name'] = self.name` 

I run hassio so making these changes in the container just gets overwritten when restarted. As a workaround, I put the hydawiser package into the config folder (/config/hydrawiser) with the modified core.py.
So had to modify the hydrawise component file as well so put the changes into custom_components under config.
sensor.py
from
`

else:  # _sensor_type == 'next_cycle'
    for relay in mydata.relays:
         if relay["relay"] == self.data["relay"]:
              if relay["nicetime"] == "Not scheduled":
                   self._state = "not_scheduled"
              else:
                  self._state = (
                      relay["nicetime"].split(",")[0]
                      + " "
                      + relay["nicetime"].split(" ")[3]
                  )

to:

    else:  # _sensor_type == 'next_cycle'
        for relay in mydata.relays:
            if relay["relay"] == self.data["relay"]:
                if relay["time"] == 1576800000:
                    self._state = "not_scheduled"
                else:
                    self._state = (
                        relay["timestr"]
                    )

`
The nicetime attribute no longer exists in the new API response so there is no nicely formated time for the next cycle. I've used the timestr attribute but it does not include the date.

Hope this is helpful to others.

@ptcryan
Copy link
Contributor

ptcryan commented Feb 27, 2020

@txwindsurfer, @sarge31, you're on the right track to fixing the issue. There were significant changes between API v1.3 & v1.4 that broke the Hydrawise component for HA.

I've already pushed a new Python library (Hydrawiser v0.2) that works again to the v1.4 API. However, to get the HA component fixed will take more effort. A lot has changed in the HA architecture and component integration since I published the component almost 2 years ago. I'm having to refresh myself with HA to get the Hydrawise component integration fixed and and a new pull request issued.

I do plan to fix the Hydrawise component, but it will take me some time.

@sarge31
Copy link

sarge31 commented Feb 27, 2020

@ptcryan Understand your comment about the architecture, something I need to get across as well.

Appreciate all your efforts in writing this component in the first place and supporting it now. Thanks for the great work.

@txwindsurfer
Copy link

@ptcryan yes, thank you for your support and great work on both the Hydrawiser and Hydrawise component for HA. It is very much appreciated.

@CelestinoMarini
Copy link

@sarge31 Thanks a lot for the workaround explanation. Just a question where I can found the hydrawise component file? thank again

@ptcryan
Copy link
Contributor

ptcryan commented Feb 28, 2020

@CelestinoMarini It's in /homeassistant/components/hydrawise/

@codypet
Copy link

codypet commented Mar 20, 2020

Did this get pushed out in 0.107? I noticed this came up as closed, but I still don't seem to have it working. Thanks in advance.

@ptcryan
Copy link
Contributor

ptcryan commented Mar 20, 2020

@codypet this hasn't been fixed yet. I am working on it. I don't have a specific target in mind.

@PeterPriceE
Copy link

Hello, i am new in this. Can you help me whith the steps to make a custom component for this that at least can trigger ? I cant find the files to do it. A tutorial will be great for the newbees.

@ptcryan
Copy link
Contributor

ptcryan commented Apr 6, 2020

Hello @PeterPriceE, I think what you want to look at is how to add your own custom component. The documentation here should help you with that. As for fixing the integration I am still working on it. I've been pretty busy with other unexpected activities, but I am making progress, however. I am also trying to work with Hydrawise on either using the new v2 API or fixing the v1 API to restore some features that were lost in the new version.

@ptcryan
Copy link
Contributor

ptcryan commented Apr 14, 2020

All, I am still working on fixing this integration. I'm close to issuing a pull request. I have posted a full update on what to expect here. Expect the pull request within a week.

@txwindsurfer
Copy link

Bump this issue that for some reason is not getting integrated into the releases of HA.

@codypet
Copy link

codypet commented May 26, 2020

Bump this issue that for some reason is not getting integrated into the releases of HA.

I was wondering that myself.

@CarpeDiemRo
Copy link

CarpeDiemRo commented Jun 9, 2020

@ptcryan Hello and congrats for your wonderful job. I have an issue with Hydraswise integration. I download the repository from here https://github.com/ptcryan/hydrawiser and I copied hydrawiser folder into custom_components.

Unfortunately, I am unable to integrate the hydrawise and I received the following error
Screenshot 2020-06-09 at 18 42 01

configuration.yaml is this

hydrawise:
  access_token: Fxxxx-5yyyy-6zzz-3tttt

The rest of the configuration

switch:
  - platform: hydrawise
    monitored_conditions: [auto_watering, manual_watering]

sensor:
  - platform: hydrawise
    monitored_conditions: [next_cycle, watering_time]

binary_sensor:
  - platform: hydrawise
    monitored_conditions: [is_watering, status]

I want to mention that I am running on 0.110.6 and with the embedded component, I received the same error.

Did I miss something?

@ptcryan
Copy link
Contributor

ptcryan commented Jun 9, 2020

From what you have shared I don't know exactly what the issue is. The config file looks okay. It's interesting that you are not getting an error for hydrawise.sensor, so that might be a clue.

Make sure your config directory structure looks like this for a custom component:

<config directory>
  |--custom_components
    |--hydrawise
      |--binary_sensor.py
      |--__init__.py
      |--manifest.json
      |--sensor.py
      |--switch.py

You may also have a __pycache__ directory there as well.

Did you look at the Home Assistant log to see the details of the problem? Did you run a config check from the UI? Was that ok?

@txwindsurfer
Copy link

@ptcryan Thank you so much for all the work on this component and improving the code.

The new component is working great for me on a RPi 4 running HA Core 0.110.4 and OS 4.9 (note: I am using your changed hydrawise code from last Friday not the recent revisions you are making and I will wait on those until the PR is merged into HA Core)

As I read @CarpeDiemRo, he incorrectly copied the hydrawiser code into the custom component directory not the hydrawise code. The hydrawise code that should be copied to custom_components is located here:
https://github.com/home-assistant/core/pull/34448/files

The manifest.json file should get the required 0.2 hydrawiser library when HA is rebooted . If it doesn't these files will need to be manually copied into site-packages/hydrawiser.

Thanks again for all you work revising this component.

@CarpeDiemRo
Copy link

From what you have shared I don't know exactly what the issue is. The config file looks okay. It's interesting that you are not getting an error for hydrawise.sensor, so that might be a clue.

Make sure your config directory structure looks like this for a custom component:

<config directory>
  |--custom_components
    |--hydrawise
      |--binary_sensor.py
      |--__init__.py
      |--manifest.json
      |--sensor.py
      |--switch.py

You may also have a __pycache__ directory there as well.

Did you look at the Home Assistant log to see the details of the problem? Did you run a config check from the UI? Was that ok?

It's clear that I missed something. My structure from custom_components is not complete.
Screenshot 2020-06-09 at 20 57 37

On the other hand the downloaded repository has the same structure
Screenshot 2020-06-09 at 21 00 00

...I am a little bit lost. What should I do?

@ptcryan
Copy link
Contributor

ptcryan commented Jun 9, 2020

@CarpeDiemRo I think there might be a couple problems going on. Like @txwindsurfer mentioned, I don't think you're setting up the custom_component correctly.

The first thing we need to check is where your HA configuration directory is. If you don't start there the rest of these steps won't work.

  1. The configuration directory will have a file called configuration.yaml in it. That's the file where you set up the hydrawise component with the access token, etc. On my raspberry pi it's located at /home/homeassistant/.homeassistant.
  2. In that same directory (.homeassistant) you need to have a directory called custom_components.
  3. Inside the custom_components directory is where the hydrawise directory goes. Inside the hydrawise directory should be the following files:
manifest.json
__init__.py
sensor.py
binary_sensor.py
switch.py

I've attached the files that need to go into the hydrawise directory.
Archive.zip

Make sure you put all the files from this zip into the hydrawise directory. If you mix different revisions it may not work.

Give this a try and let me know how it goes.

EDIT: I fixed the contents of the zip file. The files should be correct now.

@PeterPriceE
Copy link

Just tried, it has a problem:

This is my Log:

2020-06-09 18:39:03 ERROR (MainThread) [homeassistant.setup] Error during setup of component hydrawise
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 175, in _async_setup_component
component.setup, hass, processed_config # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/hydrawise/init.py", line 82, in setup
hydrawise = Hydrawiser(user_token=access_token)
File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 42, in init
self.update_controller_info()
File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 65, in update_controller_info
self.user_id = self.controller_status['user_id']
KeyError: 'user_id'
2020-06-09 18:39:04 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform hydrawise.switch: Unable to set up component.

@PeterPriceE
Copy link

This is without the custom component: (is the same)

2020-06-09 18:47:12 ERROR (MainThread) [homeassistant.setup] Error during setup of component hydrawise
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 175, in _async_setup_component
component.setup, hass, processed_config # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/hydrawise/init.py", line 82, in setup
hydrawise = Hydrawiser(user_token=access_token)
File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 42, in init
self.update_controller_info()
File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 65, in update_controller_info
self.user_id = self.controller_status['user_id']
KeyError: 'user_id'
2020-06-09 18:47:12 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform hydrawise.switch: Unable to set up component.

@PeterPriceE
Copy link

this is my System:

arch armv7l
chassis embedded
dev false
docker true
hassio true
host_os HassOS 4.10
installation_type Home Assistant
os_name Linux
os_version 4.19.126-v7l
python_version 3.7.7
supervisor 227
timezone America/Santiago
version 0.110.7
virtualenv false

@txwindsurfer
Copy link

@PeterPriceE the error message you posted indicates that HA is still using the .01 version of hydrawiser or at least that was the log error I always got using the old version of hydrawiser. Evidently the manifest.json did not automatically install the new .02 version of hydrawiser. Please check that line 5 in manifest.json says:
"requirements": ["hydrawiser==0.2"],

You can manually copy the .02 version hydrawiser files in the Docker container located at:
/usr/local/lib/python3.7/site-packages/hydrawiser
with the files from https://github.com/ptcryan/hydrawiser/hydrawiser

I edit files in the Docker container using the SSH and Web Terminal add-on and the command
docker exec -it homeassistant /bin/bash
then navigate to the aforementioned directory and change/replace the 3 files

If you don't feel comfortable changing the Docker container files then you might want to wait a little longer for the PR to be merged into the next release.

@ptcryan
Copy link
Contributor

ptcryan commented Jun 10, 2020

@txwindsurfer is correct. Your HA isn't installing the new Python library for Hydrawiser. For the new integration to work it needs v0.2. The error you're getting is due to HA still using the old v0.1.1 library.

@PeterPriceE
Copy link

Ok, can i use a custom component of hydrawise and hydrawiser to do that? If it is possible, can you give me a link like you did with the hydrawise component?
Thanks for your time

@ptcryan
Copy link
Contributor

ptcryan commented Jun 10, 2020

If you have the right files in the right place in the custom_components directory then HA will automatically update the Hydrawiser Python library to the correct version.

The error above is only going to happen if HA is still trying to run the released Hydrawise integration, not the one that's in the custom_components directory.

If you look in the HA log you should see a line at the beginning of the log that says
WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hydrawise which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

If you don't see that warning then it's pretty likely that HA isn't trying to run the custom component.

@CarpeDiemRo
Copy link

CarpeDiemRo commented Jun 10, 2020

@ptcryan Let's take it step by step:

@CarpeDiemRo I think there might be a couple problems going on. Like @txwindsurfer mentioned, I don't think you're setting up the custom_component correctly.

The first thing we need to check is where your HA configuration directory is. If you don't start there the rest of these steps won't work.

  1. The configuration directory will have a file called configuration.yaml in it. That's the file where you set up the hydrawise component with the access token, etc. On my raspberry pi it's located at /home/homeassistant/.homeassistant.

I am using Home Assistant for more than one year and I have never change the classic folder structure. Therefore, the configuration.yaml file is in the config folder beside the rest of the files: automation.yaml, script.yaml, etc.

  1. In that same directory (.homeassistant) you need to have a directory called custom_components.

custom_compnent folder is placed in the config folder as you can see in the print screen attached
Screenshot 2020-06-11 at 02 20 07
Inside this folder, I have a lots of custom components that are working

  1. Inside the custom_components directory is where the hydrawise directory goes. Inside the hydrawise directory should be the following files:
manifest.json
__init__.py
sensor.py
binary_sensor.py
switch.py

I've attached the files that need to go into the hydrawise directory.
Archive.zip

I create the hydrawise folder and I copied the content of the Archive folder inside it. I tried with Filezilla, but with the classical method as well, by upload one by one

Make sure you put all the files from this zip into the hydrawise directory. If you mix different revisions it may not work.

Give this a try and let me know how it goes.

I restart HA without any reference to hydrawise component in the configuration.yaml. No errors. I put the hydrawise reference and the token in configuration.yaml. I restarted the server. Error was displayed.

  1. Persistent notification:
The following integrations and platforms could not be set up:

hydrawise
Please check your config.
  1. In logs
Logger: homeassistant.setup
Source: components/hydrawise/__init__.py:82
First occurred: 2:14:11 (1 occurrences)
Last logged: 2:14:11

Error during setup of component hydrawise
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 175, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/hydrawise/__init__.py", line 82, in setup
    hydrawise = Hydrawiser(user_token=access_token)
  File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 42, in __init__
    self.update_controller_info()
  File "/usr/local/lib/python3.7/site-packages/hydrawiser/core.py", line 65, in update_controller_info
    self.user_id = self.controller_status['user_id']
KeyError: 'user_id'

This was my experience with the component. What do you recommend to do next?
I am running HA on the following system

Hostname | arhais
-- | --
System | Raspbian GNU/Linux 10 (buster)

Very strange that the content of the .py files from the archive that you attached are HTML files

Screenshot 2020-06-11 at 02 49 04

@txwindsurfer
Copy link

Yes, the problem is that the archive.zip file does not contain the correct files. Something went wrong with @ptcryan created it. For instance the manifest.json file should be:
{ "domain": "hydrawise", "name": "Hunter Hydrawise", "documentation": "https://www.home-assistant.io/integrations/hydrawise", "requirements": ["hydrawiser==0.2"], "codeowners": ["@ptcryan"] }

@CarpeDiemRo
Copy link

@txwindsurfer After I check the content of the files I realized the same thing. @ptcryan Could you send me please, again the files?

@CarpeDiemRo
Copy link

I found the new files on the GitHub. Everything is working just fine. Thanks a lot for the support.

@PeterPriceE
Copy link

Hello, can you give us the link to the files, cant find them.

Muchas Gracias

@ptcryan
Copy link
Contributor

ptcryan commented Jun 11, 2020

@PeterPriceE I updated my earlier post to correct the zip file. Sorry for the mix up.

@gbdesai2004
Copy link

I just setup my new Hydrawise HCC Controller last night and followed the above instructions, I can confirm that the Archive.zip files that I just grabbed this morning are in the right directory and that the manifest file specified version 0.2.

My config matches @CarpeDiemRo 's shown above. I am getting index out of range errors... Could this be because my zone names are too long? I recall somewhere someone saying you had to keep it to 15 characters...

Thanks for the work on the code, it is very much appreciated!

Logger: homeassistant.components.binary_sensor
Source: custom_components/hydrawise/binary_sensor.py:62
Integration: Binary sensor (documentation, issues)
First occurred: 8:36:13 AM (3 occurrences)
Last logged: 8:36:14 AM

hydrawise: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 319, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
    self.update  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/hydrawise/binary_sensor.py", line 62, in update
    relay_data = mydata.relays[self.data["relay"] - 1]
IndexError: list index out of range

@IanAdd
Copy link

IanAdd commented Jul 11, 2020

I had to shorten zone names to get mine to work with this custom version.

@gbdesai2004
Copy link

gbdesai2004 commented Jul 11, 2020

I had to shorten zone names to get mine to work with this custom version.

Excellent, will give it a go, thanks!

UPDATE: Unfortunately that wasn't it. I have 28 zones and 3 of them are inactive. Wonder if I'm throwing some edge case error.

UPDATE 2: Eureka! Yeah it doesn't like empty zones. After I created TEMP1, TEMP2, and TEMP3 for my 3 unused zones, it was happy, guess I should report this.

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

Successfully merging a pull request may close this issue.