Leggin / dirigera

This repository provides an unofficial Python client for controlling the IKEA Dirigera Smart Home Hub.
MIT License
99 stars 19 forks source link

Add MotionSensor functionality #38

Closed fdewes closed 6 months ago

fdewes commented 7 months ago

Hi i just bought the Tradfri motion sensor which came out lately and started to work on integrating it into your great project here :)

the get_all_devices(self) was useful for me in order to find out devices not supported by the software yet and _something like this could be helpful in the future?!?

the get_motion_sensors() function works and I am not sure about the Attributes of the class, though. I might need some help implementing this.

Please let me know if you are interested in including this and/orwhat is needed to merge this, since I am not a software developer ;)

Thanks & Cheers!

Leggin commented 6 months ago

I like it! I will add some tests once I have time (if no one else beats me to it). Thank you!

Leggin commented 6 months ago

I am not sure about the Attributes of the class, though. I might need some help implementing this.

Can you post the full json response of the motion sensor get request?

fdewes commented 6 months ago

Sure, here it is:

{'id': '62e95143-c8b6-4f28-b581-adfd622c0db7_1', 'type': 'sensor', 'deviceType': 'motionSensor', 'createdAt': '2023-12-14T18:28:57.000Z', 'isReachable': True, 'lastSeen': '2023-12-14T17:30:48.000Z', 'attributes': {'customName': 'Bewegungssensor', 'firmwareVersion': '24.4.5', 'hardwareVersion': '1', 'manufacturer': 'IKEA of Sweden', 'model': 'TRADFRI motion sensor', 'productCode': 'E1745', 'serialNumber': '142D51FFFE229101', 'batteryPercentage': 100, 'isOn': False, 'lightLevel': 1, 'permittingJoin': False, 'otaPolicy': 'autoUpdate', 'otaProgress': 0, 'otaScheduleEnd': '00:00', 'otaScheduleStart': '00:00', 'otaState': 'readyToCheck', 'otaStatus': 'upToDate', 'sensorConfig': {'scheduleOn': False, 'onDuration': 120, 'schedule': {'onCondition': {'time': 'sunset', 'offset': -60}, 'offCondition': {'time': 'sunrise', 'offset': 60}}}, 'circadianPresets': []}, 'capabilities': {'canSend': ['isOn', 'lightLevel'], 'canReceive': ['customName']}, 'room': {'id': 'e1631a64-9ceb-4113-a6b3-1d866216503c', 'name': 'Zimmer', 'color': 'ikea_beige_1', 'icon': 'rooms_arm_chair'}, 'deviceSet': [], 'remoteLinks': [], 'isHidden': False}