Skip to content

Conversation

@elupus
Copy link
Contributor

@elupus elupus commented Jan 31, 2026

Breaking change

Proposed change

Entities of input type like numbers, text or date fields should not be disabled due to the value currently being unknown. The user is in charge of setting a value even if the current value is in an unknown state.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@ildar170975
Copy link
Contributor

ildar170975 commented Feb 1, 2026

The user is in charge of setting a value even if the current value is in an unknown state.

If a state is unknown, this may happen because the entity does not exist. Then what an inputted value will be set to?

@elupus
Copy link
Contributor Author

elupus commented Feb 1, 2026

If entity is not known. The state will be UNAVAILABLE not UNKNOWN.

@ildar170975
Copy link
Contributor

If entity is not known. The state will be UNAVAILABLE not UNKNOWN.

Not correct.
image

@elupus
Copy link
Contributor Author

elupus commented Feb 1, 2026

If entity is not known. The state will be UNAVAILABLE not UNKNOWN.

Not correct. image

This is backend we are talking about. Not sure why states() function would say unknown there. If its a non-existent entity, the stateObj object would not exist at all.

Looks like the states() function either just hides this case or is buggy.

@elupus
Copy link
Contributor Author

elupus commented Feb 1, 2026

Checked docs on that function and it is apparently documented to work that way. That is rather weird, but we are not using that here.

A none/empty value from an integration will lead to the state unknown. Ie unset value or no update has been performed to read the value have been performed yet. This doesn't indicate we cant set a value.

@ildar170975
Copy link
Contributor

ildar170975 commented Feb 1, 2026

If a helper entity does not exist (and thus it's state is uknown, and it's stateObj is supposed to be undefined), it's corr. UI element is not shown at all.
image
The case which you described - I am not even sure that this is possible, that core allows to set empty states for helpers.

@elupus
Copy link
Contributor Author

elupus commented Feb 1, 2026

@elupus
Copy link
Contributor Author

elupus commented Feb 1, 2026

@piitaya
Copy link
Member

piitaya commented Feb 11, 2026

If the entity doesn't exist, it will not be in the state machine so stateObj will be undefined.

I also personally think that we should not consider unknown as available.

We should look where this unavailable helper is used in the codebase to see if we can remove the unknown check everywhere.

@elupus
Copy link
Contributor Author

elupus commented Feb 11, 2026

Dont fully follow. But if its not in state machine its really unavailable. But the case of being in state machine, it can be STATE_UNKNOWN (integration returned none as state value). STATE_UNAVAILABLE (integration returned false in the available property).

So we have three cases.

I would prefer not to differentiate between not in state machine and unavailable. ( I hate the yellow notification on entities from unloaded entities. I disable integrations seasonally, but that is just me)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants