SQL - Home Assistant scan interval

Hi all, I have set up a few SQL - Home Assistant sensors that connects to another MYSQL database on my LAN to pull info, and am running into issues such as “Can’t reconnect until invalid transaction is rolled back” errors and I believe it to be because by default the SQL sensor polls every 30 seconds. Is there a way to change this poll interval for all my sensors or even turn it off altogether and just call the updates myself using the Home Assistant Core Integration: Update entity?

I would appreciate any feedback.

Yes, go to the configuration options in the SQL integration and turn off polling. But you’ll have to manually poll the device using an automation with the homeassistant.update_entity service.

1 Like

Thanks for replying. Please see screenshot below as I do not see how to turn off polling on each sensor.

(password was changed for protection.)

Click submit. Then click the 3 dots on the SQL integration. Then click System Options. Then turn off Enable polling for updates.

1 Like

I feel like a complete tool for missing that. Thank you so much!

Petro, is there any way to disable polling on all sql sensors en-masse ? I have hundreds of sql sensors, which makes manually clicking each one impractical.

You could write a script or scripts to update them.

The script could be triggered by button click or periodically by automation.

I am in the process of adding labels on mine (SQL entities) that indicate which need updating hourly, weekly, monthly etc.

And there’s always Spook…

That allows enable/disable polling for any integration

1 Like

The thing is, I don’t use the UI to create the sql calls (precisely because there are so many of them).

Can spooks disable the polling for the entire integration (including the yaml entries ?) or only those added through the integration config ?

A script would be the same issue. The only way I can think of is to modify the integration code it self which Im not entire comfortable with doing.

The fact of spook can disable the polling for an entire integration is on the first page of the link that I provided to you for spook.

Either I misspoke, or you misunderstood. Spook can disable polling for a single instance of an integration, not an entire integration. So would still be manual for each entry. Which doesn’t make much sense. I went the script road instead. So now its a PY script with database calls. Much more efficient.