Bosch Smart Home

You’re right, HA wants the component to be configured soley via config_flow:

We no longer accept additions or changes to the yaml config of integrations. See: architecture/adr/0010-integration-configuration.md at 6da4482d171f2ef04de9320d313526653b5818b4 · home-assistant/architecture · GitHub

This integration should only use a config flow and config entries.

However, this should only result in a change where you enter your credentials. Just copy the credential information from configuration.yaml to the config flow. The key pair still needs to be stored on the HA-Device, like you assumed. For registering a new key pair, you can either use Postman, or the provided register_client.py script.

python3 examples/register_client.py -pw base64_encoded_systempassword -ip shc_ip -ac path/to/certificate.pem -n ClientName -id client_id

Good luck! :slight_smile:

OK, thanks for the hint. Postman is running now, and I also created the certifcation files…
But where do I have to import the files postman_collection_json and and postman_environment_json as explained in Step one of the api documentation? Trying to import these files ends with the error “format not recognized”.
Thanks for your help!

br
Jens

Just use File -> Import -> Folder and navigate to the postman folder. The json-Files should be imported as collections.

Changing brightness should work now. If you disconnect your light physically (e.g. cut the power), SHC should report status Unavailable or Undefined. At least that is what’s happening when I disconnect Hue lights.
Can you check the response either in Postman or with apisummary.py? I would guess the 503 error should be listed there, too.

i wanted to ask if there is a step-by-step tutorial for dummies somewhere? i have no idea how to use it and integrate it

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 ?).