Hive Integration

@Khole Great Work!

B24 Installed and I have full Heating & Hot Water control including current states. (Hot Water is labelled as Heating 2 and Heating State 2 but that could just be my entities being duplicated and easily renamed to Hot Water)

Thank you for getting these updates out so quickly! (Especially at this time of year! Brrrrrrrrrrrr)

Kind regards

Mark

I seem to be having an issue controlling Hive Lights and Plugs with b24.

2020-12-05 15:50:10 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140027683381840] '"status"'

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service

await hass.services.async_call(

File "/usr/src/homeassistant/homeassistant/core.py", line 1451, in async_call

task.result()

File "/usr/src/homeassistant/homeassistant/core.py", line 1486, in _execute_service

await handler.job.target(service_call)

File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service

await self.hass.helpers.service.entity_service_call(

File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 499, in entity_service_call

future.result() # pop exception if have

File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call

await coro

File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 536, in _handle_entity_call

await result

File "/config/custom_components/hive/__init__.py", line 228, in wrapper

await func(self, *args, **kwargs)

File "/config/custom_components/hive/light.py", line 133, in async_turn_off

await self.hive.light.turn_off(self.device)

File "/usr/local/lib/python3.8/site-packages/pyhiveapi/light.py", line 178, in turn_off

resp = await self.hive.set_state(data["type"],

File "/usr/local/lib/python3.8/site-packages/pyhiveapi/hive_async_api.py", line 177, in set_state

await self.request('post', url, data=jsc)

File "/usr/local/lib/python3.8/site-packages/pyhiveapi/hive_async_api.py", line 55, in request

await self.log.log(

File "/usr/local/lib/python3.8/site-packages/pyhiveapi/custom_logging.py", line 42, in log

logging_data = name + new_message.format(data)

KeyError: '"status"'

Also received the following following the restart.

2020-12-05 15:41:21 ERROR (MainThread) [homeassistant.components.light] Error adding entities for domain light with platform hive

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities

await asyncio.gather(*tasks)

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 384, in _async_add_entity

device_info = entity.device_info

File "/config/custom_components/hive/light.py", line 55, in device_info

"model": self.device["device_data"]["model"],

KeyError: 'model'

2020-12-05 15:41:21 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform hive

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities

await asyncio.gather(*tasks)

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 384, in _async_add_entity

device_info = entity.device_info

File "/config/custom_components/hive/sensor.py", line 63, in device_info

"model": self.device["device_data"]["model"],

KeyError: 'model'

2020-12-05 15:41:21 ERROR (MainThread) [homeassistant.components.light] Error while setting up hive platform for light

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 207, in _async_setup_platform

await asyncio.gather(*pending)

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities

await asyncio.gather(*tasks)

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 384, in _async_add_entity

device_info = entity.device_info

File "/config/custom_components/hive/light.py", line 55, in device_info

"model": self.device["device_data"]["model"],

KeyError: 'model'

2020-12-05 15:41:21 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up hive platform for sensor

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 207, in _async_setup_platform

await asyncio.gather(*pending)

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities

await asyncio.gather(*tasks)

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 384, in _async_add_entity

device_info = entity.device_info

File "/config/custom_components/hive/sensor.py", line 63, in device_info

"model": self.device["device_data"]["model"],

KeyError: 'model'

@keviny Thanks for that the quick fix for the first issue would be to switch the debugger off in the hive options via the integrations page.

Can I also ask regarding the second one have you deleted your previous Hive setup and reset Hive back up again with beta 23/24?

Deleting the Hive Integration, followed by a Restart and then adding the Integration and restarting seems to have fixed the issue.

The only difference I think this time was that I did not enable any categories to debug.

Thanks for the update.

Thanks for the feedback. Interestingly I tried that and restarted the server but that didn’t resolve the issue. Deleting the integration and restarting and then adding it again and restarting appears to work.

Thanks for the hard work, I’m getting my Hive systems back by using HACS and b24, however some scripts/automations are no longer working. Is this still valid for setting the brightness?

lounge_standard_lamp_on_with_check:
alias: Lounge standard lamp on (with check)
sequence:

  • condition: state
    entity_id: binary_sensor.patio_door
    state: ‘off’
  • data:
    brightness_pct: 80
    service: light.turn_on
    entity_id: light.lounge_standard_lamp

I’m now getting errors like this
Lounge standard lamp on (with check): Error executing script. Unexpected error for call_service at pos 2: Bad Request
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 253, in _async_step
await getattr(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 460, in _async_call_service_step
await service_task
File “/usr/src/homeassistant/homeassistant/core.py”, line 1451, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1486, in _execute_service
await handler.job.target(service_call)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 499, in entity_service_call
future.result() # pop exception if have
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 664, in async_request_call
await coro
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 536, in _handle_entity_call
await result
File “/usr/src/homeassistant/homeassistant/components/light/init.py”, line 230, in async_handle_light_on_service
await light.async_turn_on(**params)
File “/config/custom_components/hive/init.py”, line 228, in wrapper
await func(self, *args, **kwargs)
File “/config/custom_components/hive/light.py”, line 128, in async_turn_on
await self.hive.light.turn_on(self.device, new_brightness, new_color_temp, new_color)
File “/usr/local/lib/python3.8/site-packages/pyhiveapi/light.py”, line 201, in turn_on
return await self.set_brightness(device, brightness)
File “/usr/local/lib/python3.8/site-packages/pyhiveapi/light.py”, line 227, in set_brightness
resp = await self.hive.set_state(data[“type”],
File “/usr/local/lib/python3.8/site-packages/pyhiveapi/hive_async_api.py”, line 177, in set_state
await self.request(‘post’, url, data=jsc)
File “/usr/local/lib/python3.8/site-packages/pyhiveapi/hive_async_api.py”, line 71, in request
raise HTTPBadRequest
aiohttp.web_exceptions.HTTPBadRequest: Bad Request

Just looking at the second issue, that error was with beta 24. It appears to relate to the three lighting groups I have.

Not a major issue for me.

Everything else seems to be working fine. Also with the beta 24 update (or an earlier version 22/23) the quick action buttons are also not showing up as Switches / Plugs within Home Assistant which is also a result.

Thanks for all your hard work @Khole.

Kevin

Thanks @Proxlx sensor.upstairs_boost_2 was able to tell me when the boost is on or off. It used to work via water_heater.hot_water but I guess that has changed. Will update my automation to reflect

I’m also seeing this
ogger: homeassistant.helpers.entity
Source: helpers/entity.py:305
First occurred: 16:32:15 (3 occurrences)
Last logged: 16:32:15

  • Entity sensor.pi_mode is incorrectly being triggered for updates while it is disabled. This is a bug in the hive integration
  • Entity sensor.pi_availability is incorrectly being triggered for updates while it is disabled. This is a bug in the hive integration
  • Entity sensor.garage_door_availability is incorrectly being triggered for updates while it is disabled. This is a bug in the hive integration

@DragonSorcerer, I would image you have 2 versions of hive running at the minute ones with disabled entities and ones which are not and I think your automation is trying to run against the disabled entity. please can you check I you have duplicate entities if you do I would remove all entities and set hive up again from the beginning.

Beta 25 has now been released, only some minor bug fixes but mainly fixing the debugger mentioned previously.

I just installed b25 and the hot water entity seems to have gone. It was there in b24 (although I renamed it because the name had changed from what it was previously so my automations broke)
I’m also seeing some errors in the log but I’ll provide those separately.
Apart from that it all seems to be working fine - thanks again for your hard work

Log error for water heater
Logger: homeassistant.components.water_heater
Source: custom_components/hive/water_heater.py:93
Integration: Water Heater (documentation, issues)
First occurred: 17:48:09 (2 occurrences)
Last logged: 17:48:09

  • Error adding entities for domain water_heater with platform hive
  • Error while setting up hive platform for water_heater

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 316, in async_add_entities await asyncio.gather(*tasks) File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 507, in _async_add_entity await entity.add_to_platform_finish() File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 531, in add_to_platform_finish self.async_write_ha_state() File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 296, in async_write_ha_state self._async_write_ha_state() File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 320, in _async_write_ha_state sstate = self.state File “/usr/src/homeassistant/homeassistant/components/water_heater/init.py”, line 137, in state return self.current_operation File “/config/custom_components/hive/water_heater.py”, line 93, in current_operation return HIVE_TO_HASS_STATE[self.device[“current_operation”]] KeyError: ‘current_operation’

Log error for domain sensor:
Logger: homeassistant.components.sensor
Source: custom_components/hive/sensor.py:63
Integration: Sensor (documentation, issues)
First occurred: 17:48:08 (2 occurrences)
Last logged: 17:48:09

  • Error adding entities for domain sensor with platform hive
  • Error while setting up hive platform for sensor

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 316, in async_add_entities await asyncio.gather(*tasks) File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 384, in _async_add_entity device_info = entity.device_info File “/config/custom_components/hive/sensor.py”, line 63, in device_info “model”: self.device[“device_data”][“model”], KeyError: ‘model’

@perjury1

Thanks my fix from beta 24 seems to have got lost so I have released beta 25 agin with the missing fix. Please can you reinstall beta 25

Yep - that fixed it. Many thanks

@Khole - Many thanks. The hot water issue is now resolved for me. You are a star!!!

@Khole - Seems the hotwater boost and hotwater mode sensors are not picking the current states. Showing off for me though they are on.

Not sure if the following error is related to it?

Logger: homeassistant.components.sensor
Source: custom_components/hive/sensor.py:63
Integration: Sensor (documentation, issues)
First occurred: 0:38:35 (1 occurrences)
Last logged: 0:38:35

Error while setting up hive platform for sensor

Traceback (most recent call last): File “/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py”, line 201, in _async_setup_platform await asyncio.gather(*pending) File “/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py”, line 310, in async_add_entities await asyncio.gather(*tasks) File “/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py”, line 371, in _async_add_entity device_info = entity.device_info File “/home/homeassistant/.homeassistant/custom_components/hive/sensor.py”, line 63, in device_info “model”: self.device[“device_data”][“model”], KeyError: ‘model’

@nil-ghosh just been checking mine in b25 and I would agree the boost state does not seem to update. I am also noticing that the target and current temperatures are not updated either (at least very often). I have a shed load of lights and their status seem to get stuck as well.

I’m also seeing the errors you describe in the event log.

Hope that helps.

Kevin

I’ve raised issues in the issue tracker https://github.com/Pyhive/HA-Hive-Custom-Component/issues for the lights and temperature problems.
Glad it’s not just me :slight_smile:

1 Like