sanjoyg / dirigera_platform

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

TRADFRI motion sensor #37

Open SzosszeNET opened 2 months ago

SzosszeNET commented 2 months ago

Thank you for the project appears to be working fine, however I notice that the TRADFRI motion sensor is persistently off despite it turning lights on and off.

image

Not sure if it's something that's easy to sort or if I could be of any assitance here, but would gladly help if I can. Thank you

2024-04-17 20:27:12.374 INFO (SyncWorker_55) [custom_components.dirigera_platform] === START Devices JSON === 2024-04-17 20:27:12.374 INFO (SyncWorker_55) [custom_components.dirigera_platform] -------------- 2024-04-17 20:27:12.642 INFO (SyncWorker_55) [custom_components.dirigera_platform] [{'id': '2ef1a5bf-b275-41bb-a381-e1b4c7ba73a9_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2023-10-21T19:19:46.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T12:10:33.000Z', 'attributes': {'customName': 'Porch light ', 'model': 'STOFTMOLN ceiling/wall lamp WW24', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.006', 'hardwareVersion': '1', 'serialNumber': '6C5CB1FFFEB129D7', 'productCode': 'T2035', 'isOn': False, 'startupOnOff': 'startPrevious', 'lightLevel': 100, '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': '0968ebf6-a5fd-4bb0-95b0-ec58a3334176', 'name': 'Porch', 'color': 'ikea_orange_no_11', 'icon': 'rooms_coat_hanger'}, 'deviceSet': [], 'remoteLinks': ['0ad8786c-53e2-4b70-8fb7-e8f7bdd5e3e3_1', '7cc9d39b-6345-4fef-85ed-72c461878f8e_1'], 'isHidden': False}, {'id': 'dc65f52d-baf7-4419-97a6-b80dd65a1996_1', 'relationId': 'dc65f52d-baf7-4419-97a6-b80dd65a1996', 'type': 'gateway', 'deviceType': 'gateway', 'createdAt': '2023-08-01T14:40:13.399Z', 'isReachable': True, 'lastSeen': '2024-04-17T19:27:00.380Z', 'attributes': {'customName': 'Almondell', 'model': 'DIRIGERA Hub for smart products', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '2.556.0', 'hardwareVersion': 'P2.5', 'serialNumber': 'dc65f52d-baf7-4419-97a6-b80dd65a1996', 'identifyStarted': '2024-04-11T02:48:30.000Z', 'identifyPeriod': 65534, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoDownload', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00', 'permittingJoin': False, 'backendConnected': True, 'backendConnectionPersistent': True, 'backendOnboardingComplete': True, 'backendRegion': 'eu-west-1', 'backendCountryCode': 'GB', 'userConsents': [{'name': 'analytics', 'value': 'disabled'}, {'name': 'diagnostics', 'value': 'enabled'}], 'logLevel': 3, 'coredump': False, 'timezone': 'Europe/London', 'nextSunSet': '2024-04-18T19:27:00.000Z', 'nextSunRise': '2024-04-18T05:01:00.000Z', 'homestate': 'home', 'countryCode': 'XZ', 'coordinates': {'latitude': 55.909909909909906, 'longitude': -3.4718298862129346, 'accuracy': -1}, 'isOn': False}, 'capabilities': {'canSend': [], 'canReceive': ['customName', 'permittingJoin', 'userConsents', 'logLevel', 'time', 'timezone', 'countryCode', 'coordinates']}, 'deviceSet': [], 'remoteLinks': []}, {'id': '691ac046-5225-419b-b806-7bce80dcce9d_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2023-10-23T19:05:11.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T12:04:39.000Z', 'attributes': {'customName': 'Front Light left ', 'model': 'TRADFRI bulb GU10 WW 400lm', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '2.3.093', 'hardwareVersion': '2', 'serialNumber': '84BA20FFFEC76F8A', 'productCode': 'LED1837R5', 'isOn': False, 'startupOnOff': 'startPrevious', 'lightLevel': 100, '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': '0968ebf6-a5fd-4bb0-95b0-ec58a3334176', 'name': 'Porch', 'color': 'ikea_orange_no_11', 'icon': 'rooms_coat_hanger'}, 'deviceSet': [{'id': 'c8e59cca-f28d-4861-83c5-780a45c76ea1', 'name': 'Front light ', 'icon': 'lighting_wall_lamp'}], 'remoteLinks': ['0ad8786c-53e2-4b70-8fb7-e8f7bdd5e3e3_1'], 'isHidden': False}, {'id': '03933f88-23b8-49b1-b99e-e4d33e6ae5c2_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2023-10-22T14:38:44.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T09:01:41.000Z', 'attributes': {'customName': 'Ceiling light ', 'model': 'STOFTMOLN ceiling/wall lamp WW37', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.006', 'hardwareVersion': '1', 'serialNumber': '90395EFFFE0C9711', 'productCode': 'T2037', 'isOn': False, 'startupOnOff': 'startPrevious', 'lightLevel': 100, 'startUpCurrentLevel': -1, 'identifyStarted': '2023-10-24T18:35:11.000Z', 'identifyPeriod': 15, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00'}, 'capabilities': {'canSend': [], 'canReceive': ['customName', 'isOn', 'lightLevel']}, 'room': {'id': 'a6663ac4-6ea3-4dca-889d-81ed5ee2a227', 'name': 'Living room', 'color': 'ikea_green_no_65', 'icon': 'rooms_sofa'}, 'deviceSet': [], 'remoteLinks': [], 'isHidden': False}, {'id': '03f97b72-9f5a-4bf8-ab64-d1e0d0095bdb_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2024-01-03T13:27:25.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T20:13:16.000Z', 'customIcon': 'products_ceiling_light', 'attributes': {'customName': 'Downstairs ', 'model': 'STOFTMOLN ceiling/wall lamp WW24', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.006', 'hardwareVersion': '1', 'serialNumber': '30FB10FFFE22F4B4', 'productCode': 'T2035', 'isOn': False, 'startupOnOff': 'startPrevious', 'lightLevel': 100, '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': '0968ebf6-a5fd-4bb0-95b0-ec58a3334176', 'name': 'Porch', 'color': 'ikea_orange_no_11', 'icon': 'rooms_coat_hanger'}, 'deviceSet': [], 'remoteLinks': ['a70155e0-1f2a-4781-8fb6-a16f5c81efa6_1', '0ad8786c-53e2-4b70-8fb7-e8f7bdd5e3e3_1', '7cc9d39b-6345-4fef-85ed-72c461878f8e_1'], 'isHidden': False}, {'id': 'e3d91dc1-d285-4f51-b9c6-f6a4a547552c_1', 'type': 'controller', 'deviceType': 'lightController', 'createdAt': '2024-04-12T08:08:02.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T06:51:12.000Z', 'attributes': {'customName': 'Living Room switch ', 'firmwareVersion': '1.0.57', 'hardwareVersion': '1', 'manufacturer': 'IKEA of Sweden', 'model': 'RODRET Dimmer', 'productCode': 'E2201', 'serialNumber': '6C5CB1FFFE8E7315', 'batteryPercentage': 100, 'isOn': False, 'lightLevel': 1, 'permittingJoin': False, 'otaPolicy': 'autoUpdate', 'otaProgress': 0, 'otaScheduleEnd': '00:00', 'otaScheduleStart': '00:00', 'otaState': 'readyToCheck', 'otaStatus': 'upToDate', 'circadianPresets': []}, 'capabilities': {'canSend': ['isOn', 'lightLevel'], 'canReceive': ['customName']}, 'room': {'id': 'a6663ac4-6ea3-4dca-889d-81ed5ee2a227', 'name': 'Living room', 'color': 'ikea_green_no_65', 'icon': 'rooms_sofa'}, 'deviceSet': [], 'remoteLinks': [], 'isHidden': False}, {'id': '0ad8786c-53e2-4b70-8fb7-e8f7bdd5e3e3_1', 'type': 'controller', 'deviceType': 'lightController', 'createdAt': '2024-04-12T09:50:47.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T08:34:28.000Z', 'attributes': {'customName': 'Porch switch ', 'firmwareVersion': '1.0.57', 'hardwareVersion': '1', 'manufacturer': 'IKEA of Sweden', 'model': 'RODRET Dimmer', 'productCode': 'E2201', 'serialNumber': '6C5CB1FFFE81B4EC', 'batteryPercentage': 100, 'isOn': False, 'lightLevel': 1, 'permittingJoin': False, 'otaPolicy': 'autoUpdate', 'otaProgress': 0, 'otaScheduleEnd': '00:00', 'otaScheduleStart': '00:00', 'otaState': 'readyToCheck', 'otaStatus': 'upToDate', 'circadianPresets': []}, 'capabilities': {'canSend': ['isOn', 'lightLevel'], 'canReceive': ['customName']}, 'room': {'id': '0968ebf6-a5fd-4bb0-95b0-ec58a3334176', 'name': 'Porch', 'color': 'ikea_orange_no_11', 'icon': 'rooms_coat_hanger'}, 'deviceSet': [], 'remoteLinks': [], 'isHidden': False}, {'id': 'b0998c68-344f-4f90-acc7-6d87c39b8194_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2023-10-23T19:04:09.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T12:05:18.000Z', 'attributes': {'customName': 'Front Light right ', 'model': 'TRADFRI bulb GU10 WW 400lm', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '2.3.093', 'hardwareVersion': '2', 'serialNumber': '943469FFFE636275', 'productCode': 'LED1837R5', 'isOn': False, 'startupOnOff': 'startPrevious', 'lightLevel': 100, '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': '0968ebf6-a5fd-4bb0-95b0-ec58a3334176', 'name': 'Porch', 'color': 'ikea_orange_no_11', 'icon': 'rooms_coat_hanger'}, 'deviceSet': [{'id': 'c8e59cca-f28d-4861-83c5-780a45c76ea1', 'name': 'Front light ', 'icon': 'lighting_wall_lamp'}], 'remoteLinks': ['0ad8786c-53e2-4b70-8fb7-e8f7bdd5e3e3_1'], 'isHidden': False}, {'id': '7cc9d39b-6345-4fef-85ed-72c461878f8e_1', 'type': 'controller', 'deviceType': 'lightController', 'createdAt': '2024-04-12T10:01:54.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T08:46:35.000Z', 'attributes': {'customName': 'Downstairs switch ', 'firmwareVersion': '1.0.57', 'hardwareVersion': '1', 'manufacturer': 'IKEA of Sweden', 'model': 'RODRET Dimmer', 'productCode': 'E2201', 'serialNumber': '5CC7C1FFFE88DE67', 'batteryPercentage': 100, 'isOn': False, 'lightLevel': 1, 'permittingJoin': False, 'otaPolicy': 'autoUpdate', 'otaProgress': 0, 'otaScheduleEnd': '00:00', 'otaScheduleStart': '00:00', 'otaState': 'readyToCheck', 'otaStatus': 'upToDate', 'circadianPresets': []}, 'capabilities': {'canSend': ['isOn', 'lightLevel'], 'canReceive': ['customName']}, 'room': {'id': '0968ebf6-a5fd-4bb0-95b0-ec58a3334176', 'name': 'Porch', 'color': 'ikea_orange_no_11', 'icon': 'rooms_coat_hanger'}, 'deviceSet': [], 'remoteLinks': [], 'isHidden': False}, {'id': 'a70155e0-1f2a-4781-8fb6-a16f5c81efa6_1', 'type': 'sensor', 'deviceType': 'motionSensor', 'createdAt': '2024-01-11T19:31:33.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T20:11:16.000Z', 'attributes': {'customName': 'Sensor 1', 'model': 'TRADFRI motion sensor', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '24.4.5', 'hardwareVersion': '1', 'serialNumber': '142D41FFFE208EC9', 'productCode': 'E1745', 'batteryPercentage': 90, 'isOn': False, 'lightLevel': 1, 'permittingJoin': False, 'otaStatus': 'upToDate', 'otaState': 'readyToCheck', 'otaProgress': 0, 'otaPolicy': 'autoUpdate', 'otaScheduleStart': '00:00', 'otaScheduleEnd': '00:00', 'sensorConfig': {'scheduleOn': True, 'onDuration': 120, 'schedule': {'onCondition': {'time': 'sunset', 'offset': -30}, 'offCondition': {'time': 'sunrise'}}}, 'circadianPresets': []}, 'capabilities': {'canSend': ['isOn', 'lightLevel'], 'canReceive': ['customName']}, 'room': {'id': '0968ebf6-a5fd-4bb0-95b0-ec58a3334176', 'name': 'Porch', 'color': 'ikea_orange_no_11', 'icon': 'rooms_coat_hanger'}, 'deviceSet': [], 'remoteLinks': [], 'isHidden': False}, {'id': 'e9843419-b56b-4cee-a3af-1645b495271a_1', 'type': 'light', 'deviceType': 'light', 'createdAt': '2023-10-21T19:10:59.000Z', 'isReachable': True, 'lastSeen': '2024-04-17T14:29:29.000Z', 'customIcon': 'products_ceiling_light', 'attributes': {'customName': 'Table light ', 'model': 'STOFTMOLN ceiling/wall lamp WW37', 'manufacturer': 'IKEA of Sweden', 'firmwareVersion': '1.0.006', 'hardwareVersion': '1', 'serialNumber': '3425B4FFFE7B506B', 'productCode': 'T2037', 'isOn': False, 'startupOnOff': 'startPrevious', 'lightLevel': 86, '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': 'a6663ac4-6ea3-4dca-889d-81ed5ee2a227', 'name': 'Living room', 'color': 'ikea_green_no_65', 'icon': 'rooms_sofa'}, 'deviceSet': [], 'remoteLinks': ['e3d91dc1-d285-4f51-b9c6-f6a4a547552c_1'], 'isHidden': False}] 2024-04-17 20:27:12.642 INFO (SyncWorker_55) [custom_components.dirigera_platform] -------------- 2024-04-17 20:27:12.642 INFO (SyncWorker_55) [custom_components.dirigera_platform] === END Devices JSON ===

