Hive Integration

Confirmed the above. The proposed fix is to replace this:

SetEntityID = SetEntityID + "_" + self.NodeName

With this:

SetEntityID = SetEntityID + "_" + self.NodeName.replace(" ", "_")

In ./custom_components/climate/hive.py.

Probably wants doing elsewhere in the other hive.py files. It’s probably also worth replacing other special characters which are going to cause issues.

1 Like

:slight_smile: perfect thanks, yes I agree this looks good

Yes you are right, we need to check and update all the devices to ensure replacing the EntityID with valid characters. We are planning on re-writing a load of the code handling the friendly name and entity Id generation and moving it to the main file so it is all centralised and can have common code, so I will do it as part of that.

To get all my errors out the logs, that line needs replacing in sensor/hive.py too. It’s in there quite a few times.

Look forward to the updated release, but mine’s working for now so I’ll carry on testing :slight_smile:

thanks for the update @lavinpj1

As you have your install fixed, I will include your fix with the next release, should be coming towards the end of the week.

If anyone else has this issue, let me know and I will see if I can get a quick update out

Hello,

We have a new version of the Hive component, which thanks to @Khole the main and biggest update is the addition of the Hive sensors integration.

If anybody uses the “devices:” section in there HA hive configuration they will need to add the below to show the hive sensors and the light and plug mode sensors.

  • hive_active_sensor
  • hive_active_light_sensor
  • hive_active_plug_sensor

There is also an update to the Now and Next feature for Heating and Hotwater devices which are set to Scheduled mode where they now show Now, Next and Later and have start and end times for each slot.

A couple of bug fixes, the main one being an error in the code which will re-log in to the Hive API for any reason where HA does not have a valid session with the Hive API, but the error meant that this code was never triggered. There is also a fix in this where if Hive is down or unreachable it handles this state better. So overall if there is an issue in anyway with HA connecting to the Hive API it should auto-resolve itself within 15 minutes.
There is also the bug fix which @lavinpj1 discovered and wrote the fix for (thanks @lavinpj1 :slight_smile: )

As before, just download and copy the files to the relevant locations and rename as below:

  • Download and copy the hive_main.yaml (88.5 KB) file to “/custom_components/hive.py” taking care to change the file name from hive_main.yaml to hive.py
  • Download and copy the hive_climate.yaml (6.5 KB) file to “/custom_components/climate/hive.py” taking care to change the file name from hive_climate.yaml to hive.py
  • Download and copy the hive_sensor.yaml (25.1 KB) file to “/custom_components/sensor/hive.py” taking care to change the file name from hive_sensor.yaml to hive.py
  • Download and copy the hive_light.yaml (5.6 KB) file to “/custom_components/light/hive.py” taking care to change the file name from hive_light.yaml to hive.py
  • Download and copy the hive_switch.yaml (3.1 KB) to “/custom_components/switch/hive.py” taking care to change the file name from hive_switch.yaml to hive.py
3 Likes

Excellent thanks for the updates. Will download and try today.

Not sure what you mean about the devices? Add the lines to what?

Any idea is this plugin is ever going to be included in the main HA download?

Hi @gr4z

The “devices:” bit mentioned in rendiis comment is an option you can have in your hive configuration. There is an example of it in the first post of this thread, basically it allows you to stop a device type or individual heating component that you own being added to HA if you don’t want it to be.

If you don’t have “devices:” in your hive configuration the component will add all devices it supports and can find in your hive setup to HA.

It would be great if this could be added to the main HA download, but for me there are too many hoops to go through to achieve this.
Maybe it seems that way as after a few times reading through this I don’t really understand the process, plus if I understand some part of the process, don’t have the required GitHub account which costs a monthly fee, which I would use only to publish this Hive platform to HA.

You don’t have to pay anything to create pull requests or use 99.9% of GitHub. No idea where you got the fee from? The only feature I know that’s costs money to use is private repositories.

ok, managed to create free GitHub account, it was not obvious that one could create a free account also.

So now I just have a complete lack of understanding on the process to submit the Hive custom component to HA and a complete lack of understanding on how GitHub works, (yes I have read the docs on the HA website)

