joleys / niko-home-control-II

Home Assistant Custom Integration for Niko Home Control II

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Log files full of ValueError: Config entry has already been setup!

JonasGe opened this issue · comments

2024-04-22 16:19:07.990 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry hobby (192.168.1.210) for alarm_control_panel
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 551, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 127, in async_setup_entry
    return await component.async_setup_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!

Maybe related:

I'm noticing the state of, for example a lamp, isn't synced. I can switch a lamp on in the GUI, the lamp turns on but the nhc2 add-on doesn't show this state when I inspect the device from the device list (the switch is still turned off).

The following is a debug trace of the behavior where I turn the lamp on from the GUI, then again from the device list (because the switch was still off) and then off again from the device list:

2024-04-23 10:35:38.757 DEBUG (Thread-2 (_publish_device_control_commands)) [custom_components.nhc2.nhccoco.coco] → Publishing device control command: {"Method": "devices.control", "Params": [{"Devices": [{"Uuid": "d41b99dc-ae1b-46d9-a209-f2d218f92e3f", "Properties": [{"Status": "On"}]}]}]}
2024-04-23 10:35:38.949 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 10:35:38.949 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.relay_action] Lamp logeerkamer changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'd41b99dc-ae1b-46d9-a209-f2d218f92e3f', 'Properties': [{'Status': 'On'}]}
2024-04-23 10:35:49.260 DEBUG (Thread-2 (_publish_device_control_commands)) [custom_components.nhc2.nhccoco.coco] → Publishing device control command: {"Method": "devices.control", "Params": [{"Devices": [{"Uuid": "d41b99dc-ae1b-46d9-a209-f2d218f92e3f", "Properties": [{"Status": "On"}]}]}]}
2024-04-23 10:35:49.450 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 10:35:49.452 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.relay_action] Lamp logeerkamer changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'd41b99dc-ae1b-46d9-a209-f2d218f92e3f', 'Properties': [{'Status': 'On'}]}
2024-04-23 10:35:50.616 DEBUG (Thread-2 (_publish_device_control_commands)) [custom_components.nhc2.nhccoco.coco] → Publishing device control command: {"Method": "devices.control", "Params": [{"Devices": [{"Uuid": "d41b99dc-ae1b-46d9-a209-f2d218f92e3f", "Properties": [{"Status": "Off"}]}]}]}
2024-04-23 10:35:50.813 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 10:35:50.814 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.relay_action] Lamp logeerkamer changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'd41b99dc-ae1b-46d9-a209-f2d218f92e3f', 'Properties': [{'Status': 'Off'}]}

It seems the controller isn't sending back the updates (or they don't get processed by the add-on) whenever a physical button is used to control lights/shades/...

I wonder if the setup completes as expected given the error in your first post. Can you post the full initialization of NHC from your HA log?

