Faster custom component sensor polling interval?

Hi there!

I’ve setup python script as custom component. It is the ABElectronics IOPI board that provides I2C GPIOs.

Does anyone know how to set Home Assistant so that it will poll the sensor states faster, e.g. every 10 millisecond?

Currently it seems that triggering automation seems to take about 1 second after I push the button and the trigger activates. I think it is because Home Assistant does not register that the button is down any faster.

Update:
I got small progress when I added this to the custom component script:

SCAN_INTERVAL = timedelta(milliseconds=10)

However, the time interval between button push and trigger launch is varying quite a lot. I guess its between 10 ms to 1 second currently.

Does Home Assistant’s other functionality cause the lag or do you guys have any other ideas?

I have your same problem, how did you find that string “timedelta (milliseconds = 10)”?
Have you found a solution?

Hi!

In the new Home Assistant the Remote API has been depricated. You can still use it, if you create custom Python script and use the source code from here:https://github.com/home-assistant/home-assistant/blob/7d9f8b0d4c23eafcae1d0d9b67182394fc218f13/homeassistant/remote.py

I’ve have made custom Python script component that polls ABElectronics IOPI GPIO state changes and uses Remote API to ‘broadcast’ the changes to Home Assistant as sensor, e.g. sensor.kitchen_01: “on”. Home Assistant has automations to trigger switches when sensor state is changed between on and off.

Not yet sure how this polling and sensor state changes should be done in the latest version of HA. If anyone has good ideas, please let us know :slight_smile: