Hive Integration

Hi @Dan1

With regards to the colour not working for you on your bulb. This should be available in the 2nd round of hive changes in the official HA releases. I have the code for the colour bulb ready and working. After finishing it, I decided to focus more on the conversion from custom component to hive officially in HA. But this code will be being moved into the 2nd official HA release.

Thanks @Khole - looking forward to that. Quick question regarding sensors. I’m getting a large lag for the automation to run compared to the native hive app - is this expected?

Hi @Dan1

The hive component in home assistant gets new data from the Hive API by default every two minutes as state changes are not pushed from the Hive API to home assistant. So if your home assistant just got new data and then there was motion detect straight after by one of your sensors, you would have to wait the full two minutes before you would see this new state in home assistant.
Going the other way around is pretty much instant, so if you use home assistant to turn on a Hive switch or Hive light, home assistant will immediately make that command to the Hive API and then update all hive entities in home assistant with the latest data for all devices so you see that result in home assistant straight away.

with the scan_interval configuration option on the official release (or minutes_between_updates in the custom component) you can set the time between API calls for new data down to 1 minute to speed it up a bit.

Hi @Dan1

Just a follow up point to @rendili comment that’s worth mentioning. With regards to the motion sensor state going back to no motion. Hive has its own delay there as hive has to detect no physical motion for x amount of minutes before the sensor pushes an state update to no motion.

Thanks @Khole and @rendili. For now i’m relying on hive to react to motion - unfortunately this means I can’t use the sun as a condition to react differently (brightness levels and whether or not to activate). Mainly using assist for scenes (e.g dim lights in lounge and turn all other lights off). I suppose I could spot if a light is on and set brightness according to sun horizon…

Absolute genius, I have been waiting for this you have made my weekend. Any chance of the hive plugs anytime soon ? :slight_smile:

@prgg

:slight_smile: glad you like

the Hive plugs should already be included and added automatically
Do they not appear anywhere on the home page in home assistant?

I don’t have any Hive plugs, but my z-wave plugs were automatically added to a group on the home page called “Switches”

Yep got them missed the py file middle of the post, Christmas light ready for full automation !!!

Hi @prgg

When you say you missed the py file are you using hive through the custom component files? We have just added hive so its built into HA in the 0.59 release. see 0.59 release notes for link to documentation

I am using the custom branch as a prefer the integration

As I want to carry on using the heating sensors from before, most useful bits for me, will I just need to replace the hive.py I’m already using or remove it. allow the official one to set itself up and then add the new unofficial one?

Hello

Sorry for the delay.

As you may have noticed, 0.59 has been released, and this includes the Hive integration, so now there is no need for downloading and copying custom component files (well almost depending on preference, see following).

So for those of you who have no need for the extra heating sensors, then all you need to do is delete all custom component hive.py files from your custom_component folder structure, update your configuration.yaml to include only username and password (plus optionally scan_interval) and restart HA. The names of entities will be a bit different (they are no longer prefixed by hive) so group configurations and automations will need a little update.

The documentation for the official release is here

For those (like me, and I think @Bobby_Nobble whose reply came in whilst I was composing this :slight_smile: ) who like the heating sensors, then I have re-written the sensors custom component file to work with the official release. so you need to do as above, but also download the new custom component file and copy it to the custom_component\sensor folder.

For now I will be storing any custom_component files on GitHub so that it will be just one link and file version so people will not have to hunt around for the latest version in this discussion:

Hive for Home Assistant custom component files

@prgg,
Out of interest, which aspect of the custom component setup do you prefer over the official release?
Does using the official release and adding the sensor custom component bring them inline for you?

2 Likes

Thank you guys for your continued development on Hive.

I have added @rendili hive.py file into my custom_component\sensor. Do I need to do anything else as I can see lots of errors in my log and no sensors exist. I have removed all the previous custom sensors before upgrading to 0.59.

Thanks

2017-12-04 10:58:23 ERROR (MainThread) [homeassistant.core] 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/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 126, in _async_setup_platform
    self.hass, self.config, self.domain, platform_type)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/setup.py", line 241, in async_prepare_setup_platform
    platform = loader.get_platform(domain, platform_name)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/loader.py", line 104, in get_platform
    return get_component(PLATFORM_FORMAT.format(domain, platform))
  File "/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/loader.py", line 142, in get_component
    module = importlib.import_module(path)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 669, in exec_module
  File "<frozen importlib._bootstrap_external>", line 775, in get_code
  File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/sensor/hive.py", line 7
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax

hi @gr4z,

Just to check, did you download from the GitHub link above the new sensor hive.py file and copy to your custom_component sensor directory?

All I needed to do on my installation was delete all hive.py files from the custom_component folder structure, including the top level folder hive.py file. update the configuration.yaml file as in the official documentation, then upgrade to 0.59
This then had the new version missing the sensors, I then copied the new sensor custom component hive.py file to the custom_component/sensor directory, restarted home-assistant service and the original sensors appeared (but with a different name)

Your continued commitment to this is much appreciated, many thanks.

1 Like

Yep deleted all previous stuff and downloaded the new hive.py from Github and placed into the custom_components\sensor folder. Added my Hive credentials into configuration.yaml (well they were already there) and restarted.

I can see the heating and hot_water components but none of the extra ones. Do I need to reference them anywhere?

Hi @gr4z

If you have a “pycache” folder in the custom component folder or any of its sub-directories. Try deleting the folders as I have had issues with them holding data in the past and updates/new files not working properly.

ah yes. good point, I keep forgetting about that, thanks @Khole

@gr4z, if that does not fix the issue, then please could you delete all hive.py files from the custom_component folder and all folder below, then restart the home assistant service.
Do you then get any errors in the log and do you get 2 or 3 (depending on whether you have hotwater or not through Hive) Hive entities in the GUI. climate.heating, climate.hot_water and sensor.hive_hub_status?

Also, the old state names, SCHEDULE, MANUAL & OFF, should be replaced with auto, heat & off

OK cleared all the files and folders and re-downloaded the github files. Restarted and all seems OK now.

Must of been a corrupted .py file!

Thanks for your help.

1 Like

excellent, glad it’s all up and running and working for you :slight_smile: