Hive Integration

Thanks Rendili,

I did this but it seemed to make no difference. I then found for some reason home assistant wasn’t restarting when i hit restart. Now I have done a re-boot all is working as it should.

Many thanks for your help.

1 Like

I’m in the same situation, since updating I only have default Hive integration entities:

climate.heating
sensor.hive_hub_status

I’ve downloaded the new sensor.py file, updated the folder structure and rebooted multiple times, as well as fully powered off my HASS.io instance but no dice, it won’t pickup the additional sensors. I also, cannot use the devices: option in config.yaml, it responds with a devices is not a valid option type error.

I’m mainly interested in the Thermostat status for when Hive inevitably goes offline.

Thanks.

Hi all
I have configured the Hive component, and checked that my API credentials are correct by using the pyhiveapi package. The API is correctly returning my devices (thermostat only) BUT is not retuning any data, e.g. temperatures are all 0.0. Also in HA there are no errors, but the sensors do not show up. Any advice on troubleshooting? I did just install the hardware an hour ago, so perhaps it takes a few hours for the data connection to go live?
Thanks
Robin

Hi robin,

looking through your GitHub link it looks like for your test you are passing your hotwater nodeID to get the temperatures instead of your heating NodeID, this could be why the tests are not working.
I forget off the top of my head which contains the temperature data, but the two Nodes are the Thermostat and the heating, but one contains some of the data and the other the rest of the data.

Looking at the rest of the information on your GitHub page, it looks like the tests to Get temperature
may have been done with the HotWater NodeID ending in 244, instead of the HeatingID ending with d08. Please could you confirm?

Are you seeing all the normal info in the Hive website, such as current temp and target temp?

hi @ichiban

what do you have in your configuration.yaml file for setting up hive?
just username and password?
you should have only something as below, and don’t need a separate entry for sensor

hive:
  username: YOUR_USERNAME
  password: YOUR_PASSWORD

do you have anything in the log? you should have at least one entry mentioning that you are using a customcomponent for hive.

Thanks @rendili I’ve selected the correct nodeID and am now seeing correct and updated data in my jupyter notebook. However I still am not seeing any hive entities in HA, nor any errors, any advice on this? Cheers

Hi @robmarkcole

So just to clarify, you don’t see the inbuilt HA devices for climate of Heating and Hotwater:
image

If you see those and not the others, then the others come from a custom component sensor file.

If you don’t see those then I don’t really know what could be going on as it sounds like the Hive system is working as it should and the pyhiveapi is working ok with getting the data.

Just to double check, have you looked in Unused entities?

@rendili I discovered the error, in my config my I had my username where password was required and vice-versa (using secrets), probably should print an error on invalid config and fail setup of the component :slight_smile:

hi @robmarkcole

good to hear you got it working, and yes, good point regarding having an error output :slight_smile:

in fact, checking the code, it should add an error to the log if it fails to setup the component:
_LOGGER.error("Hive API initialization failed")
This is added to the log if the returned device list is none, but maybe we made some coding changes since that error condition was added which means still no devices but also the device list is not none

needs further investigation I feel…

1 Like

Yup, just the username and password at the moment - I tried with the devices: but received the error described earlier. So I shouldn’t be using the sensor.py file? But then, how I enable the additional sensors?

Prior to the upgrade I had just the username and password and the hive.py in the custom components folder which worked.

Nothing in my log about custom components.

Cheers.

Hi

All you need in your configuration file is just the following:

    hive:
      username: YOUR_USERNAME
      password: YOUR_PASSWORD

even with the custom sensor component for hive nothing else is needed in the configuration.yaml

adding the sensor.py file will override the built in hive sensors file and add the additional sensors not included in the built in file.

If it is picking up the hive sensor custom component then on restart you should see something like the following early on in your log file:

2019-03-01 14:17:50 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sensor.hive 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.