2024-04-23 22:05:49.711 INFO (MainThread) [custom_components.nhc2.alarm_control_panel] Configuring alarm control panels
2024-04-23 22:05:49.711 INFO (MainThread) [custom_components.nhc2.alarm_control_panel] → Found 0 NHC Basic Alarm Actions or NHC Panic Mode Actions
2024-04-23 22:05:49.744 INFO (MainThread) [custom_components.nhc2.binary_sensor] Configuring binary sensors
2024-04-23 22:05:49.744 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 NHC Access Control Actions
2024-04-23 22:05:49.744 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 1 NHC All Off Actions
2024-04-23 22:05:49.747 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 NHC Audio Control Actions
2024-04-23 22:05:49.747 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 NHC BellButton Actions
2024-04-23 22:05:49.747 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 11 NHC Dimmer Actions
2024-04-23 22:05:49.760 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 1 NHC Free Start Stop Actions
2024-04-23 22:05:49.762 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 NHC Garage Door Actions
2024-04-23 22:05:49.763 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 NHC House Mode Actions
2024-04-23 22:05:49.763 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 NHC HVAC Thermostats
2024-04-23 22:05:49.763 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 4 NHC Mood Actions
2024-04-23 22:05:49.775 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 4 NHC Motor Actions
2024-04-23 22:05:49.783 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 NHC Zigbee Smart plugs
2024-04-23 22:05:49.783 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 Generic Zigbee Smart plugs
2024-04-23 22:05:49.784 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 Electricity Metering modules
2024-04-23 22:05:49.784 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 1 Energy Home's
2024-04-23 22:05:49.785 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 1 Timeschedule Actions (undocumented)
2024-04-23 22:05:49.795 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 Heating Cooling Actions (undocumented)
2024-04-23 22:05:49.795 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 Electricalheating Actions (undocumented)
2024-04-23 22:05:49.795 INFO (MainThread) [custom_components.nhc2.binary_sensor] → Found 0 NHC Player status action
2024-04-23 22:05:49.800 INFO (MainThread) [custom_components.nhc2.button] Configuring buttons
2024-04-23 22:05:49.800 INFO (MainThread) [custom_components.nhc2.button] → Found 1 NHC Alloff Actions
2024-04-23 22:05:49.801 INFO (MainThread) [custom_components.nhc2.button] → Found 4 NHC Mood Actions
2024-04-23 22:05:49.804 INFO (MainThread) [custom_components.nhc2.button] → Found 0 Electricalheating Actions (undocumented)
2024-04-23 22:05:49.816 INFO (MainThread) [custom_components.nhc2.camera] Configuring cameras
2024-04-23 22:05:49.816 INFO (MainThread) [custom_components.nhc2.camera] → Found 0 Robinsip Videodoorstations (undocumented)
2024-04-23 22:05:49.831 INFO (MainThread) [custom_components.nhc2.climate] Configuring climates
2024-04-23 22:05:49.831 INFO (MainThread) [custom_components.nhc2.climate] → Found 0 NHC Thermostat (thermostat, touchswitch)
2024-04-23 22:05:49.831 INFO (MainThread) [custom_components.nhc2.climate] → Found 0 NHC HVAC Thermostats
2024-04-23 22:05:49.831 INFO (MainThread) [custom_components.nhc2.climate] → Found 0 NHC Touch Switch
2024-04-23 22:05:49.831 INFO (MainThread) [custom_components.nhc2.climate] → Found 0 Generic Heating/Cooling Implementations
2024-04-23 22:05:49.831 INFO (MainThread) [custom_components.nhc2.climate] → Found 0 NHC Virtual Thermostats
2024-04-23 22:05:49.843 INFO (MainThread) [custom_components.nhc2.cover] Configuring covers
2024-04-23 22:05:49.843 INFO (MainThread) [custom_components.nhc2.cover] → Found 0 NHC Garage Door Actions
2024-04-23 22:05:49.843 INFO (MainThread) [custom_components.nhc2.cover] → Found 4 NHC Motor Actions
2024-04-23 22:05:49.846 INFO (MainThread) [custom_components.nhc2.cover] → Found 0 NHC Reynaers Actions
2024-04-23 22:05:49.847 INFO (MainThread) [custom_components.nhc2.cover] → Found 0 NHC Velux Actions
2024-04-23 22:05:49.855 INFO (MainThread) [custom_components.nhc2.fan] Configuring fans
2024-04-23 22:05:49.855 INFO (MainThread) [custom_components.nhc2.fan] → Found 0 NHC Fan Actions
2024-04-23 22:05:49.856 INFO (MainThread) [custom_components.nhc2.fan] → Found 3 Generic Ventilation Implementation
2024-04-23 22:05:49.865 INFO (MainThread) [custom_components.nhc2.light] Configuring lights
2024-04-23 22:05:49.865 INFO (MainThread) [custom_components.nhc2.light] → Found 29 NHC Relay Actions (light) and Dimmer Actions
2024-04-23 22:05:49.893 INFO (MainThread) [custom_components.nhc2.lock] Configuring locks
2024-04-23 22:05:49.894 INFO (MainThread) [custom_components.nhc2.lock] → Found 0 NHC Access Control Actions
2024-04-23 22:05:49.894 INFO (MainThread) [custom_components.nhc2.lock] → Found 0 NHC BellButton Actions
2024-04-23 22:05:49.900 INFO (MainThread) [custom_components.nhc2.media_player] Configuring media players
2024-04-23 22:05:49.901 INFO (MainThread) [custom_components.nhc2.media_player] → Found 0 NHC Audio Control Actions
2024-04-23 22:05:49.905 INFO (MainThread) [custom_components.nhc2.number] Configuring numbers
2024-04-23 22:05:49.905 INFO (MainThread) [custom_components.nhc2.number] → Found 0 Generic Warm Water Implementation
2024-04-23 22:05:49.909 INFO (MainThread) [custom_components.nhc2.select] Configuring selects
2024-04-23 22:05:49.909 INFO (MainThread) [custom_components.nhc2.select] → Found 0 Generic Warm Water Implementation
2024-04-23 22:05:49.957 INFO (MainThread) [custom_components.nhc2.sensor] Configuring sensors
2024-04-23 22:05:49.958 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Access Control Actions
2024-04-23 22:05:49.958 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Audio Control Actions
2024-04-23 22:05:49.958 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Basic Alarm Actions
2024-04-23 22:05:49.958 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC BellButton Actions
2024-04-23 22:05:49.958 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Garage Door Actions
2024-04-23 22:05:49.958 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC HVAC Thermostats
2024-04-23 22:05:49.958 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Thermostat (thermostat)
2024-04-23 22:05:49.958 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Thermostat (touchswitch)
2024-04-23 22:05:49.959 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Touch Switch
2024-04-23 22:05:49.959 INFO (MainThread) [custom_components.nhc2.sensor] → Found 4 NHC Motor Actions
2024-04-23 22:05:49.975 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Presence Simulation Actions
2024-04-23 22:05:49.975 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Reynaers Actions
2024-04-23 22:05:49.975 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Velux Actions
2024-04-23 22:05:49.975 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Zigbee Smart plugs
2024-04-23 22:05:49.975 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 Generic Zigbee Smart plugs
2024-04-23 22:05:49.976 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 Electricity Metering modules
2024-04-23 22:05:49.976 INFO (MainThread) [custom_components.nhc2.sensor] → Found 1 Energy Home's
2024-04-23 22:05:49.978 INFO (MainThread) [custom_components.nhc2.sensor] → Found 3 Generic Ventilation Implementation
2024-04-23 22:05:49.985 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 Generic Heating/Cooling Implementations
2024-04-23 22:05:49.985 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 Generic Warm Water Implementations
2024-04-23 22:05:49.986 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Player status action
2024-04-23 22:05:49.986 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Thermo switch
2024-04-23 22:05:49.986 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 NHC Virtual Thermostat
2024-04-23 22:05:49.986 INFO (MainThread) [custom_components.nhc2.sensor] → Found 0 Robinsip Videodoorstations (undocumented)
2024-04-23 22:05:50.021 INFO (MainThread) [custom_components.nhc2.switch] Configuring switches
2024-04-23 22:05:50.021 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC Access Control Actions
2024-04-23 22:05:50.021 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC BellButton Actions
2024-04-23 22:05:50.021 INFO (MainThread) [custom_components.nhc2.switch] → Found 1 NHC Free Start Stop Actions
2024-04-23 22:05:50.023 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC House Mode Actions
2024-04-23 22:05:50.023 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC HVAC Thermostats
2024-04-23 22:05:50.023 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC Thermostat (thermostat)
2024-04-23 22:05:50.023 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC Thermostat (touchswitch)
2024-04-23 22:05:50.023 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC Touch Switch
2024-04-23 22:05:50.023 INFO (MainThread) [custom_components.nhc2.switch] → Found 8 NHC PIR Actions
2024-04-23 22:05:50.041 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC Presence Simulation Actions
2024-04-23 22:05:50.041 INFO (MainThread) [custom_components.nhc2.switch] → Found 3 NHC Virtual flags
2024-04-23 22:05:50.045 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC Relay Actions (socket, switched-fan, switched-generic)
2024-04-23 22:05:50.045 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC Zigbee Smart plugs
2024-04-23 22:05:50.046 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 Generic Zigbee Smart plugs
2024-04-23 22:05:50.046 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 Electricity Metering modules
2024-04-23 22:05:50.046 INFO (MainThread) [custom_components.nhc2.switch] → Found 1 Energy Home's
2024-04-23 22:05:50.047 INFO (MainThread) [custom_components.nhc2.switch] → Found 3 Generic Ventilation Implementation
2024-04-23 22:05:50.048 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 Generic Heating/Cooling Implementations
2024-04-23 22:05:50.048 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 Generic Warm Water Implementation
2024-04-23 22:05:50.048 INFO (MainThread) [custom_components.nhc2.switch] → Found 0 NHC Virtual Thermostat
2024-04-23 22:05:50.048 INFO (MainThread) [custom_components.nhc2.switch] → Found 2 Condition actions (undocumented)
2024-04-23 22:05:50.087 INFO (MainThread) [custom_components.nhc2.update] Configuring update sensors
2024-04-23 22:05:50.087 INFO (MainThread) [custom_components.nhc2.update] → Found 1 Controllers
2024-04-23 22:05:50.149 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:05:50.161 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_energyhome] energyhome changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'af896647-338e-43a1-aac5-626c57a65e5d', 'Properties': [{'ReportInstantUsage': 'True'}]}
2024-04-23 22:05:51.436 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:05:51.436 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_energyhome] energyhome changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'af896647-338e-43a1-aac5-626c57a65e5d', 'Properties': [{'ElectricalPowerToGrid': '0.000'}, {'ReportInstantUsage': 'True'}]}
2024-04-23 22:05:53.430 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:05:53.431 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_energyhome] energyhome changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'af896647-338e-43a1-aac5-626c57a65e5d', 'Properties': [{'ElectricalPowerToGrid': '2.000'}]}
2024-04-23 22:06:03.922 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:06:03.922 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_energyhome] energyhome changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'af896647-338e-43a1-aac5-626c57a65e5d', 'Properties': [{'ElectricalPowerToGrid': '0.000'}, {'ElectricalPowerFromGrid': '5.000'}]}
2024-04-23 22:06:07.447 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:06:07.449 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_energyhome] energyhome changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'af896647-338e-43a1-aac5-626c57a65e5d', 'Properties': [{'ElectricalPowerToGrid': '2.000'}, {'ElectricalPowerFromGrid': '0.000'}]}
2024-04-23 22:06:13.444 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:06:13.445 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_energyhome] energyhome changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'af896647-338e-43a1-aac5-626c57a65e5d', 'Properties': [{'ElectricalPowerToGrid': '3.000'}]}
2024-04-23 22:06:14.435 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:06:14.436 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_fan] BOX changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'a43b4093-4f03-4a9e-93c5-a0d25cf94cf3', 'Online': 'False'}
2024-04-23 22:06:14.547 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:06:14.549 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_fan] BOX changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'a43b4093-4f03-4a9e-93c5-a0d25cf94cf3', 'Online': 'True', 'Properties': [{'FanSpeed': '20'}]}
2024-04-23 22:06:14.777 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:06:14.779 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_fan] Beneden changed. Topic: hobby/control/devices/evt | Data: {'Uuid': '507465ae-a21d-4f94-b67e-a979cf88b503', 'Properties': [{'FanSpeed': '20'}]}
2024-04-23 22:06:17.444 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 22:06:17.448 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.generic_energyhome] energyhome changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'af896647-338e-43a1-aac5-626c57a65e5d', 'Properties': [{'ElectricalPowerToGrid': '0.000'}, {'ElectricalPowerFromGrid': '10.000'}]}

