Open hkohls opened 1 year ago
Are they configured as impulse switches or as normal switches? The implementation for impulse switches is not fully done.
As regular switch, and they worked before with your integration.
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.
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
Since I restored my last Backup, I lost all trace. Hope the above log from colt9001 is good enough! Thanks for investigating on this!
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",
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.
Problem is still existing?
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.
Ok, do you see an error message in the logs? Related to one of the Platforms?
Please advice: where do I find the log?
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?
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'
Seems the switches are identified as impulse:
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:
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'
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.
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:
I get always the error "NoneType' object has no attribute 'put_state_element" when I press the button in Home Assistant.
I have this Problem as well with the latest version. Will try readding it into the shc.
Hallo back, I just tried removing and readding the devices. Still getting the same error mentioned above. Is there something I can do to help get this solved?
Version 0.4.91 has checks if the services of the relays are NoneType. Should fix the error AttributeError: 'NoneType' object has no attribute 'put_state_element'
. Can you please re-check.
Thanks! So the error does not appear anymore, but unfortunately pressing the button does not change the state of the device.
That was what I feared. Do you know from the API, what would be the command to trigger the device?
Unfortunately not, as Iām not too familiar with these kinds of things. My workaround involved connecting to the BSH with HA via HomeKit to get the functionality back. I would prefer your Integration though as it enables much more functionality šš»
I also see the button now. But pressing it, doesn't cause any switching.
I don't have any knowledge of the API either. However, I already wrote in my post from February 13, 2024 that it worked until version 0.4.57. A subsequent change resulted in the error. Maybe this information will help to find a solution.
That was what I feared. Do you know from the API, what would be the command to trigger the device?
The MICROMODULE_RELAY be switch on/off like a PowerSwitch. It's the PUT request {{shc_api}}/devices/{{device_id}}/services/PowerSwitch/state with the body {"@type": "powerSwitchState","switchState": "[OFF or ON]"}
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