tuya / tuya-device-sharing-sdk

Tuya Device Sharing SDK
MIT License
19 stars 6 forks source link

HomeAssistant Tuya integrations show Arlec GridConnect BLE devices as unavailable (OFFLINE) #8

Open auphof opened 9 months ago

auphof commented 9 months ago

In Homeassistant with the Arlec Grid Connect Smart Home Sensor Kit (BLE PIR Motion detection and Window/Door Contact sensors) they are functionally registered to the Tuya(Smartlife App). The sensors are also registering in the homeassistant Tuya integration, but remain unavailable, with no state change or battery voltage indication. Enabling the debug logging show that the integration is receiving the reports from the sensors.

Debugging the Homeassistant integration show the device.online state stays False and there does not appear a mechanism for this to be set True.

Fixing the device.online (See PR being submitted) then the PIR Detect works in HomeAssistant but it fails to Clear. The msg data for for the PIR's comes in as CapWords and gets handled by the _on_device_report in manager.py as an enum by the strategy.convert(strategy_name, ....... which is expecting all lowercase words` image

The PR being submitted presents a workaround, patching the enumMappingMap received from the api call at initialization. I am not familiar with all the Tuya devices but maybe a change to the enum stratergy handler tuya_sharing/strategy_repo/enum_.py should be made. I trust the Tuya/dev will know better where to make this change