Skip to content

fix: remove invalid response key from services.yaml to pass hassfest#35

Merged
Geek-MD merged 4 commits into
mainfrom
copilot/fix-sensor-issue-v121
Mar 15, 2026
Merged

fix: remove invalid response key from services.yaml to pass hassfest#35
Geek-MD merged 4 commits into
mainfrom
copilot/fix-sensor-issue-v121

Conversation

Copilot AI commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Hassfest rejected services.yaml with two errors on format_events:

  • extra keys not allowed @ data['format_events']['response']response: is not a recognized key in the services schema
  • required key not provided @ data['format_events']['target'] — cascading error triggered by the invalid response: block

Change

Removed the response: block from format_events in services.yaml:

# Before
format_events:
  name: Format Events
  description: "Returns the stored earthquake events formatted as human-readable text."
  fields: {}
  response:
    optional: false

# After
format_events:
  name: Format Events
  description: "Returns the stored earthquake events formatted as human-readable text."
  fields: {}

The response contract (supports_response=SupportsResponse.ONLY) is declared in Python and does not require a corresponding response: key in the YAML schema.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…e action (v1.2.1)

- Fix sensor state showing 'unknown': entry.time from aio_geojson is a datetime
  object; calling .replace('Z', '+00:00') on it raised TypeError (silently caught),
  leaving _attr_native_value as None. Now handles both datetime objects and strings.
- Remove incorrect @callback decorator from async def _async_update_events.
- Fix _attr_native_value type annotation (datetime | None, not str | None).
- Remove formatted_events from sensor extra_state_attributes.
- Add format_events service with SupportsResponse.ONLY, returning formatted events
  as response variable.
- Extract shared parse_event_time() and format_event() helpers to helpers.py to
  eliminate code duplication and improve exception handling.
- Update services.yaml, manifest.json (1.2.1), and CHANGELOG.md.

Co-authored-by: Geek-MD <25725990+Geek-MD@users.noreply.github.com>
Copilot AI changed the title [WIP] [V1.2.1] Solve problem in sensor fix(sensor): resolve unknown state and move formatted_events to service action (v1.2.1) Mar 15, 2026
Copilot AI requested a review from Geek-MD March 15, 2026 21:05
- Remove formatted_events sensor attribute reference (moved to service action)
- Fix sensor max events: 10 → 50 (matches MAX_EVENTS constant)
- Add dedicated section for the new format_events action with usage example
- Rename "Manual Feed Refresh" section to "Services / Actions" and document both
  force_feed_update and format_events services

Co-authored-by: Geek-MD <25725990+Geek-MD@users.noreply.github.com>
Copilot AI changed the title fix(sensor): resolve unknown state and move formatted_events to service action (v1.2.1) fix(sensor): state always "unknown" + move formatted_events to service action (v1.2.1) Mar 15, 2026
Co-authored-by: Geek-MD <25725990+Geek-MD@users.noreply.github.com>
Copilot AI changed the title fix(sensor): state always "unknown" + move formatted_events to service action (v1.2.1) fix: remove invalid response key from services.yaml to pass hassfest Mar 15, 2026
@Geek-MD Geek-MD marked this pull request as ready for review March 15, 2026 21:16

@code-review-doctor code-review-doctor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Worth considering though. View full project report here.

self._events.extend(filtered_events)
self._events = sorted(self._events, key=parse_time, reverse=True)[:MAX_EVENTS]
self._events = sorted(
self._events, key=lambda e: parse_event_time(e), reverse=True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self._events, key=lambda e: parse_event_time(e), reverse=True
self._events, key=parse_event_time, reverse=True

Avoid unnecessarily wrapping parse_event_time in a lambda. More details.

@Geek-MD Geek-MD merged commit b9a7237 into main Mar 15, 2026
3 checks passed
@Geek-MD Geek-MD deleted the copilot/fix-sensor-issue-v121 branch March 15, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants