Hive Integration

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

Excellent, thanks for the feedback

@rendili, thank you for getting this sorted so quickly.
All works perfectly again. :grin:
Many thanks for your hard work.

1 Like

Great stuff, glad it works, thanks for the feedback :slight_smile:

Hi @rendili, I can confirm that the update works for me as well. Thank you for the quick response.

1 Like

Hi @yakox. good to hear that it works for you too, thanks for the feedback :slight_smile:

Hi Fellow Hive’ers,

I’m trying to get to grips with automating my hive central heating, but I’m kinda falling at the first hurdle.

There are a couple of things that I want to do:

  1. Create a simple button/switch/toggle in lovelace to boost the heating for an hour
  2. Build an automation to turn the heating on between times.

Do you guys have any examples that you provide??

I have also provided some failing code below (not sure how to set the target temp??):

- id: 'Heating_boost_night'
  alias: 'Heating Boost Night'
  trigger:
    - platform: numeric_state
      entity_id: sensor.house_temperature
      below: '18'
      for:
        minutes: 30
  condition: 
    - condition: time
      after: '21:00:00'
      before: '05:00:00'
    - condition: state
      entity_id: group.family
      state: 'home'
  action:   
    - service: climate.set_operation_mode
      data:
        entity_id: climate.heating
        operation_mode: 'heat'
#        temperature: '24'
    - service: notify.gmail_notify
      data:
        title: 'Heating Boost Cold Night'
        message: ''

@Martin_Granger

Regarding point one this not possible yet but we are trying to create a custom boost service for hive to allows this.

With regards to the automation set operation doesn’t support setting temperature. If you use the set temperature service you should be able to achieve what you need see docs

Many thanks for this information!

I have managed to build a boost button of sorts by using an input boolean and an automation. I then just added the switch to lovelace. See the code below:

- id: 'heating_boost'
  alias: 'Heating Boost'
  initial_state: true
  trigger:
    - platform: state
      entity_id: input_boolean.heating_boost
      to: 'on'
  condition:
  action:
    - service: climate.set_operation_mode
      data:
        entity_id: climate.heating
        operation_mode: 'heat'
    - service: climate.set_temperature
      entity_id: climate.heating
      data_template:
        temperature: '25'
    - service: notify.gmail_notify
      data:
        title: 'Heating Boost'
        message: ''
    - delay: '01:00:00'
    - service: homeassistant.toggle
      entity_id: input_boolean.heating_boost