sanjoyg / dirigera_platform

HomeAssistant Integration for Dirigera Platform
MIT License
71 stars 8 forks source link

HA status not updated #48

Open ghost opened 1 month ago

ghost commented 1 month ago

When operating a door/window sensor, the HA status is not updated. I see next errors in the logging:

=============

Logger: homeassistant.helpers.frame Source: helpers/frame.py:190 First occurred: 17:38:46 (1 occurrences) Last logged: 17:38:46

Detected that custom integration 'dirigera_platform' calls async_write_ha_state from a thread at custom_components/dirigera_platform/base_classes.py, line 81: listener.async_schedule_update_ha_state(force_refresh), please report it to the author of the 'dirigera_platform' custom integration

=============

This error originated from a custom integration.

Logger: custom_components.dirigera_platform Source: custom_components/dirigera_platform/hub_event_listener.py:118 integration: IKEA Dirigera Hub Integration (documentation, issues) First occurred: 17:38:46 (1 occurrences) Last logged: 17:38:46

error processing hub event

===========

This error originated from a custom integration.

Logger: custom_components.dirigera_platform Source: custom_components/dirigera_platform/hub_event_listener.py:119 integration: IKEA Dirigera Hub Integration (documentation, issues) First occurred: 17:38:46 (1 occurrences) Last logged: 17:38:46

{"id":"e3379a28-9b21-41b4-89f3-89b6553952a8","time":"2024-05-19T15:38:46.000Z","specversion":"3.150.0","source":"urn:com:ikea:homesmart:iotc:zigbee","type":"deviceStateChanged","data":{"id":"bac3c013-4bba-427c-9b10-2c58b8cff1e3_1","type":"sensor","deviceType":"openCloseSensor","createdAt":"2024-05-16T16:55:14.000Z","isReachable":true,"lastSeen":"2024-05-19T17:38:46.000Z","attributes":{"isOpen":true},"remoteLinks":[]}}

==========

This error originated from a custom integration.

Logger: custom_components.dirigera_platform Source: custom_components/dirigera_platform/hub_event_listener.py:120 integration: IKEA Dirigera Hub Integration (documentation, issues) First occurred: 17:38:46 (1 occurrences) Last logged: 17:38:46

Detected that custom integration 'dirigera_platform' calls async_write_ha_state from a thread at custom_components/dirigera_platform/base_classes.py, line 81: listener.async_schedule_update_ha_state(force_refresh). Please report it to the author of the 'dirigera_platform' custom integration.

========

Also when I switch a light on/off the HA status is not updated. Next error when turning a light off:

========

Logger: homeassistant.helpers.frame Source: helpers/frame.py:190 First occurred: 18:48:14 (1 occurrences) Last logged: 18:48:14

Detected that custom integration 'dirigera_platform' calls async_write_ha_state from a thread at custom_components/dirigera_platform/hub_event_listener.py, line 115: entity.async_schedule_update_ha_state(False), please report it to the author of the 'dirigera_platform' custom integration

=========

This error originated from a custom integration.

Logger: custom_components.dirigera_platform Source: custom_components/dirigera_platform/hub_event_listener.py:118 integration: IKEA Dirigera Hub Integration (documentation, issues) First occurred: 18:48:14 (1 occurrences) Last logged: 18:48:14

error processing hub event

========

This error originated from a custom integration.

Logger: custom_components.dirigera_platform Source: custom_components/dirigera_platform/hub_event_listener.py:119 integration: IKEA Dirigera Hub Integration (documentation, issues) First occurred: 18:48:14 (1 occurrences) Last logged: 18:48:14

{"id":"a336de1d-d212-447a-8be7-ba89028a180a","time":"2024-05-19T16:48:14.000Z","specversion":"3.150.0","source":"urn:com:ikea:homesmart:iotc:zigbee","type":"deviceStateChanged","data":{"id":"6afe28e4-fd52-41d6-a3a4-8c68a30098f5_1","type":"light","deviceType":"light","createdAt":"2024-05-11T18:26:18.000Z","isReachable":true,"lastSeen":"2024-05-19T18:48:14.000Z","attributes":{"isOn":false},"remoteLinks":["ceeafbc0-f9f5-4586-8eaa-fa9d587ae4cf_1"]}}

==========

This error originated from a custom integration.

Logger: custom_components.dirigera_platform Source: custom_components/dirigera_platform/hub_event_listener.py:120 integration: IKEA Dirigera Hub Integration (documentation, issues) First occurred: 18:48:14 (1 occurrences) Last logged: 18:48:14

Detected that custom integration 'dirigera_platform' calls async_write_ha_state from a thread at custom_components/dirigera_platform/hub_event_listener.py, line 115: entity.async_schedule_update_ha_state(False). Please report it to the author of the 'dirigera_platform' custom integration.

