Skip to content

Troubles using photons from Home Assistant custom integration #110

@vendruscolo

Description

@vendruscolo

Hi Stephen, once again I want to first thank you for your effort with Photons. I've been using it for quite some time and it's worked flawlessly so far.

Some time ago I wrote a custom integration for LIFX Z strips, so that I could expose them to HA as "virtual" lights. The idea is to have certain zones of the strip to light up independently from others. The integration lives here https://github.com/vendruscolo/lifx_virtual_lights/blob/photons/light.py
Bear with me, I'm a Swift engineer so that Python is probably far from idiomatic.

It was working great with Python 3.6 and HA 2021.12. The other day I upgraded Python to 3.10 and HA to 2022.06 and it started complaining.

This is the error I get in the logs:

Task <Task pending name='Task-3573' coro=<LIFXVirtualLight.async_update() running at /home/homeassistant/.homeassistant/custom_components/lifx_virtual_lights/light.py:284> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.10/asyncio/tasks.py:475]> got Future <Future pending cb=[silent_reporter() at /srv/homeassistant/lib/python3.10/site-packages/photons_app/helpers.py:1349]> attached to a different loop

From what I understand (I might be wrong here), HA creates its asyncio run loop, and so does Photons. And then, when I run an async method from HA there's runloop mismatch.

I don't know if this is something that can be fixed with changes from Photons, though. Anyway, are you able to tell me more and provide some guidance on how to address this? I had an hard time even trying to understand the above error.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions