Bosch Smart Home

Hi Toben,
basically you have to follow these steps to add Bosch Smart Home devices to HA.

  1. Install bosch_shc custom component
  2. Generate a certificate/key pair
  3. Register a new client on the SHC device
  4. Configure bosch_shc integration in HA.

1.) To install bosch_shc as custom component, inside your HA configuration directory create a new folder called custom_components. This is the folder that Home Assistant will look at when looking for custom code. Install the custom component there:
Just copy paste the content of the boschshc-hass/bosch_shc folder, available on github, in your config/custom_components directory. As example, you will get the entity.py file in the following path: /config/custom_components/bosch_shc/entity.py.
Afterwards, restart HomeAssistant.

2.) + 3.) Follow the guide for setting up a new certificate/key pair and for registering this certificate on the Bosch SHC step by step. On the first look, this looks a bit complicated, but in the end it’s pretty straight-forward.
As a result, you obtained a generated certificate/key pair which is registered for accessing and controlling the SHC.

4.) For configuration of bosch_shc custom component, follow the steps provided in the Readme.md. During configuration, you have to enter the obtained credentials from step 2.) by providing the path to your public and private keypair of your SSL certificate.

Good luck! :slight_smile:

4 Likes

Hello @tschamm,

Even if i’m looking at Home-assistant for months it would have been because of your post that i finally created an account to say Thank you for your work.
I was looking for months/years about which solution to select for my thermostat valve.
At some point i was going to be resign and choose between netatmo or Tadoo which both need Cloud connectivity to work all day long…
With your integration i understand that i could buy the bosch bridge and my thermostats valve, denied access to the cloud for the bridge once my setup is on place and it will use local polling through my home-assistant. It seems like a pretty good plan for me as bosch thermostats valve is lower in price than netatmo/tadoo.

I hope to see soon this integration on the core of HA :slight_smile:.
I’m going to dig now a bit further within Bosch product line to be 100% sure that “This is the way !”.

Have an happy christmas :fireworks:

3 Likes

Zwordi, I think you have a good point their by giving thanks to Thomas! I can only agree with you and also thank you Thomas for your dedication! :slight_smile:

I am still running my Bosch System via the HomeKit Integration with HA, but I also plan to change that in the near future.

1 Like

So now that I have added a rgba-lightstripe to my HA, I did a feature request to your git-repo

And btw. is there a corresponding lovelace-card with which color-adjustmend can be triggered? Can’t find something suitable.

HI Thomas,

today should be the day to switch from using HomeKit to Integrate Bosch components to HA, to your integration.

I got my certificate registered, the custom component in it’s place and after a reboot HA did not discover my SHC automatically, but I could install the integration and config started with asking me for the host.
I entered the ip of my shc, but than I always get "HI Thomas,
today should be the day to switch from using HomeKit to Integrate Bosch components to HA, to your integration.
I got my certificate registered, the custom component in it’s place and after a reboot HA did not discover my SHC automatically, but I could install the integration and config started with asking me for the host.

I entered the ip of my shc, but than I always get “Failed to connect” as a result back.
I don’t even get to the part, where I can enter my certificate.

What can I do?
Thank you!

Update: I moved my new HA instance to its’s final place in our Network configuration and now the SHC gets discovered automatically. So it looks like the switch I use in my offices is not configured in an ideal way.

But maybe I can add a comment to your config guide.
I believe it could be helpful to give a little more detail on how to provide the SSL Certificate Public and private key.

What is expected to be entered here: the actual key?
The URL to the key files?
If the later, where to I store them best on my HA instance? And how would the URI look like in that case?

Sorry for bugging you about this, but what might be totally clear to you, is actually puzzling guys like me, with less experience in this matter…

Hope you understand that I mean just well with my comment here, hope to contribute in this way to an integration for many more to use in the future… I will now start figure it out myself… :slight_smile:

Cheers,
Kai

PS. Maybe a screenshot with realistic mock data could help a lot… Not sure if I will be able to provide it, as I don’t know when i am correct before submit (and probably won’t get a chance to come back to that step…)

The problem with autodiscovery is, if zeroconf is not available, we won’t get unique information from the SHC. There is an open feature request to provide unique info like e.g. mac address also via Rest API, then the ZeroConf neccessity could be removed.

Good point! What is needed here is the actual path to the certificate keypair on the device running HA. You can place such data in the config directory of your HA instance.
So as an example:

  • SSL certificate public key: /config/keystore/shc-cert.pem
  • SSL certificate private key: /config/keystore/shc-key.pem

You’re almost done!

I thought so myself - but for some reason I always get an “unexpeted error”.
Now I even renamed my keypair to fit EXACTLY your example and put a keystore folder directly into my config folder…

With the same key I can read out component information etc. using postman. So pretty sure the registering my cert did work in general. Do I have to adapt the cert file to the Bosch format?

"-----BEGIN CERTIFICATE-----\r followed by the 2048 bit self signed certificate and \r-----END CERTIFICATE-----"

So using the “/r” marker?
Thanks Thomas!

