#Developing a custom component for polling an API / Coordinator never updated

16 messages · Page 1 of 1 (latest)

mighty kayak
#

Hello, i’m trying to develop a new integration.
I’m totally newbie on HASS dev and python …

I tried to follow different example to create my own custom integration for polling an API.

After setup the integration, a first fetch is correctly done.

But after, no update is called.

On my coordinator (https://github.com/PierrickP/hass-purrseapp-component/blob/da7e124e30bf6ea684284ad0b92a9025c0863966/custom_components/purrseapp/coordinator.py#L39-L44), i called

 super().__init__(
   hass,
   _LOGGER,
   name=DOMAIN,
   update_interval=timedelta(seconds=30),
)

But nothing after 30sec.
Nothing on logs.

I’m a bit lost. Any idea ?

copper dragon
#

do you have debug logging on?

mighty kayak
#

@copper dragon for my components, yes.
I'm logging many things to debug

homeassistant:
  debug: true

logger:
  default: info
  logs:
    custom_components.purrseapp: debug
copper dragon
#

Because looking at this I would expect it to work

#

Also, I gave you the developer role, it's better to ask in the development section 🙂

#

Oh

#

one thing that might be a case

#

The coordinator is optimized to not poll if there are no listeners

#

Your sensors don't seem to be updated to use the coordinator yet, so nothing is listening to the updates

mighty kayak
#

Hum seem logic but i have no idea how to add a listener

copper dragon
#

The sensor entities should also inherit a CoordinatorEntity

mighty kayak
#

oh it was exactly that !

#

Thanks @copper dragon 🙇 !

copper dragon
#

Considered making it a core integration?

mighty kayak