I removed the add-on, restarted, add the add-on again (only found a small number of devices), restarted again, found all devices.

There doesn't seem to be a real error but it seems like the controller gets out of sync (and the add-on tells me to restart HA because of a different version of the controller software).

Maybe it's these lines:

2024-04-23 22:06:17.444 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).

I came across this warning in the general logs:

Class CocoGenericInverter not found: module 'custom_components.nhc2.nhccoco.coco' has no attribute 'CocoGenericInverter', device: [{'ElectricalEnergyProduction': ''}, {'CouplingStatus': 'Ok'}, {'ReportInstantUsage': ''}, {'ElectricalPowerProduction': ''}]

I don't know if it's related

2024-04-23 10:35:38.757 DEBUG (Thread-2 (_publish_device_control_commands)) [custom_components.nhc2.nhccoco.coco] → Publishing device control command: {"Method": "devices.control", "Params": [{"Devices": [{"Uuid": "d41b99dc-ae1b-46d9-a209-f2d218f92e3f", "Properties": [{"Status": "On"}]}]}]}
2024-04-23 10:35:38.949 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 10:35:38.949 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.relay_action] Lamp logeerkamer changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'd41b99dc-ae1b-46d9-a209-f2d218f92e3f', 'Properties': [{'Status': 'On'}]}