If this is the case then all the extra sensors from the custom component will automatically get loaded at start up. (maybe they will appear in Unused entities and you will need to add them to a tab)

If this is not working after a change of directory structure and file name then I can only think that the follow might help:

  • Check for the additional hive sensors in Unused entities
  • Delete all old folder structures from legacy structure design, and restart
  • Delete any __pycache__ directories, and restart

Just a note on this and might be something worth checking.

I was having the same issue as this and it turned out to be that the custom component I downloaded was converted to an html file with totally different text even though it was sensors.py, so make sure to get the RAW file and check it

1 Like

I have been using the hive custom component for ages with no issues. Have just upgraded from HA .87 to .89, downloaded latest hive/sensor.py file and removed all traces of old sensor/hive.py.

When I start HA I see the following error in the HA log:

Error during setup of component hive
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/setup.py", line 154, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
AttributeError: module 'custom_components.hive' has no attribute 'setup'

Any ideas?

1 Like

Hi @rendili

I have just upgraded to HA 89 and it seems all the entities relating to this custom component have disappeared again. Is there a new version coming that will deal with the latest changes in HA.

Many thanks

Hi

With the release of 0.89.0 the way Custom Components are handled is very different. AS far as I understand it, no longer are we able to create a custom component for just one aspect of an integration, we have to replace the entire integration.

What this means for the Hive Component / Platform and Custom Component is that the way we have all be using the Custom Component in the passed, including the new directory structure from the 0.88.0 release will no longer work. We cant just override the sensor integration with a custom sensor.py file, we have to override everything, heating, hotwater, lights, switches and the main hive hub code too.

If you do this though, what will happen is that when you upgrade HA to the latest version, if there is any change in Hive code then you will not pick this up automatically, you will need to re-copy the latest files for all Hive files again, then re-copy the custom component.

As far as the code in the Hive custom component goes, I don’t think any change is needed, and I don’t think any code has changed (I will check) in the main Hive code files.

To get this working now, I think you have to copy all the files below, except sensor.py to your custom components directory:

Then copy the custom component sensor.py file from below to your custom components directory:

This hopefully should then work again. but you will need to re-copy the none sensor.py files again each time there is a change to Hive code

I have not had time to test, hopefully Monday I will get some time to do this.

2 Likes

Many thank @rendili , I’ll give it a go and see if that works.

1 Like

Hi @rendili

I have tried the above but it doesn’t seem to like it.
I get a notification after restarting as follows:

'The following components and platforms could not be set up:

hive.sensor

Please check your config’

Exact same my end

Hi @GuruPG & @grom.m20b25, thanks for the feedback.

I managed to find some time to look more closely in to this and thanks to pnbruckner have come up with a solution that at least works on my DEV setup.

What this does is make all of Hive a custom component, but for all components except sensor will redirect to the built-in Hive code and for the sensor component use the custom component code.
In the future if there are any Home Assistant releases that have updated Hive code, then this will automatically be picked up in the usual way of upgrading Home Assistant.
If there is an update to the custom component code, then the latest code will still need to be downloaded from the above location.

It pretty much the same as before, except we need to copy more files for the initial setup, and for each component there will be a warning in the log to say it is a custom component, which except for sensor, it really isn’t.

2019-03-08 22:42:07 WARNING (MainThread) [homeassistant.loader] You are using a custom component for hive 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.
2019-03-08 22:42:09 WARNING (MainThread) [homeassistant.loader] You are using a custom component for hive.sensor 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.
2019-03-08 22:42:09 WARNING (MainThread) [homeassistant.loader] You are using a custom component for hive.climate 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.
2019-03-08 22:42:09 WARNING (MainThread) [homeassistant.loader] You are using a custom component for hive.light 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.

You will get one warning entry for each Hive component you use. I don’t have any switches or hive sensors, so my setup does not try and load those components, so I don’t get those warnings.

please let me know if this does not work for you, and I will take another look.

2 Likes

so far it looks good to me thanks.

1 Like