========

sanjoyg commented 1 month ago

Check the new release, Philip pushed a fix

ghost commented 1 month ago

Thanks for the update. Good news is that the door window sensor updates are working now. Unfortunately the light entity still doesn’t get updates. See logging for a light entity at the top of this post. The async_schedule… function is raising a error.

sanjoyg commented 1 month ago

My apologies William for the mix-up. So even the async_schedule is raising an exception?

ghost commented 1 month ago

Hello Sanjoy,

No problem. Yes the async_schedule is raising exception for light entity. I’m not familiar with the code but I tried to do some debugging. The door/window sensor is calling the async_schedule_update_ha_state routine from the base_classes module. This is working fine now.

However the light entity calls a different async_schedule_update_ha_state routine, I assume the one from HA entity class, which causes an exception.

For debugging I created a workaround in module hub_event_listener line 112. This is working fine, and also the brightness issue seems to be solved as well. I could only test with light and door/window sensors. Hope you can use the workaround:

hub_event_listener.py.txt

sanjoyg commented 1 month ago

Do try the latest release

jspeckman commented 4 weeks ago

Just updated to 1.7.7, with the latest HA release and I am still having the status not updating issue. Once a light is turned on in HA, the status will change to on, but will not change to off, even though the light will switch off. Additionally, since the status in HA for the light is "stuck" at on, HA will turn the light back on after a few minutes. Below is the JSON log output:

