{"record":{"id":"e344874ec551aab2","repo":"home-assistant/core","slug":"equal-probabilities","errorCode":"equal_probabilities","errorMessage":"equal_probabilities","messagePattern":"equal_probabilities","errorType":"validation","errorClass":"SchemaFlowError","httpStatus":null,"severity":"warning","filePath":"homeassistant/components/bayesian/config_flow.py","lineNumber":361,"sourceCode":"\n    Validation is done entirely by the schemas.\n    \"\"\"\n    user_input = _convert_percentages_to_fractions(user_input)\n    return {**user_input}\n\n\ndef _validate_observation_subentry(\n    obs_type: ObservationTypes,\n    user_input: dict[str, Any],\n    other_subentries: list[dict[str, Any]] | None = None,\n) -> dict[str, Any]:\n    \"\"\"Validate an observation input and update options.\n\n    Observations are nested items and need manual updates.\n    \"\"\"\n\n    if user_input[CONF_P_GIVEN_T] == user_input[CONF_P_GIVEN_F]:\n        raise SchemaFlowError(\"equal_probabilities\")\n    user_input = _convert_percentages_to_fractions(user_input)\n\n    # Save the observation type in the user input as it is needed in binary_sensor.py\n    user_input[CONF_PLATFORM] = str(obs_type)\n\n    # Additional validation for multiple numeric state observations\n    if (\n        user_input[CONF_PLATFORM] == ObservationTypes.NUMERIC_STATE\n        and other_subentries is not None\n    ):\n        _LOGGER.debug(\n            \"Comparing with other subentries: %s\", [*other_subentries, user_input]\n        )\n        try:\n            above_greater_than_below(user_input)\n            no_overlapping([*other_subentries, user_input])\n        except vol.Invalid as err:\n            raise SchemaFlowError(err) from err","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/bayesian/config_flow.py#L343-L379","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Change one of the two probabilities so they differ (e.g. p_given_true 90, p_given_false 10) and resubmit the observation form.","If the observation truly gives no signal either way, remove it instead of saving it.","Review the bayesian docs on prior/likelihood math to pick meaningful values."],"exampleFix":"# before (YAML equivalent the flow mirrors)\nplatform: state\nentity_id: binary_sensor.door\np_given_true: 0.5\np_given_false: 0.5\n# after\nplatform: state\nentity_id: binary_sensor.door\np_given_true: 0.9\np_given_false: 0.1","handlingStrategy":"validation","validationCode":"p_true = user_input[CONF_P_GIVEN_T]\np_false = user_input[CONF_P_GIVEN_F]\nif p_true == p_false:\n    # reject before submitting the observation form\n    show_error(\"Probabilities given true and false must differ\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave both probability fields at defaults when adding a bayesian observation.","Sanity-check that p_given_true > p_given_false for a 'positive' observation (or reversed for an inverse one)."],"tags":["home-assistant","bayesian","config-flow","validation"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}