This is the first time Lamp logeerkamer has been switched on.

2024-04-23 10:35:49.260 DEBUG (Thread-2 (_publish_device_control_commands)) [custom_components.nhc2.nhccoco.coco] → Publishing device control command: {"Method": "devices.control", "Params": [{"Devices": [{"Uuid": "d41b99dc-ae1b-46d9-a209-f2d218f92e3f", "Properties": [{"Status": "On"}]}]}]}
2024-04-23 10:35:49.450 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 10:35:49.452 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.relay_action] Lamp logeerkamer changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'd41b99dc-ae1b-46d9-a209-f2d218f92e3f', 'Properties': [{'Status': 'On'}]}

This is the second time Lamp logeerkamer has been switched on.

2024-04-23 10:35:50.616 DEBUG (Thread-2 (_publish_device_control_commands)) [custom_components.nhc2.nhccoco.coco] → Publishing device control command: {"Method": "devices.control", "Params": [{"Devices": [{"Uuid": "d41b99dc-ae1b-46d9-a209-f2d218f92e3f", "Properties": [{"Status": "Off"}]}]}]}
2024-04-23 10:35:50.813 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.controller] Controller changed (hobby/control/devices/evt == /control/devices/rsp).
2024-04-23 10:35:50.814 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.relay_action] Lamp logeerkamer changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'd41b99dc-ae1b-46d9-a209-f2d218f92e3f', 'Properties': [{'Status': 'Off'}]}

