Hive Integration

Hi @gr4z

Are you able to send a screenshot?
I have also just updated my UAT environment to 0.77.1 and I don’t see anywhere where it shows this and I have no errors in my log.

Here is a screenshot for some of the Hive bits on the Home page:
image

Do you see undefined instead of C?

Included in the 0.77.0 release there was a PR #16012 to remove something to do with climate devices removal of unit of measurement, but I am not clear how this relates to Hive, plus none Hive components were listed as impacted.

ok, thanks, but I am not sure what could be wrong.

One big difference between our setups is that you are using HASSIO and I don’t, but I am surprised if that is causing the error as I thought that essentially both versions should behave the same with core stuff and components and it is only underlying method of install and maintenance that is different.

It would be interesting to know if others using HASSIO with 0.77.1 are having the same error (and also if anyone not using HASSIO have the error too)

running hass.io 77.1 and no errors here using the most recent dev custom component if that makes a difference.

@PianSom

Hi I am going to look at setting this up on my machine tonight are the errors still happening on your machine?

@PianSom

I have installed the custom component and ran it for a while tonight. I don’t seem to get the icon error.

@morning_call

Do you use the custom component if you do. have you had any errors related to retrieving the battery icon.

Thanks @morning_call, it is good to know, but puzzling as to why the error is happening for gr4z

Hi @Khole

I am using the custom component and I see the battery icon errors, my production system is still on 0.72.1 and for me the errors only seem to happen overnight for some reason.
I tried to replicate the issue on UAT environment with 0.77.1 but did not get the errors, but then I did not leave overnight yet

@rendili

This is really bizarre. I can’t understand why an error would only occur overnight. I have 77.2 setup on my UAT system and ran it from about 7PM to 9:30PM with out issues. Just out of curiosity what percentage is the battery that gets the error at? Mine where 60% and 100% for different devices. Do you have the custom component from the dev branch?

@PianSom

What percentage battery level where the devices when you got the error?

Hi @Khole

I am still seeing the errors - sporadically. Last time was between 02.06 and 02.08 this morning.

Battery usage is still the same as my screen shot above - 40%/100%

I am on 0.76.2.

Odd behaviour - I just hit the button to see the full error log on the dev-info screen, just to check when for any errors previous to this morning. That crashed Safari for some reason, but when I restarted I saw 12 errors like this:

Log Details (ERROR)
Sat Sep 01 2018 08:07:17 GMT+0100 (BST)

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 230, in async_update_ha_state
    icon = self.icon
  File "/home/homeassistant/.homeassistant/custom_components/sensor/hive.py", line 380, in icon
    return icon_for_battery_level(battery_level=int(self.batt_lvl))
ValueError: invalid literal for int() with base 10: 'UNKNOWN'

(BTW I will be away for a couple of weeks from later today. I’ll be able to dial-in to home, but may well be delayed in responses. Sorry about that.)

Hi @Khole

I had no errors last night, and I have only the battery in my thermostat which is currently mostly at 60% but bounces down to 40% occasionally. I don’t know what percentage it is at when the errors occur, I will try and trace back in the logs next time the error occurs.
I have the custom component from the master branch at the moment, but happy to try the one from dev

For your error today @PianSom i think this could be caused when a battery level could not be retrieved by the library from the Hive API (either no data in hive or no connection to hive) and it could return unknown as the value, the helper / hive code is expecting an int and not a string so errors. We should probably change the return value for when no data is retrieved from the Hive API to 0, or whatever was cached from last time.

in fact i wonder if the error with @PianSom setup today is the same for all?
The error i get could indicate the same thing, so i am wondering that sometimes our API can not get the battery data from the Hive API and when that happens we return a string, in the case of @PianSom error above ‘unknown’, and the helper errors.
I can check in our library code later (maybe tonight) to see if this is the case

@rendili

That was my original thought but what I couldn’t understand was the value we use for the status is the same value we use for the icon but we don’t get errors for the status and it we never get a status of unknown. That’s the confusing bit.

@rendili @Khole

FWIW my preference for the situation where the battery state (or indeed any other sensor variable) cannot be retrieved or is unknown would be to display that, rather than zero or the last known value.

For example, elsewhere I use the mdi:battery-alert icon at the end of an if test for battery level >= 0%

Hi all

I am really really confused now. I have setup the component again, I have my hive credentials in my configuration.yaml file and the custom_components setup. When I check my config I receive the error

Component not found: hive

WTF?

I rebooted and see this error in the log

Setup failed for hive: Component did not return boolean if setup was successful. Disabling component.

I am lost as to what has caused all this, as it was working perfectly up until yesterday. The only changes are 0.77 and the new authenitcation system.

EDIT: I have removed this custom component and reverted back to the built in (but with less features) Hive component. This is working with the same credentials.

Hi @PianSom

Good news I think, if use the icon helper as intended and pass is none instead of “UNKNOWN” then the icon returned should be mdi:battery-unknown and your battery test codes should also work
We should be able to bodge the custom component to do this easily (I can do this later tonight @Khole if you like?) and then release a proper update via the API later.

Hi @gr4z

For me i’m afraid that this is probably beyond my knowledge to assist with. I am wondering whether this could be to do with the type of installation you have combined with what you have configured with the new authentication system, but I don’t have enough knowledge about the new system to know for sure.

Hi,

If anyone would like to try a new version of the custom component, I have made an update to the dev branch of the custom component file on GitHub which will hopefully bodge in a fix at this level until we can get a good fix in place in the library as this will require an update to the main hive component.

I am running this updated version on my production system now and all appears ok at the moment, but time will tell as I seem to only get the errors overnight.

Hi,

Using the UK version of Hive, if that makes a difference.

I’m trying to exclude all the lights from the Hive setup, I linked my Hue lights to Hive and I don’t want to see them twice in HA, when I put this in the configuration.yaml file:
hive:
username: YourHiveUserName
password: YourHivePassword
devices:
- hive_heating
it gives me an error that devices is an invalid option for [hive]

Any ideas?

@icewraithuk

Are you using a custom component for hive or the built in integration?