home-assistant/core · warning · SchemaFlowError

equal_probabilities

equal_probabilities

Error message

equal_probabilities

What it means

The bayesian config flow raises SchemaFlowError('equal_probabilities') in _validate_observation_subentry (config_flow.py:361) when the user submits an observation whose probability given a true condition (p_given_true) equals the probability given a false condition (p_given_false). An observation that fires with the same likelihood whether the bayesian binary_sensor is on or off carries zero information, so the integration rejects it during the UI config flow.

Source

Thrown at homeassistant/components/bayesian/config_flow.py:361

    Validation is done entirely by the schemas.
    """
    user_input = _convert_percentages_to_fractions(user_input)
    return {**user_input}


def _validate_observation_subentry(
    obs_type: ObservationTypes,
    user_input: dict[str, Any],
    other_subentries: list[dict[str, Any]] | None = None,
) -> dict[str, Any]:
    """Validate an observation input and update options.

    Observations are nested items and need manual updates.
    """

    if user_input[CONF_P_GIVEN_T] == user_input[CONF_P_GIVEN_F]:
        raise SchemaFlowError("equal_probabilities")
    user_input = _convert_percentages_to_fractions(user_input)

    # Save the observation type in the user input as it is needed in binary_sensor.py
    user_input[CONF_PLATFORM] = str(obs_type)

    # Additional validation for multiple numeric state observations
    if (
        user_input[CONF_PLATFORM] == ObservationTypes.NUMERIC_STATE
        and other_subentries is not None
    ):
        _LOGGER.debug(
            "Comparing with other subentries: %s", [*other_subentries, user_input]
        )
        try:
            above_greater_than_below(user_input)
            no_overlapping([*other_subentries, user_input])
        except vol.Invalid as err:
            raise SchemaFlowError(err) from err

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Change one of the two probabilities so they differ (e.g. p_given_true 90, p_given_false 10) and resubmit the observation form.
  2. If the observation truly gives no signal either way, remove it instead of saving it.
  3. Review the bayesian docs on prior/likelihood math to pick meaningful values.

Example fix

# before (YAML equivalent the flow mirrors)
platform: state
entity_id: binary_sensor.door
p_given_true: 0.5
p_given_false: 0.5
# after
platform: state
entity_id: binary_sensor.door
p_given_true: 0.9
p_given_false: 0.1
Defensive patterns

Strategy: validation

Validate before calling

p_true = user_input[CONF_P_GIVEN_T]
p_false = user_input[CONF_P_GIVEN_F]
if p_true == p_false:
    # reject before submitting the observation form
    show_error("Probabilities given true and false must differ")

Prevention

When it happens

Trigger: Creating or editing a bayesian observation subentry (state, numeric_state, or template type) in the config flow with 'Probability given true' equal to 'Probability given false' (e.g. both 50). The check runs before percentage-to-fraction conversion, on the raw submitted values.

Common situations: Leaving both probability sliders/fields at their default 50%; copy-pasting an observation and forgetting to change one of the two probabilities; misunderstanding that the two fields must differ for the observation to be informative.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/e344874ec551aab2. Report an issue: GitHub.