Here Lamp logeerkamer is switched off.

All the above seems correct to me. And should work.
Just to be 100% sure: do you have the latest version of the integration? And the latest version of Home Assistant?

Class CocoGenericInverter not found: module 'custom_components.nhc2.nhccoco.coco' has no attribute 'CocoGenericInverter', device: [{'ElectricalEnergyProduction': ''}, {'CouplingStatus': 'Ok'}, {'ReportInstantUsage': ''}, {'ElectricalPowerProduction': ''}]

The CocoGenericInverter seems like a new (undocumented) device. Would you be so kind to provide me with your device list? See: https://github.com/joleys/niko-home-control-II?tab=readme-ov-file#i-need-to-see-the-device-list

The on-on-off sequence is strange because the device in HA doesn't seem to update if triggered from the dashboard (although the light turns on). The second time I turned the lamp on, it was from the device view (because the switch wasn't turned on in that view):
image

I have the latest version of HA and the plugin.

I'll send the device list by e-mail, I think the device is my SMA Sunny Tripower SE.

@JonasGe although not really related to your issues. I have the code ready for supporting the Generic Inverter. See #138

@JonasGe I have to tried to debug it, but going from the logs it should work as intended. The sequence in your logs is exactly the same as mine when toggling the light switch.

The fact that the line below is shown means that the controller has sent the status change.

