Hello everyone,
I am currently using a custom integration based on the pykuna library for my Kuna devices (cameras/lights) in Home Assistant, and I am running into two persistent issues that seem related to the underlying library or the Kuna API itself. I am looking for anyone who might be maintaining a newer fork or has found a workaround for these limitations.
1. Light Control is Missing/Broken
When attempting to control the light switches in Home Assistant, the operation fails. Debug logs show the following critical error:
CRITICAL ERROR turning off [Light Name]: ‘KunaCamera’ object has no attribute ‘turn_light_off’
Diagnosis: This strongly suggests that the version of the pykuna library currently in use is outdated and does not contain the necessary methods (turn_light_on, turn_light_off, or similar service calls) to control the lights. The integration is essentially read-only for light control.
2. Critical State Synchronization Failure (API Caching)
The main issue is that Home Assistant fails to read the correct light status after a scheduled event executes in the Kuna Mobile App.
Scenario: I set a schedule in the Kuna App to turn a light OFF at 22:30.
Result: The light physically turns OFF. However, Home Assistant continues to report the state as ON indefinitely, even with aggressive polling (5-15 seconds) and forced updates (kuna_new.update service calls).
The Key Finding: The only way to update the state in Home Assistant is to manually open the Kuna Mobile App and navigate to the specific device’s detail page. Once the App is opened, the state updates within seconds in HA.
Diagnosis: This indicates a severe API Caching problem on the Kuna side. The Kuna API server only seems to clear its cached status and pull the live state from the device when the official App actively requests it, ignoring standard API polling requests from third-party clients like HA.
Seeking Help
Does anyone maintain a more up-to-date fork of the pykuna library that includes working light control methods?
Has anyone found a robust workaround for the Kuna API state caching issue that does not rely on running the Kuna App constantly in the background? (e.g., a specific undocumented API call that forces a cache flush).
Any guidance or shared code repositories would be greatly appreciated!
Thank you!