Hey rendili. Thanks so much for your work. Do you still need help with the Github process? It’s not too complicated but can be a bit overwhelming the first time you do it. I hope this little step-by-step will help to get you started:

  1. First you need to fork the home assistant project. Forking means you create your own version of the project, which allows you to add and test changes, which can then later integrated (merged) back into the main project. To do that all you need to do is install git and do git clone https://github.com/home-assistant/home-assistant.git on the command line. You will get a new folder home-assistant.

  2. Add your file changes and new files to that folder and test that everything works but manually running this checkout.
    (Optional) Before you add your changes, you can create a new branch. Branches help you work on multiple things at the same time without having those changes interact with each other. Do git checkout -b hive-addon to create a new branch. You can use git checkout master to get back to the main branch later.

  3. When you are happy with your changes you need to add new files to the repository. git add /custom_components/hive.py etc will do that. Then do git commit to commit the changes, you will have to give a short explanation of what the changes do, e.g. “Added Hive component to support Hive Thermostats”. You can bundle different changes into multiple commits, but for now one should be enough. Finally to git push to upload your commits to Github.

  4. In Github you now go to your project, e.g. github.com/rendili/home-assistant and it should already ask you if you want to create a new pull-request from your changes. You can also manually create a new pull-request. The base-fork should be home-assistant/home-assistant and the head-fork should be rendili/home-assisant and at the bottom it should show the changes you’ve made. Once you are happy, confirm it by clicking Create Pullrequest.

Ask if you have any questions. Would love to see your component in the next HA release.

Edit: If you don’t like doing all of this on the command line then there are some nice GUIs to simplify this process like https://www.gitkraken.com.

1 Like

Hi @ptersilie,

Thank you very much for your help and guide and yes I still need help with the GitHub process, and now that I have started to follow the HA process, maybe assistance with setting up a valid / recommended development environment to follow the process with.

So far I have pressed the Fork button for Home Assistant and now have something under my profile.
I use an almost identical installation for my dev environment to my production / live environment, only it is a Virtual Machine, but it looks like the dev environment needs to be some special installation. I followed the instructions to setup some dev stuff on the VM, but I don’t think that worked very well as I have already an All in One installer version of HA installed there, so I reverted the VM back to the checkpoint.

The rest of the steps that you detailed look clear enough to follow, I just need to get a decent dev setup running.
I am going to create a 2nd VM for this, and install a fresh installation of Linux. Once this is on there do you know what is needed to go from an empty Linux OS to a functioning HA development environment?

thanks for your help on this

Hi Guys

I hope you can help :slight_smile:

I’m completely new to HA and I’m just setting it up and adding the hive functionality. I only have lights and one plug. I’ve been able to get it to show 4 of my lights and the plug on the main page and they appear in Switch and Light cards. They work no problem at all, really happy!

However, the 5th light which is a colour changing light in my kids room just won’t show in the Light card. It shows in the row of devices across the top, but not in the card with the toggle to turn it on/off etc.

I’ve not setup any groups or list of devices, I’ve just added my user and pass to the configuration and installed the files in the correct folders.

Anyone have any suggestions? I know the colour changing aspect may not work but just being able to turn it on and off would be great!

Thanks for any help!

Russ

If it helps, I’ve noticed this in the logs:

File “C:\Users\Russ\AppData\Roaming.homeassistant\custom_components\light\hive.py”, line 133, in supported_features
SUPPORTFEATURES = (SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_RGB_COLOR)
NameError: name ‘SUPPORT_RGB_COLOR’ is not defined

Hi @roostlick

We have never had someone who has colour bulbs so the code I put together is not tried and tested. I got as much information as I could about the colour bulbs within my own data from the api. But it was minimal, because I didn’t know what data was sent from the api in regards to colour bulbs I just set it to RGB. To get the colour bulb to work for you I’ll need you to send me your JSON data from the hive API.

If your interested let me know and I’ll message you instructions how to get your data from the hive API.

Yep, definitely interested :slight_smile:

I’ve just realised the motion sensor seems to just show “Unknown” all this time :joy::joy:

It doesn’t seem to have recorded anything since It was added into the component…

Hi @Craig86

that’s strange the motion I have has been tracking motion at various points throughout the day and reporting to HA

Do you have version 1 or version 2 of the motion sensor?

Hi @rendili @Khole

I see that a python upgrade is on the way (https://home-assistant.io/blog/2017/10/06/deprecating-python-3.4-support/) - do you think this will affect your wonderful Hive code?

Does this plugin work with hass.io?