Update: nope, the \r /r pair is not the solution, that leads to a direct error message “invalid authentication” → I am a little lost what could be the issue here…

I used an encrypted key file as suggested by Bosch when registering my cert at shc. Is this maybe part of the problem? As I am using the unencypted version within my HA instance now?

Did you encrypt your private key with a password? That will lead to a problem, as python requests cannot handle encrypted private keys.

For security reasons you should consider to encrypt the key with: openssl rsa -aes256 -in client-key.pem -out client-encrypted-key.pem

This does not work with python requests library.

Yes I did when registering it with shc. But not in HA. So I guess I should re-Register with a not encrypted version. Right? Also something we could add to the setup gude… :slight_smile:

I’m facing the same problem as you:
Using Postman I can add a new client to the Bosch SHC:
after fire the command I get status “201 Created” and can find the new device in the app.
After that I switch to HA and enter the path to to the client-cert.pem and key-cert.pem.
After pressing the “submit” button I get “invalid authentification”.
I’m using the same exatcly the same .pem-Files and also take care to remove all carriage returns and add “\r” and I used the

openssl req -x509 -nodes -days 9999 -newkey rsa:2048 -keyout client-key.pem -out client-cert.pem

command to create the SSL-pair.

Any idea what I’m doing wrong?

Many thanks!
Br
Jens

Ok, what I can tell you already: go and use the client-cert.pem and client-key.pem as you got it from openssl. Don’t do any adjustments within these files for HA. That is only needed for registering the cert via postman.

Did your HA Autodiscover your SHC automatically after the reboot? Currently this is necessary to have a chance it will work. But there are also some more issues that Tomas is currently working on.

Might be a good idea to check your logfiles to see at what point your configuration currently fails.
Best wishes,
Kai

Good news, with the latest version - it does work now for me.
Not on the first try - but after sleeping a night and tring it again - with no changes made - I got lucky and my HA accepted to integrate my Bosch SHC. :slight_smile:

Now I have to figure out how to use it / integrate it - as there are no entities within this integration… But I am happy to look into that! :slight_smile:

Oh and again: Thomas big thanks for your support and creating this in the first place! :slight_smile:

Hi, I have no problems with the Cert Setup got that running, but I have a problem with adding the integration.

I added the files to custom_component and now can find it under the integration, but during the setup I get asked for a host, I enter the IP of the Bosch Smart Home, and after some loading I get “Failed to connect”.
The logs show “Error looking up mDNS entry”.

My network setup is currently so that Home Assistant and the Bosch Hub are on different subnets and VLAN’s, so I guess the mDNS call is failing. Is it possible to do this without mDNS (I don’t know much about mDNS, but is it really neccessary once I give it the IP ?).

I had the same Issue yesterday. Today - after re reboot and giving it a night time to do - I don’t know what. It worked and I could connect my Bosch SHC to my HA…

So keep trying… :slight_smile:

Update: Even though HA had integrated Bosch SHC, it seams not to be stable. my devices are currently not available again. So there might still be some way to go.

Hi @Zerwin, @kai-seipp I will have a look on the mDNS problems. The mDNS is called during discovery, but also every time the integration is reloaded (e.g. HA is restarted), so if your network does not handle zeroconf correctly/stable, this could result in the problem.
I guess I have to restore the old way to load the integration without mDNS support but with getmac.

@Zerwin, @kai-seipp
Please try again with the updated custom component bosch_shc. It pulls boschshcpy==0.1.18.dev0 which provides a fallback for mDNS failures. If no information can be retrieved via mDNS, it tries to retrieve the mac_address via getmac. This may still fail in some networks, but as we do need to provide a valid unique_id, this is currently the best we can do.

Regards, Thomas :crossed_fingers:

@tschamm
Hey, thanks for the quick reply. I tried the new version but now get an unexpected error, Home Assistant logs shows this:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/boschshcpy/session.py", line 238, in mdns_info
    return SHCInformation(
  File "/usr/local/lib/python3.8/site-packages/boschshcpy/information.py", line 59, in __init__
    self._listener = SHCListener(zeroconf, self.filter)
  File "/usr/local/lib/python3.8/site-packages/boschshcpy/information.py", line 23, in __init__
    callback(self.shc_services)
  File "/usr/local/lib/python3.8/site-packages/boschshcpy/information.py", line 100, in filter
    raise SHCmDNSError
boschshcpy.exceptions.SHCmDNSError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/bosch_shc/config_flow.py", line 62, in async_step_user
    self.info = info = await self._get_info(host)
  File "/config/custom_components/bosch_shc/config_flow.py", line 169, in _get_info
    information = await self.hass.async_add_executor_job(session.mdns_info)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/site-packages/boschshcpy/session.py", line 242, in mdns_info
    return SHCInformation(
TypeError: __init__() missing 1 required positional argument: 'zeroconf'

Since I had the same error that you got here I did this:

I just updated to 0.118.5 and did a restart.
Also I put both devices RasPi4 and Bosch SHC from my managed switch directly onto the FritzBox.
Currently my system is running well. I keep you up to date.