Custom integration to set polling interval for Friends of Hue devices

The Hue integration, and specifically, the sensor manager for handle remotes and motion sensors, works with a polling system which is fixed with a 5s scan interval.

Knowing that a higher request rate normally hurts the hue bridges, but also knowing about the stability of their own systems, some people, like me, want to set a faster rate, or even being able to change it for some specific periods.

As this is not possible in the latest HA Core, I just did this custom integration: https://github.com/azogue/fasthue

  • It creates a sensor entity for each hue bridge, showing the current update interval.
  • It enables a new service fasthue.set_scan_interval to dynamically change the polling interval for each bridge.
  • It leaves no trace (and original polling is reinstated) when removed.
  • It is HACS compliant, so it can be added to HACS manually and used right now without any HA restart.
  • It is only UI configurable :slight_smile:

Please comment about if it is useful for you :slight_smile:

2 Likes

ha, this might be well worth the try, very nice, thank you very much.

What would make it even cooler, would be if it could somehow use an input_slider’s state for setting the update frequency:

  - service: fasthue.set_update_interval
    entity_id: sensor.hue_polling_interval
    data_template:
      scan_interval:
        seconds: {{states('input_number.hue_polling_interval')}}

so we could experiment ‘live’ from the frontend.
Would that be possible?

Would that be possible?

Yes, you already have the yaml to do it. You don’t need any change in the repo to do it, just do it like any other input number + automation to call any other HA service

1 Like

ok cool, I take it you mean like this:

automation:
  - alias: set_hue_polling_interval:
    trigger: 
      platform: state
      entity_id: input_number.hue_polling_interval
    action:
      service: fasthue.set_update_interval
      entity_id: sensor.hue_polling_interval
      data_template:
        scan_interval:
          seconds: >
            {{states('input_number.hue_polling_interval')}}

great, will try and report back!

great, will try and report back!

First cast the value to int in the template, that won’t work like that:

      data_template:
        scan_interval:
          seconds: >
            {{states('input_number.hue_polling_interval') | int }}

Templates render text. If you need numbers you need to explicitly convert them.

Also, about the scan_interval field in there, it is a time_period object, so you can pass a dict like that with seconds:, minutes:, etc, but you could also pass a text like this: “00:00:7” and would work.

I noticed that the data_template was not working and made a fix, please update the repo in the HACS tab (no HA restart needed). I also added the automation example to the README file, enjoy :slight_smile:

1 Like

cool, forgot the |int from the top of my head, sorry bout that.

thanks!

1 Like

@azogue I just wanted to thank you for this integration. The 5 seconds default made things like the Hue Smart Button almost useless. But what do you mean with short intervals can hurt the bridge? I’ve set it to 1sec and it works fine.

1 Like

Hi @dantist,

The 5 seconds default made things like the Hue Smart Button almost useless. But what do you mean with short intervals can hurt the bridge? I’ve set it to 1sec and it works fine.

Not hurt it physically, but those Hue hubs are famous for being not very powerful, and most of the people have A LOT of apps connected to the hub (so that means a lot of requests to the hub).

So, in some cases (not all, and not for sure), the hub fails when it’s being called with a high freq, like each 1s. But if it works for you, go on! the hub is not going to burn or anything else :slight_smile:

HA has a (very)conservative approach with this (and it’s perfectly understandable, given the full context), and because of that, the CC exists :slight_smile:

In my personal case, I’ve worked for years with a 2s freq, and sometimes with 1s, without any big problem (just some error logs when using 1s, occasionally), but for others, it tends to get messy with short update intervals…

1 Like

How can i set the interval to 1 second ?

and thanks @azogue for this great addon !

I installed the mod from HACs. Set my refresh to 1 second and then restarted home assistant but it is still using 5 second polling. All displays in the home assistant menu show 1 second. Restarted multiple times.

Thank you for this awesome module.
It’s working great, philips hue was very slow before, fully useless !

Thank you! Works perfect!
Friends of Hue Switch is now a nice input device :smiley:

Just don’t forgett to install the Integration in HA after HACS install :sweat_smile:

Hi @azogue - nice add on to the Hue integration!

I’m rather new at HA and installed you add on as described, so I have your integration showing under “Integrations” - got the frequency set to 1s, but my lights are still reporting slow.

Am I missing something - do I need to do any further steps to get this working?
I see some of the other guys talking about an Automation setup as well?

Thanks in advance
-Thomas