Fix Bayesian Binary JSON Serialization (#34540)

This commit is contained in:
Jeff McGehee authored and GitHub committed 2020-04-22 11:25:14 -07:00
1 parent 08cacb9f51
commit dcf51e5a14
2 files changed
+71 -6

No files matched your search

@@ -298,8 +298,16 @@ class BayesianBinarySensor(BinarySensorDevice):
@property
def device_state_attributes(self):
"""Return the state attributes of the sensor."""
attr_observations_list = list(
obs.copy() for obs in self.current_observations.values() if obs is not None
)
for item in attr_observations_list:
item.pop("value_template", None)
return {
ATTR_OBSERVATIONS: list(self.current_observations.values()),
ATTR_OBSERVATIONS: attr_observations_list,
ATTR_OCCURRED_OBSERVATION_ENTITIES: list(
{
obs.get("entity_id")