Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use unknown as the "missing" HASS MQTT Discovery state payload #294

Merged
merged 1 commit into from
Sep 22, 2022
Merged

Conversation

bachya
Copy link
Owner

@bachya bachya commented Sep 22, 2022

Describe what the PR does:

When encountering a data point with no value, the Home Assistant MQTT Discovery publisher:

  1. Sends a state value of None
  2. Marks the entity as unavailable

It turns out that None will cause other HASS integrations (like Google Assistant) to fail. So, this PR makes the following changes:

  1. Entities are always marked as available (since we have no way of knowing things like whether the gateway is connected).
  2. When a data point has no value, we send unknown (a valid value).

This is technically a breaking change since downstream HASS users will need to be aware that entities (a) will now always be available and (b) plan for an unknown state if appropriate (e.g., for something like wind chill, where the value exists only under certain circumstances).

Does this fix a specific issue?

Fixes #293

Checklist:

  • Confirm that one or more new tests are written for the new functionality.
  • Run tests and ensure everything passes (with 100% test coverage).
  • Update README.md with any new documentation.
  • Add yourself to AUTHORS.md.

@bachya bachya added bug Bugs or issues which will cause a problem for users breaking change labels Sep 22, 2022
@bachya bachya self-assigned this Sep 22, 2022
@bachya bachya merged commit bf4f90b into dev Sep 22, 2022
@bachya bachya deleted the unknown branch September 22, 2022 21:59
@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs or issues which will cause a problem for users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HASS MQTT Discovery shouldn't return None for unavailable/unknown values
1 participant