tschamm / boschshc-hass

Home Assistant component for accessing Bosch Smart Home Controller using boschshcpy python library.
Other
150 stars 22 forks source link

micromodule_relay devices no longer available #113

Open hkohls opened 9 months ago

hkohls commented 9 months ago

Since appr. 5 days my devices of type micromodule_relay are disconnected. After deleting and reconfiguring the bosch integration no micromodule_relay devices are found anymore. The devices are still visible and working fine with Bosch app

tschamm commented 9 months ago

Are they configured as impulse switches or as normal switches? The implementation for impulse switches is not fully done.

hkohls commented 9 months ago

As regular switch, and they worked before with your integration.

tschamm commented 9 months ago

Can you check the logs when restarting HA, if there are error messages from either boschshc_hass or boschshcpy popping up? I guess I screwed it up when implementing the Impulse switch.

COLT9001 commented 9 months ago

2023-10-03 16:15:18.160 ERROR (MainThread) [homeassistant.components.switch] Error while setting up bosch_shc platform for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/bosch_shc/switch.py", line 223, in async_setup_entry for switch in session.device_helper.micromodule_relays: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/boschshcpy/device_helper.py", line 121, in micromodule_relays devices.extend(relay) TypeError: 'SHCMicromoduleRelay' object is not iterable

hkohls commented 9 months ago

Since I restored my last Backup, I lost all trace. Hope the above log from colt9001 is good enough! Thanks for investigating on this!

tschamm commented 9 months ago

Thanks, I fixed it with b7cdcea

hkohls commented 9 months ago

Can we please open this issue again? I still run into the same problem of deactivated switches, using you latest releases. I wonder if this here might be the cause. You validate the profile for "GENERIC" and set the type of relay. But the device scanner shows this setting in both configurations. The indicators are "PowerSwitch" or " "ImpulseSwitch""

Your code in models_impl.py return ( self.RelayType.BUTTON if self.profile == "GENERIC" else self.RelayType.SWITCH )

Extract from scan: "id": "hdm:ZigBee:287681fffe7083c5", "deviceServiceIds": [ "CommunicationQuality", "PowerSwitch", "ChildProtection", "PowerSwitchProgram", "ElectricalFaults", "SwitchConfiguration" ], "manufacturer": "BOSCH", "roomId": "hz_1", "deviceModel": "MICROMODULE_RELAY", "serial": "287681FFFE7083C5",

tschamm commented 9 months ago

For sure. Checking the service would be ok also, but at least I assumed the profile type is giving hint enough. Maybe at some point I have to buy a relay to test.

tschamm commented 5 months ago

Problem is still existing?

hkohls commented 5 months ago

I updated to your latest version which fixed the impulse switch. But I see this problem again. In October I just reverted to an older version to get rid of it.

tschamm commented 5 months ago

Ok, do you see an error message in the logs? Related to one of the Platforms?

hkohls commented 5 months ago

Please advice: where do I find the log?

hkohls commented 5 months ago

I managed to get access to the logs, changed the loglevel for custom_components.bosch_shc to debug and reloaded the integration: no erros! Any other procedures to follow that might give you hints?

hkohls commented 5 months ago

I reinstalled everything. Same error, but now with log: 2024-02-04 16:47:03.546 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547969557824] 'NoneType' object has no attribute 'put_state_element' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 132, in _async_press_action await self.async_press() File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 147, in async_press await self.hass.async_add_executor_job(self.press) File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bosch_shc/button.py", line 82, in press self._device.trigger_impulse_state() File "/usr/local/lib/python3.11/site-packages/boschshcpy/models_impl.py", line 271, in trigger_impulse_state self._impulseswitch_service.put_state_element("impulseState", True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'put_state_element'

hkohls commented 5 months ago

Seems the switches are identified as impulse: image

hkohls commented 5 months ago

Please have a look at the output from the device scan I did last year. All share the profile GENERIC, but they differ in this setting: image image

tt-pete commented 4 months ago

With the new version 0.4.85 it still doesn't work for me as a switch. The last version that works for me is 0.4.57. Error messages similar to above:

2024-02-11 21:47:26.822 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140208032504256] 'NoneType' object has no attribute 'put_state_element' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 139, in _async_press_action await self.async_press() File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 154, in async_press await self.hass.async_add_executor_job(self.press) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bosch_shc/button.py", line 82, in press self._device.trigger_impulse_state() File "/usr/local/lib/python3.12/site-packages/boschshcpy/models_impl.py", line 271, in trigger_impulse_state self._impulseswitch_service.put_state_element("impulseState", True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'put_state_element'

MarkusHaag commented 4 months ago

I experience the same issue. In the past I configured them as switches to expose them in Homekit (setup without HomeAssistant) and to mimik Button I had automatization to switch them off once switched on. If I got it right, they would be functional in HomeAssistant when configured as button. As I am anyhow changing my setup to HomeAssistant this could be my solution to simple reconfigure them correctly or do I miss something?

Update: Deleted the Switch in Bosch app and readded as Buttons. Now it is working as expected. Learning of this excercise. Always have the codes available that you don't need to take the relays out of wall again.

tt-pete commented 4 months ago

I have now removed and re-added the relay several times in the Bosch app, but I still get the above error.

In the Bosch app, the relay is displayed as follows:

Screenshot_2024-02-17-10-22-15-792_com bosch sh ui android

I get always the error "NoneType' object has no attribute 'put_state_element" when I press the button in Home Assistant.