2024-04-23 10:35:38.949 DEBUG (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.devices.relay_action] Lamp logeerkamer changed. Topic: hobby/control/devices/evt | Data: {'Uuid': 'd41b99dc-ae1b-46d9-a209-f2d218f92e3f', 'Properties': [{'Status': 'On'}]}

Which also means it is needs to be something in the code. But to be honest, I don't know where to look as you are the first one with this problem.

2024-04-22 16:19:07.990 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry hobby (192.168.1.210) for alarm_control_panel

Just out of curiosity: Do you have other integrations, or anything in Home Assistant configured to connect to 192.168.1.210?

Could you check if there are multiple entries in .storage/core.config_entries which contain hobby or 192.168.1.210

2024-04-22 16:19:07.990 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry hobby (192.168.1.210) for alarm_control_panel

Just out of curiosity: Do you have other integrations, or anything in Home Assistant configured to connect to 192.168.1.210?

Could you check if there are multiple entries in .storage/core.config_entries which contain hobby or 192.168.1.210

I checked /.storage/core.config_entries and I only have one entry with either hobby or the IP address.

I'll do some debugging myself, it might be related to Lovelace Minimalist UI but I think I already checked toggling a light from an empty default dashboard with just one switch which resulted in the same.

Thanks for adding support for my SMA inverter. I'll look forward to the release.

I think I have found a very weird way to trigger this warning:

2024-04-22 16:19:07.990 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry hobby (192.168.1.210) for alarm_control_panel

It seems that if you remove the hub, and readd it this happens.

Can you try the following steps:

  1. Remove all configured hubs for this integration
  2. Restart Home Assistant
  3. Readd the integration and configure the controller once

Support for the Generic Inverter will land in v4.1

Hi,

I have the exact same issue, after I had no entities showing up, I removed and readded the integration.

After a while I can see that the power usage meters are frozen, when i try to toggle a light or switch, it toggles, the light goes on, but I can't turn it off again...

log:

Logger: homeassistant.config_entries
Bron: config_entries.py:575
Eerst voorgekomen: 09:29:58 (15 gebeurtenissen)
Laatst gelogd: 09:29:58