2024-06-01 08:20:03.204 INFO (SyncWorker_8) [custom_components.dirigera_platform] --------------
2024-06-01 08:20:03.506 INFO (SyncWorker_8) [custom_components.dirigera_platform] [{'id': 'dcddda9b-41b3-47de-9b4c-80f40222deb8_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2024-05-23T15:35:12.000Z', 'isReachable': True, 'lastSeen': '2024-05-31T23:56:18.000Z', 'attributes': {'customName': 'Countertop Sink', 'model': 'TRADFRI Driver 30W', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.4', 'hardwareVersion': '1', 'serialNumber': 'A49E69FFFE011F1D', 'productCode': 'ICPSLC2430NAIL2', 'isOn': False, 'startupOnOff': 'startOn', 'lightLevel': 1, 'startUpCurrentLevel': -1, 'identifyStarted': '2000-01-01T00:00:00.000Z', 'identifyPeriod': 0, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00'}, 'capabilities': {'canSend': [], 'canReceive': ['customName', 'isOn', 'lightLevel']}, 'room': {'id': '481ec555-5359-4204-8f0a-006651c071d7', 'name': 'Kitchen', 'color': 'ikea_blue_no_58', 'icon': 'rooms_kitchen'}, 'deviceSet': [], 'remoteLinks': ['161f0c7d-cedb-42b4-953b-7ea8de9bacc7_1'], 'isHidden': False}, {'id': '6c28c5a9-4777-49e2-ba9f-fcb40c4349d3_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2024-05-23T15:08:14.000Z', 'isReachable': True, 'lastSeen': '2024-05-31T23:56:19.000Z', 'attributes': {'customName': 'Countertop Cooktop', 'model': 'TRADFRI Driver 30W', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.4', 'hardwareVersion': '1', 'serialNumber': '385CFBFFFEE892C9', 'productCode': 'ICPSLC2430NAIL2', 'isOn': False, 'startupOnOff': 'startOn', 'lightLevel': 1, 'startUpCurrentLevel': -1, 'identifyStarted': '2000-01-01T00:00:00.000Z', 'identifyPeriod': 0, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00'}, 'capabilities': {'canSend': [], 'canReceive': ['customName', 'isOn', 'lightLevel']}, 'room': {'id': '481ec555-5359-4204-8f0a-006651c071d7', 'name': 'Kitchen', 'color': 'ikea_blue_no_58', 'icon': 'rooms_kitchen'}, 'deviceSet': [], 'remoteLinks': ['161f0c7d-cedb-42b4-953b-7ea8de9bacc7_1'], 'isHidden': False}, {'id': 'a50306b0-0450-4dcc-b210-c132aa180bc1_1', 'relationId': 'a50306b0-0450-4dcc-b210-c132aa180bc1', 'type': 'gateway', 'deviceType': 'gateway', 'createdAt': '2023-03-20T19:41:08.544Z', 'isReachable': True, 'lastSeen': '2024-06-01T13:20:00.800Z', 'attributes': {'customName': 'Home', 'model': 'DIRIGERA Hub for smart products', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '2.588.0', 'hardwareVersion': 'P2.5', 'serialNumber': 'a50306b0-0450-4dcc-b210-c132aa180bc1', 'identifyStarted': '2024-05-30T08:07:37.000Z', 'identifyPeriod': 65534, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoDownload', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00', 'permittingJoin': False, 'backendConnected': False, 'backendConnectionPersistent': False, 'backendOnboardingComplete': True, 'backendRegion': 'us-east-1', 'backendCountryCode': 'US', 'userConsents': [{'name': 'analytics', 'value': 'disabled'}, {'name': 'diagnostics', 'value': 'enabled'}], 'logLevel': 3, 'coredump': False, 'timezone': 'America/Chicago', 'nextSunSet': None, 'nextSunRise': None, 'homestate': 'home', 'countryCode': 'XZ', 'isOn': False}, 'capabilities': {'canSend': [], 'canReceive': ['customName', 'permittingJoin', 'userConsents', 'logLevel', 'time', 'timezone', 'countryCode', 'coordinates']}, 'deviceSet': [], 'remoteLinks': []}, {'id': '30fb4fc2-e9dd-4af9-ad48-2c3fc3b7c722_1', 'type': 'controller', 'deviceType': 'lightController', 'createdAt': '2024-05-28T07:17:59.000Z', 'isReachable': True, 'lastSeen': '2024-06-01T12:13:29.000Z', 'attributes': {'customName': 'MB Right Nightstand', 'model': 'Remote Control N2', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '2.4.11', 'hardwareVersion': '1', 'serialNumber': '003C84FFFE2EF59F', 'productCode': 'E2001', 'batteryPercentage': 100, 'isOn': False, 'lightLevel': 1, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00', 'circadianPresets': []}, 'capabilities': {'canSend': ['isOn', 'lightLevel'], 'canReceive': ['customName']}, 'room': {'id': '3af9917c-222e-4414-9f1b-7fe36f98f85b', 'name': 'Master Bedroom', 'color': 'ikea_beige_1', 'icon': 'rooms_bed'}, 'deviceSet': [], 'remoteLinks': [], 'isHidden': False}, {'id': '57de7071-72c7-4b16-bc7d-41e6d345df4b_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2023-10-08T12:29:46.000Z', 'isReachable': True, 'lastSeen': '2024-05-31T20:51:14.000Z', 'customIcon': 'lighting_table_lamp', 'attributes': {'customName': 'MB Right Nightstand', 'model': 'TRADFRIbulbE12WSglobeopal470lm', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.012', 'hardwareVersion': '1', 'serialNumber': '943469FFFEB77175', 'productCode': 'LED2002G5NA', 'isOn': False, 'startupOnOff': 'startOn', 'lightLevel': 100, 'startUpCurrentLevel': -1, 'colorTemperature': 2202, 'colorTemperatureMin': 4000, 'colorTemperatureMax': 2202, 'startupTemperature': -1, 'colorMode': 'temperature', 'identifyStarted': '2000-01-01T00:00:00.000Z', 'identifyPeriod': 0, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00'}, 'capabilities': {'canSend': [], 'canReceive': ['customName', 'isOn', 'lightLevel', 'colorTemperature']}, 'room': {'id': '3af9917c-222e-4414-9f1b-7fe36f98f85b', 'name': 'Master Bedroom', 'color': 'ikea_beige_1', 'icon': 'rooms_bed'}, 'deviceSet': [], 'remoteLinks': ['30fb4fc2-e9dd-4af9-ad48-2c3fc3b7c722_1'], 'isHidden': False}, {'id': '63fb3e1f-263a-4442-8d1c-75925e93da6c_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2024-05-23T15:07:51.000Z', 'isReachable': True, 'lastSeen': '2024-05-31T23:56:18.000Z', 'attributes': {'customName': 'Countertop', 'model': 'TRADFRI Driver 30W', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.4', 'hardwareVersion': '1', 'serialNumber': 'A49E69FFFE0120B4', 'productCode': 'ICPSLC2430NAIL2', 'isOn': False, 'startupOnOff': 'startOn', 'lightLevel': 1, 'startUpCurrentLevel': -1, 'identifyStarted': '2000-01-01T00:00:00.000Z', 'identifyPeriod': 0, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00'}, 'capabilities': {'canSend': [], 'canReceive': ['customName', 'isOn', 'lightLevel']}, 'room': {'id': '481ec555-5359-4204-8f0a-006651c071d7', 'name': 'Kitchen', 'color': 'ikea_blue_no_58', 'icon': 'rooms_kitchen'}, 'deviceSet': [], 'remoteLinks': ['161f0c7d-cedb-42b4-953b-7ea8de9bacc7_1'], 'isHidden': False}, {'id': '8cd4d8df-3820-4a4a-b62c-0ee30d291260_1', 'type': 'controller', 'deviceType': 'lightController', 'createdAt': '2024-05-27T21:20:00.000Z', 'isReachable': True, 'lastSeen': '2024-06-01T02:10:38.000Z', 'attributes': {'customName': 'MB Left Nightstand', 'model': 'Remote Control N2', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '2.4.11', 'hardwareVersion': '1', 'serialNumber': '84BA20FFFE6B3563', 'productCode': 'E2001', 'batteryPercentage': 100, 'isOn': False, 'lightLevel': 1, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00', 'circadianPresets': []}, 'capabilities': {'canSend': ['isOn', 'lightLevel'], 'canReceive': ['customName']}, 'room': {'id': '3af9917c-222e-4414-9f1b-7fe36f98f85b', 'name': 'Master Bedroom', 'color': 'ikea_beige_1', 'icon': 'rooms_bed'}, 'deviceSet': [], 'remoteLinks': [], 'isHidden': False}, {'id': 'a946dd27-efa4-49a2-ac63-e6c98b74d2ff_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2023-08-28T08:26:13.000Z', 'isReachable': True, 'lastSeen': '2024-06-01T08:18:37.000Z', 'customIcon': 'lighting_table_lamp', 'attributes': {'customName': 'MB Left Nightstand', 'model': 'TRADFRIbulbE12WSglobeopal470lm', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.012', 'hardwareVersion': '1', 'serialNumber': '943469FFFEACD807', 'productCode': 'LED2002G5NA', 'isOn': True, 'startupOnOff': 'startOn', 'lightLevel': 1, 'startUpCurrentLevel': -1, 'colorTemperature': 3937, 'colorTemperatureMin': 4000, 'colorTemperatureMax': 2202, 'startupTemperature': -1, 'colorMode': 'temperature', 'identifyStarted': '2000-01-01T00:00:00.000Z', 'identifyPeriod': 0, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00'}, 'capabilities': {'canSend': [], 'canReceive': ['customName', 'isOn', 'lightLevel', 'colorTemperature']}, 'room': {'id': '3af9917c-222e-4414-9f1b-7fe36f98f85b', 'name': 'Master Bedroom', 'color': 'ikea_beige_1', 'icon': 'rooms_bed'}, 'deviceSet': [], 'remoteLinks': ['8cd4d8df-3820-4a4a-b62c-0ee30d291260_1'], 'isHidden': False}, {'id': '161f0c7d-cedb-42b4-953b-7ea8de9bacc7_1', 'type': 'controller', 'deviceType': 'lightController', 'createdAt': '2023-09-01T09:20:49.000Z', 'isReachable': True, 'lastSeen': '2024-06-01T00:49:52.000Z', 'attributes': {'customName': 'Countertop Lights', 'model': 'TRADFRI remote control', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '24.4.5', 'hardwareVersion': '1', 'serialNumber': '04CD15FFFE8B2B8C', 'productCode': 'E1810', 'batteryPercentage': 20, 'isOn': False, 'lightLevel': 1, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00', 'circadianPresets': []}, 'capabilities': {'canSend': ['isOn', 'lightLevel'], 'canReceive': ['customName']}, 'room': {'id': '481ec555-5359-4204-8f0a-006651c071d7', 'name': 'Kitchen', 'color': 'ikea_blue_no_58', 'icon': 'rooms_kitchen'}, 'deviceSet': [], 'remoteLinks': [], 'isHidden': False}, {'id': '393be306-d85b-47a0-84da-25036c0118f4_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2024-05-23T15:35:34.000Z', 'isReachable': True, 'lastSeen': '2024-06-01T06:11:51.000Z', 'attributes': {'customName': 'Countertop Bar', 'model': 'TRADFRI Driver 30W', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.4', 'hardwareVersion': '1', 'serialNumber': 'A49E69FFFE012314', 'productCode': 'ICPSLC2430NAIL2', 'isOn': False, 'startupOnOff': 'startOn', 'lightLevel': 1, 'startUpCurrentLevel': -1, 'identifyStarted': '2000-01-01T00:00:00.000Z', 'identifyPeriod': 0, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00'}, 'capabilities': {'canSend': [], 'canReceive': ['customName', 'isOn', 'lightLevel']}, 'room': {'id': '481ec555-5359-4204-8f0a-006651c071d7', 'name': 'Kitchen', 'color': 'ikea_blue_no_58', 'icon': 'rooms_kitchen'}, 'deviceSet': [], 'remoteLinks': ['161f0c7d-cedb-42b4-953b-7ea8de9bacc7_1'], 'isHidden': False}]
2024-06-01 08:20:03.507 INFO (SyncWorker_8) [custom_components.dirigera_platform] --------------
2024-06-01 08:20:03.507 INFO (SyncWorker_8) [custom_components.dirigera_platform] === END Devices JSON ===

Edit: Rolling back to 1.7.4 fixes the issue for me.

sanjoyg commented 4 weeks ago

Thank you for testing it out. Do enable debug for the integration and paste the DEBUG logs when this issue occurs that way I can figure what is going on

jspeckman commented 3 weeks ago

Just tried 1.7.8, same issue. Below is the log output with debugging turned on for dirigera_platform

2024-06-03 13:24:56.596 DEBUG (MainThread) [custom_components.dirigera_platform] light turn_on... 2024-06-03 13:24:56.597 DEBUG (MainThread) [custom_components.dirigera_platform] {} 2024-06-03 13:24:57.118 DEBUG (Thread-2) [custom_components.dirigera_platform] rcvd message : {"id":"edce271d-c70f-45ba-821d-a9651dcadc74","time":"2024-06-03T18:24:57.000Z","specversion":"3.154.0","source":"urn:com:ikea:homesmart:iotc:zigbee","type":"deviceStateChanged","data":{"id":"a946dd27-efa4-49a2-ac63-e6c98b74d2ff_1","type":"light","deviceType":"light","createdAt":"2023-08-28T08:26:13.000Z","isReachable":true,"lastSeen":"2024-06-03T13:24:57.000Z","attributes":{"isOn":true},"remoteLinks":["8cd4d8df-3820-4a4a-b62c-0ee30d291260_1"]}} 2024-06-03 13:24:57.118 DEBUG (Thread-2) [custom_components.dirigera_platform] device type of message light 2024-06-03 13:24:57.119 DEBUG (Thread-2) [custom_components.dirigera_platform] Setting a946dd27-efa4-49a2-ac63-e6c98b74d2ff_1 reachable as True 2024-06-03 13:24:57.119 DEBUG (Thread-2) [custom_components.dirigera_platform] setting is_on to True 2024-06-03 13:24:57.119 DEBUG (Thread-2) [custom_components.dirigera_platform] id='a946dd27-efa4-49a2-ac63-e6c98b74d2ff_1' relation_id=None type='light' device_type='light' created_at=datetime.datetime(2023, 8, 28, 8, 26, 13, tzinfo=datetime.timezone.utc) is_reachable=True last_seen=datetime.datetime(2024, 6, 3, 13, 23, 6, tzinfo=datetime.timezone.utc) attributes=LightAttributes(custom_name='MB Left Nightstand', model='TRADFRIbulbE12WSglobeopal470lm', manufacturer='IKEA of Sweden', firmware_version='1.0.012', hardware_version='1', serial_number='943469FFFEACD807', product_code='LED2002G5NA', ota_status='upToDate', ota_state='readyToCheck', ota_progress=0, ota_policy='autoUpdate', ota_schedule_start=datetime.time(0, 0), ota_schedule_end=datetime.time(0, 0), startup_on_off=<StartupEnum.START_ON: 'startOn'>, is_on=True, light_level=1, color_temperature=4000, color_temperature_min=4000, color_temperature_max=2202, color_hue=None, color_saturation=None) capabilities=Capabilities(can_send=[], can_receive=['customName', 'isOn', 'lightLevel', 'colorTemperature']) room=Room(id='3af9917c-222e-4414-9f1b-7fe36f98f85b', name='Master Bedroom', color='ikea_beige_1', icon='rooms_bed') device_set=[] remote_links=['8cd4d8df-3820-4a4a-b62c-0ee30d291260_1'] is_hidden=False dirigera_client=<dirigera.hub.hub.Hub object at 0x7f2d5429f200> 2024-06-03 13:24:57.148 DEBUG (MainThread) [custom_components.dirigera_platform] light turn_on... 2024-06-03 13:24:57.148 DEBUG (MainThread) [custom_components.dirigera_platform] {'color_temp': 250, 'color_temp_kelvin': 4000} 2024-06-03 13:24:57.649 DEBUG (MainThread) [custom_components.dirigera_platform] Request to set color temp... 2024-06-03 13:24:57.650 DEBUG (MainThread) [custom_components.dirigera_platform] Set CT : 4000 2024-06-03 13:24:58.027 DEBUG (MainThread) [custom_components.dirigera_platform] update called MB Left Nightstand 2024-06-03 13:24:58.028 DEBUG (MainThread) [custom_components.dirigera_platform] update called Countertop Lights 2024-06-03 13:24:58.048 DEBUG (MainThread) [custom_components.dirigera_platform] update called MB Right Nightstand 2024-06-03 13:24:58.800 DEBUG (MainThread) [custom_components.dirigera_platform] light turn_on... 2024-06-03 13:24:58.800 DEBUG (MainThread) [custom_components.dirigera_platform] {'brightness': 2} 2024-06-03 13:24:59.273 DEBUG (MainThread) [custom_components.dirigera_platform] scaled brightness : 0 2024-06-03 13:24:59.275 ERROR (MainThread) [custom_components.dirigera_platform] error encountered turning on : MB Left Nightstand 2024-06-03 13:24:59.275 ERROR (MainThread) [custom_components.dirigera_platform] light_level must be a value between 1 and 100 2024-06-03 13:25:03.792 DEBUG (MainThread) [custom_components.dirigera_platform] light turn_off... 2024-06-03 13:25:04.298 DEBUG (Thread-2) [custom_components.dirigera_platform] rcvd message : {"id":"3a1e3c96-6485-4ebb-a7fa-dc97f6e3dacb","time":"2024-06-03T18:25:04.000Z","specversion":"3.154.0","source":"urn:com:ikea:homesmart:iotc:zigbee","type":"deviceStateChanged","data":{"id":"a946dd27-efa4-49a2-ac63-e6c98b74d2ff_1","type":"light","deviceType":"light","createdAt":"2023-08-28T08:26:13.000Z","isReachable":true,"lastSeen":"2024-06-03T13:25:04.000Z","attributes":{"isOn":false},"remoteLinks":["8cd4d8df-3820-4a4a-b62c-0ee30d291260_1"]}} 2024-06-03 13:25:04.298 DEBUG (Thread-2) [custom_components.dirigera_platform] device type of message light 2024-06-03 13:25:04.298 DEBUG (Thread-2) [custom_components.dirigera_platform] Setting a946dd27-efa4-49a2-ac63-e6c98b74d2ff_1 reachable as True 2024-06-03 13:25:04.298 DEBUG (Thread-2) [custom_components.dirigera_platform] setting is_on to False 2024-06-03 13:25:04.299 DEBUG (Thread-2) [custom_components.dirigera_platform] id='a946dd27-efa4-49a2-ac63-e6c98b74d2ff_1' relation_id=None type='light' device_type='light' created_at=datetime.datetime(2023, 8, 28, 8, 26, 13, tzinfo=datetime.timezone.utc) is_reachable=True last_seen=datetime.datetime(2024, 6, 3, 13, 23, 6, tzinfo=datetime.timezone.utc) attributes=LightAttributes(custom_name='MB Left Nightstand', model='TRADFRIbulbE12WSglobeopal470lm', manufacturer='IKEA of Sweden', firmware_version='1.0.012', hardware_version='1', serial_number='943469FFFEACD807', product_code='LED2002G5NA', ota_status='upToDate', ota_state='readyToCheck', ota_progress=0, ota_policy='autoUpdate', ota_schedule_start=datetime.time(0, 0), ota_schedule_end=datetime.time(0, 0), startup_on_off=<StartupEnum.START_ON: 'startOn'>, is_on=False, light_level=0, color_temperature=4000, color_temperature_min=4000, color_temperature_max=2202, color_hue=None, color_saturation=None) capabilities=Capabilities(can_send=[], can_receive=['customName', 'isOn', 'lightLevel', 'colorTemperature']) room=Room(id='3af9917c-222e-4414-9f1b-7fe36f98f85b', name='Master Bedroom', color='ikea_beige_1', icon='rooms_bed') device_set=[] remote_links=['8cd4d8df-3820-4a4a-b62c-0ee30d291260_1'] is_hidden=False dirigera_client=<dirigera.hub.hub.Hub object at 0x7f2d5429f200> 2024-06-03 13:25:12.343 DEBUG (MainThread) [custom_components.dirigera_platform] light turn_off... 2024-06-03 13:25:27.327 DEBUG (MainThread) [custom_components.dirigera_platform] light turn_off... 2024-06-03 13:25:28.028 DEBUG (MainThread) [custom_components.dirigera_platform] update called MB Left Nightstand 2024-06-03 13:25:28.028 DEBUG (MainThread) [custom_components.dirigera_platform] update called Countertop Lights 2024-06-03 13:25:28.028 DEBUG (MainThread) [custom_components.dirigera_platform] update called MB Right Nightstand

sanjoyg commented 3 weeks ago

Thank you for trying this out. I need you to do a little more testing and describe the issue for me. In your log I see only one issue of brightness not been able to set to 0 which I have fixed. Install the new release and do the following for me please

  1. Enabled Debug
  2. Paste the log just as you do
  3. But also describe what action u did such as turn off using app, turn on using HASS. And the issue/error that u are seeing.
jspeckman commented 3 weeks ago

Was going to get some debug logging, when I saw a new version was released. Installed 1.7.10, and do not appear to have status update issues any more. For me I'd say it's fixed.

Update, not quite fixed. If I turn a light on from home assistant, but turn it off with the remote (for that light), home assistant still shows it as turned on and will not let it be turned off. Additionally, after several minutes the light will come back on. I then turned the light off, and then back on from the remote, at which point I turned the light back off from home assistant, which then worked, both the light and the status in HA were off. v1.7.4 did not have this issue.

fastbobjorn commented 2 weeks ago

Same issue as reported by @jspeckman. I have some garden lights which are switched by sunrise/sunset automation, all works fine. I noticed that the lightswitches stay on in Home Assistant after the lights have been turned off. When I try to turn off one of these lights in Home Assistant, the lightswitch goes back on after a second.

I can reproduce the issue when I turn on/off a light with service calls, same as in my automation:

service: light.turn_on
target:
  entity_id: light.backyard
data:
  brightness_pct: 10

Then after turning it off with service light.turn_off, the light turns off, but the switch will stay on in Home Assistant.

service: light.turn_off
target:
  entity_id: light.backyard
sanjoyg commented 2 weeks ago

Would you turn on debug and send the logs when this happens

fastbobjorn commented 2 weeks ago

Need to figure out how to make the debug logging, brb later…

sanjoyg commented 2 weeks ago

Go to the integration on the right sode u would enable debugging

On Wed, 12 Jun 2024 at 20:20, Bjorn @.***> wrote:

Need to figure out how to make the debug logging, brb later…

— Reply to this email directly, view it on GitHub https://github.com/sanjoyg/dirigera_platform/issues/48#issuecomment-2163241948, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2X3CQCJ2ASQKKPOZIPFNDZHBN45AVCNFSM6AAAAABH6O3UWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRTGI2DCOJUHA . You are receiving this because you were mentioned.Message ID: @.***>

fastbobjorn commented 2 weeks ago

Debug logging created...

service: light.turn_on
target:
  entity_id: light.light1
data:
  brightness_pct: 1

2024-06-13 17:06:28.811 DEBUG (MainThread) [custom_components.dirigera_platform] light turn_on... 2024-06-13 17:06:28.811 DEBUG (MainThread) [custom_components.dirigera_platform] {'brightness': 3} 2024-06-13 17:06:29.318 DEBUG (MainThread) [custom_components.dirigera_platform] scaled brightness : 1 2024-06-13 17:06:29.374 DEBUG (Thread-4) [custom_components.dirigera_platform] rcvd message : {"id":"cff9355a-34d2-443f-a33d-b54e0b85fa23","time":"2024-06-13T15:06:29.000Z","specversion":"3.154.0","source":"urn:com:ikea:homesmart:iotc:zigbee","type":"deviceStateChanged","data":{"id":"3dbc97a9-fdf9-4023-80a9-a24929be7428_1","type":"light","deviceType":"light","createdAt":"2024-06-12T15:38:26.000Z","isReachable":true,"lastSeen":"2024-06-13T17:06:29.000Z","attributes":{"isOn":true},"remoteLinks":["bc2cdad0-f476-42e5-9e84-02bb76238b03_1"]}} 2024-06-13 17:06:29.374 DEBUG (Thread-4) [custom_components.dirigera_platform] device type of message light 2024-06-13 17:06:29.374 DEBUG (Thread-4) [custom_components.dirigera_platform] Setting 3dbc97a9-fdf9-4023-80a9-a24929be7428_1 reachable as True 2024-06-13 17:06:29.375 DEBUG (Thread-4) [custom_components.dirigera_platform] setting is_on to True 2024-06-13 17:06:29.375 DEBUG (Thread-4) [custom_components.dirigera_platform] id='3dbc97a9-fdf9-4023-80a9-a24929be7428_1' relation_id=None type='light' device_type='light' created_at=datetime.datetime(2024, 6, 12, 15, 38, 26, tzinfo=datetime.timezone.utc) is_reachable=True last_seen=datetime.datetime(2024, 6, 13, 16, 57, 55, tzinfo=datetime.timezone.utc) attributes=LightAttributes(custom_name='Light1', model='TRADFRI bulb GU10 WS 400lm', manufacturer='IKEA of Sweden', firmware_version='2.3.095', hardware_version='1', serial_number='5C0272FFFE645882', product_code='LED1739R5GU10', ota_status='upToDate', ota_state='readyToCheck', ota_progress=0, ota_policy='autoUpdate', ota_schedule_start=datetime.time(0, 0), ota_schedule_end=datetime.time(0, 0), startup_on_off=<StartupEnum.START_ON: 'startOn'>, is_on=True, light_level=1, color_temperature=2202, color_temperature_min=4000, color_temperature_max=2202, color_hue=None, color_saturation=None) capabilities=Capabilities(can_send=[], can_receive=['customName', 'isOn', 'lightLevel', 'colorTemperature']) room=Room(id='cf2b7ed4-1ce1-4954-ac8c-1d499cdb7de1', name='Room1', color='ikea_red_no_39', icon='rooms_arm_chair') device_set=[] remote_links=['9e1839c6-e822-4c3c-bba2-0e4e8d36510c_1'] is_hidden=False dirigera_client=<dirigera.hub.hub.Hub object at 0x7f6c6fbe00>

service: light.turn_off
target:
  entity_id: light.light1

2024-06-13 17:06:38.625 DEBUG (MainThread) [custom_components.dirigera_platform] light turn_off... 2024-06-13 17:06:39.174 DEBUG (Thread-4) [custom_components.dirigera_platform] rcvd message : {"id":"ae80caff-3574-4282-93f6-79fd9ec0ea5f","time":"2024-06-13T15:06:39.000Z","specversion":"3.154.0","source":"urn:com:ikea:homesmart:iotc:zigbee","type":"deviceStateChanged","data":{"id":"3dbc97a9-fdf9-4023-80a9-a24929be7428_1","type":"light","deviceType":"light","createdAt":"2024-06-12T13:38:26.000Z","isReachable":true,"lastSeen":"2024-06-13T17:06:39.000Z","attributes":{"isOn":false},"remoteLinks":["bc2cdad0-f476-42e5-9e84-02bb76238b03_1"]}} 2024-06-13 17:06:39.175 DEBUG (Thread-4) [custom_components.dirigera_platform] device type of message light 2024-06-13 17:06:39.175 DEBUG (Thread-4) [custom_components.dirigera_platform] Setting 3dbc97a9-fdf9-4023-80a9-a24929be7428_1 reachable as True 2024-06-13 17:06:39.175 DEBUG (Thread-4) [custom_components.dirigera_platform] setting is_on to False 2024-06-13 17:06:39.175 DEBUG (Thread-4) [custom_components.dirigera_platform] id='3dbc97a9-fdf9-4023-80a9-a24929be7428_1' relation_id=None type='light' device_type='light' created_at=datetime.datetime(2024, 6, 12, 15, 38, 26, tzinfo=datetime.timezone.utc) is_reachable=True last_seen=datetime.datetime(2024, 6, 13, 16, 57, 55, tzinfo=datetime.timezone.utc) attributes=LightAttributes(custom_name='Light1', model='TRADFRI bulb GU10 WS 400lm', manufacturer='IKEA of Sweden', firmware_version='2.3.095', hardware_version='1', serial_number='5C0272FFFE645882', product_code='LED1739R5GU10', ota_status='upToDate', ota_state='readyToCheck', ota_progress=0, ota_policy='autoUpdate', ota_schedule_start=datetime.time(0, 0), ota_schedule_end=datetime.time(0, 0), startup_on_off=<StartupEnum.START_ON: 'startOn'>, is_on=False, light_level=1, color_temperature=2202, color_temperature_min=4000, color_temperature_max=2202, color_hue=None, color_saturation=None) capabilities=Capabilities(can_send=[], can_receive=['customName', 'isOn', 'lightLevel', 'colorTemperature']) room=Room(id='cf2b7ed4-1ce1-4954-ac8c-1d499cdb7de1', name='Room1', color='ikea_red_no_39', icon='rooms_arm_chair') device_set=[] remote_links=['9e1839c6-e822-4c3c-bba2-0e4e8d36510c_1'] is_hidden=False dirigera_client=<dirigera.hub.hub.Hub object at 0x7f6c6fbe00> 2024-06-13 17:06:39.176 DEBUG (Thread-4) [custom_components.dirigera_platform] Ignoring calling update_ha_state as ignore_update is set

From this point the light switch in Home Assistant stays unexpected on. When I switch off the light with the light switch in Home Assistant then It switches on again after a few seconds.

sanjoyg commented 2 weeks ago

Try with the latest release please.

fastbobjorn commented 2 weeks ago

Thanks for fast fix 👍 Looks good but need to test some more.

fastbobjorn commented 1 week ago

For me everything works fine now.

jspeckman commented 1 week ago

Finally had a chance to try the latest version and run debug logging. If I turn a light on with home assistant, the light comes on (as it should), if I then turn it off from a physical remote, the light goes off, but in home assistant it stays on. Then after a few minutes, the light comes back on. The light will only stay off if I turn the light off from home assistant. Attached is the debug log that ran while I was doing the above home-assistant_dirigera_platform_2024-06-21T12-09-27.099Z.log

sanjoyg commented 1 week ago

@jspeckman good bug. I think the new release that I just cut should fix it. Would you please try it out

jspeckman commented 1 week ago

Installed yesterday and have not had any issues so far.