Bosch Smart Home

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.

Yes, thanks for pointing this out. I forgot to change the function definition to work without zeroconf (again) yesterday night :sleeping: If you don’t mind, give it another try (update the custom component will pull boschshcpy==0.1.18.dev2).

Yes, now it works, thanks for all the help and work :+1:

1 Like

May I ask if the custom integration allows the Bosch universal switch to be exposed in Homekit (for setting scene or light to each button)?

I bought over ten switches for Homekit usage and only found out those are not included in list of Bosch devices with Homekit supported…

Hi,
I already check the state of the universal switch through the API, but I have not added them to Home Assistant yet. As soon as they are available in Home Assistant, you can add them to HomeKit via the HomeKit component.

Update: After taking a look into other components, I guess the best way to integrate the Universal Switch is by creating a device_trigger.py and link the events fired by the device to triggers in Home Assistant. This will be some work to do…
However I fear this will not help you much, as triggers / events are not forwarded to HomeKit.

May I ask you what is the reason for adding these to HomeKit, can you describe an exemplary task?

Regards, Thomas

Thanks for the quick reply and effort.

I want to use the Universal Switch Iike the Philips Hue Dimmer Switch which each button can be configured under Homekit for functions such as adding group of lights/switches for on/off or triggering particular scene.

Will it be easier to handle if I add all the components I want to control to HA? (Philips Hue and Shelly, which has HA integration) and do all my triggering setting in the HA instead of using Homekit. Thank you.

Hi Guys,
Just bought a bunch of Bosch kit.
I was assuming I would have to write some integration code for myself. Was really please to come across your hard work!!
Trying to add this component into Home Assistant.

When I go to
Configuration>Integrations>Add Integration>Bosch SHC> SHC authentication parameters
It asks for the “host” and then fails with the error

Logger: custom_components.bosch_shc.config_flow
Source: custom_components/bosch_shc/config_flow.py:66 
Integration: Bosch SHC ([documentation](https://www.home-assistant.io/integrations/bosch_shc)) 
First occurred: 20:56:58 (1 occurrences) 
Last logged: 20:56:58

Error looking up mDNS entry

I have the following in the configuration.yaml

bosch_shc:
  ip_address: '10.0.0.80'
  ssl_certificate: '/path/ha_clientcert.pem'
  ssl_key: '/path/ha_clientcert.key'
  name: 'Bosch SHC HUB'
pip show boschshcpy
Name: boschshcpy
Version: 0.1.18.dev4
Summary: Bosch Smart Home Controller API Python Library
Home-page: https://github.com/tschamm/boschshcpy
Author: Clemens-Alexander Brust, Thomas Schamm
Author-email: [email protected], [email protected]
License: bsd-3-clause
Location: /usr/lib/python3.8/site-packages
Requires: requests, getmac, zeroconf
Required-by:

I don’t understand mDNS much but even more I don’t understand why it would not simply use the IP address I gave it (is there some way to force that?).

If it makes a difference this is running in a docker container.

Is there something I can do to try and fix this?

Thanks & Regards
Ben

Hi Ben,
mDSN really makes some problems… We currently needed either mDNS or getmac to determine a unique identifier for the SHC. Neither SHC serial nor mac address are communicated via the API.

I assume docker prevents mDNS to acquire the network information. One solution would be to enable mDNS through docker. The “fallback” is using getmac. You can test if the fallback works with a simple example, which should report the mac_address of the SHC given it’s IP. If you get this running inside the docker, the custom_component should work fine:

$ python3                                                                                                                                                            (17-12 22:47)
Python 3.8.4 (default, Jul 14 2020, 15:19:59) 
[Clang 10.0.0 (clang-1000.10.44.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import getmac
>>> getmac.get_mac_address(ip='192.168.xx.xx')
'00:aa:bb:cc:dd:ee'

If this also does not work inside docker, I assume we need an optional parameter which serves as a unique identifier. If someone has a better idea, I would be very happy :slight_smile:
Best, Thomas

Didn’t HA present a new way but mDNS just with the current release last Sunday?

Hi Thomas,
Thanks for the very fast reply.
I gave that a try and it failed to return anything.
I will see if I can have a play with things and get it working and look into if this is something to do with being inside docker.
One question that occurs to me though. If this is just to get a “unique identifier” or even if it really does need to be the Mac address would it not be possible to simply specify this directly in the config?

>>> getmac.get_mac_address(ip='10.0.0.80')
>>> 

Thanks again, at least I know where to start looking. Will let you know how I get on.

Ben

I did not found any reference to an mDNS alternative quickly reading through the release notes.

@ninjabenji: discovery integration gives some advice to use mDNS within docker environment.

When running Home Assistant Core in a Docker container command line option --net=host or the compose file equivalent network_mode: host must be used to put it on the host’s network, otherwise mDNS and UPnP will not work.

Hey Ben, before you try too much, try restarting the Bosch SHC, after that my HA did discover my SHC itself and with zeroconf it did work with no problem.

I will give both of those a try. Thanks

They mentioned it in a talk within the conference. I did recognize it, since they more or less directly mentioned it with the same issues we have here with mDNS. I will try to find where I got it from tomorrow.

The restart failed to fix (but for the effort always worth a try). I will play around with docker tomorrow and see where I get to.

Ok, I checked back what I heard there about mdns. But after reading it I don’t know if this really is relevant to this case.

MULTICAST NAME RESOLUTION

Release 5 uses systemd-resolved to provide DNS services on the operating system level and acts as a multicast name resolution responder. Besides, mDNS systemd-resolved also supports the LLMNR hostname resolution protocol. In practice, this makes discovering a new installation of Home Assistant OS working in most situations, either using http://homeassistant.local:8123 or http://homeassistant:8123 .