Error setting up entry Sintjozef (192.168.0.3) for number
Error setting up entry Sintjozef (192.168.0.3) for select
Error setting up entry Sintjozef (192.168.0.3) for sensor
Error setting up entry Sintjozef (192.168.0.3) for switch
Error setting up entry Sintjozef (192.168.0.3) for update
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 575, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/init.py", line 122, in async_setup_entry
return await component.async_setup_entry(entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 185, in async_setup_entry
raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!

It seems that if you remove the hub, and readd it this happens.

Can you try the following steps:

  1. Remove all configured hubs for this integration
  2. Restart Home Assistant
  3. Readd the integration and configure the controller once

I did this, the integration works for about an hour and then it starts throwing errors again and doesn't communicate with the UI anymore.

And do you see anything else in the logs around the same time the integration stops working?

There's not really something that stands out as strange but this warning was raised just before the retries started:

2024-05-06 13:10:14.591 WARNING (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.coco] Disconnected from MQTT broker

The log file is so full of the retries that it's hard to pinpoint where it actually went wrong. I'll try to find out more tomorrow.

2024-05-05 17:45:05.990 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry hass (192.168.123.184) for switch

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/config_entries.py", line 575, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/switch/__init__.py", line 94, in async_setup_entry
    return await component.async_setup_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity_component.py", line 185, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!

I accidentely triggered the same error bij connecting a second instance of HA to my niko controller. Do you have another system also managing the system via the MQTT interface?

I often connect a second HA instance to my NHC controller for development purposes and have not seen this issue so far.

Let me take back this statement: I do see the same errors on my dev HA. This is running in Parallels Desktop on my laptop.
Following is logged in 'Host' log:
dev.local NetworkManager[328]: <info> [1715021674.3816] manager: NetworkManager state is now DISCONNECTED

Seems that network connection is dropped for a short time. Not sure if this is related to the virtual environment that suspend when my laptop is idle and on battery power.

There's not really something that stands out as strange but this warning was raised just before the retries started:

2024-05-06 13:10:14.591 WARNING (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.coco] Disconnected from MQTT broker

The log file is so full of the retries that it's hard to pinpoint where it actually went wrong. I'll try to find out more tomorrow.

Did you also check the other logs 'Supervisor' and 'Host' at the time of the failure?

There's not really something that stands out as strange but this warning was raised just before the retries started:

2024-05-06 13:10:14.591 WARNING (Thread-3 (_thread_main)) [custom_components.nhc2.nhccoco.coco] Disconnected from MQTT broker

The log file is so full of the retries that it's hard to pinpoint where it actually went wrong. I'll try to find out more tomorrow.

Did you also check the other logs 'Supervisor' and 'Host' at the time of the failure?

I'm waiting for the error to occur today. It triggered at 7:13AM today again (also preceded by the MQTT broker error) but my supervisor log only goes back to 8AM.

Both files don't contain anything relevant.

Just to be sure: do you need the MQTT integration for the nhc2 integration to work?

Just to be sure: do you need the MQTT integration for the nhc2 integration to work?

No

I finally found some time to check if any other log contains any information and unfortunately they don't.

The MQTT broker disconnects and then the integration fails:
image

And probably a few seconds/minutes later it reconnects, and makes the GUI work again. Reconnecting is not handled in the code (I think). And will require time I don't have at the moment.

My best advice would be to look into the issue why it disconnects (network issue, power issue?, issue with the hub itself?)

From what I witnessed, the GUI remains broken until a restart of HA.
The integration might reconnect to the MQTT broker but the changes coming from the NHC server aren't reflected in the integration (which I think is logical since the MQTT messages during the downtime have been lost and maybe the integration doesn't acquire the current states of all NHC entities?).

The integration does not process the current states after a reconnect. In theory this should be possible as I think the device list is republished on (re)connect.

As said, at this point I don't have the time to try to fix this and it probably will required some effort.

This will be resolved when #152 lands

That's great news, thanks @tijsverkoyen

Did you find out anything more that causes this behaviour while updating the code?

I did a completely new install of HA with only this integration and the behaviour was the same so I'm wondering if it's the CoCo that is different between our installations (if you and Jo don't experience the same issue)...

No. The new code handles reconnects.
So if the controller/Home Assistant gets disconnected and reconnects it will be handled

I just tested your PR until the MQTT disconnect happened and your changes have solved the issue.

There were some new class not found exceptions but those devices seem to work despite the warning (I tested the blinds and two-button panel)

Class CocoSunblindMotor not found: module 'custom_components.nhc2.nhccoco.coco' has no attribute 'CocoSunblindMotor'
Class CocoDigitalsensorDigitalsensor not found: module 'custom_components.nhc2.nhccoco.coco' has no attribute 'CocoDigitalsensorDigitalsensor'
Class CocoPushbuttonx2Panel not found: module 'custom_components.nhc2.nhccoco.coco' has no attribute 'CocoPushbuttonx2Panel'
Class CocoMoodbuttonPanel not found: module 'custom_components.nhc2.nhccoco.coco' has no attribute 'CocoMoodbuttonPanel'
Class CocoPushbuttonx4Panel not found: module 'custom_components.nhc2.nhccoco.coco' has no attribute 'CocoPushbuttonx4Panel'
Class CocoDimmerDimmer not found: module 'custom_components.nhc2.nhccoco.coco' has no attribute 'CocoDimmerDimmer '

Hmm, thx. I will try to check this later this week.
This should not be an issues, as these are warnings.

@JonasGe I have extended the list of classes to ignore. So feel free to retry, you should not see the warnings anymore.

But I'm thinking about reverting back to checking if devices have properties. But I need to check with someone else to confirm that this won't break anything else.