sanjoyg commented 2 months ago

Would you test with latest release please

SzosszeNET commented 2 months ago

Thank you for looking into this, looks like it's indeed changing states now. What I wonder however that it has further attributes/configuration associated with in the IKEA app, that something at some point could work or that's a separate matter?

sanjoyg commented 2 months ago

@SzosszeNET what attributes, do let me know. If those available in the JSON dump I could make them available at HA

SzosszeNET commented 2 months ago

Hi @sanjoyg if I interpret the JSON correctly "sensorConfig': {'scheduleOn': True, 'onDuration': 120, 'schedule': {'onCondition': {'time': 'sunset', 'offset': -30}, 'offCondition': {'time': 'sunrise'}}}" belongs to the sensor's configuration. Maybe do need to create a couple more dumps to map ot the rest of the states?

SzosszeNET commented 2 months ago

Screenshot_20240424-223556

sanjoyg commented 2 months ago

Sorry, am not clear what is the request

SzosszeNET commented 2 months ago

Okay - so I'm wondering if the configuration of the sensor could be exposed to HA as in the app?

sensorConfig': {'scheduleOn': True, 'onDuration': 120, 'schedule': {'onCondition': {'time': 'sunset', 'offset': -30}, 'offCondition': {'time': 'sunrise'}}}"

sanjoyg commented 2 months ago

Can be exposed, but would be read only, will that work?

SzosszeNET commented 2 months ago

Thank you - I see. Was hoping it would be R/W. If it's just read-only maybe just put in your backlog and if and when?