Skip to content

Home Assistant UK Police API v1.1

Choose a tag to compare

@91JJ 91JJ released this 31 May 09:32
· 2 commits to main since this release
a0f5768

v1.1.0

What's New

Smart data refresh

The integration previously polled all API endpoints every hour. UK Police data is only
published roughly every 2 months, so this was unnecessary load on both HA and the API.

The coordinator now wakes up once per day and makes a single lightweight call to
crime-last-updated. If the published date hasn't changed, the full fetch is skipped
entirely and all sensors retain their cached values. A full fetch only runs when new
data is actually available. Manual refresh is still available via the uk_police.refresh
service at any time.

Force detail sensors (2 new)

  • Force Description — surfaces the full force description text as a sensor state
    (truncated to 255 chars for HA state), with full_description, url, and telephone
    in attributes.
  • Force Engagement Channels — exposes all social media and online contact channels
    as a count sensor, with a channels list and a flat links dict ({title: url}) in
    attributes for easy use in Lovelace templates and automations.
  • Force Telephone sensor now also includes engagement_methods in its attributes.

Per-location geo_location source

Previously all crime map pins shared the source uk_police, making it impossible to
filter pins by location on a Lovelace map card. Each configured area now gets its own
source in the format uk_police_{force}_{neighbourhood} (e.g.
uk_police_metropolitan_E05013580), with hyphens normalised to underscores. The exact
value is visible on any geo_location entity's source attribute.

Bug fixes

  • Fixed crash (RuntimeError: Attribute hass is None) on second location setup caused
    by geo_location update callbacks being fired before entities were registered with HA.
    Both _setup_grouped and _setup_individual now guard update_crimes/update_crime
    calls with a hass is not None check.
  • Removed unused PLATFORMS, OUTCOME_CATEGORIES, and STOP_SEARCH_OBJECT_TYPES
    constants from const.py.
  • Removed unused import homeassistant.helpers.config_validation as cv from
    config_flow.py.
  • Moved _strip_html helper in sensor.py to after the import block (was incorrectly
    defined before imports).