Round off probability to 2 decimals. (#9365)

* Round off probablity to 2 decimals.

* Update tests

* remove debug print
This commit is contained in:
Alok Saboo authored and Pascal Vizeli committed 2017-09-11 21:14:51 +02:00
1 parent cc1979691e
commit c7ecebfd07
2 files changed
+3 -4

No files matched your search

@@ -126,7 +126,6 @@ class BayesianBinarySensor(BinarySensorDevice):
self.watchers[platform](entity_obs)
prior = self.prior
print(self.current_obs.values())
for obs in self.current_obs.values():
prior = update_probability(prior, obs['prob_true'],
obs['prob_false'])
@@ -201,7 +200,7 @@ class BayesianBinarySensor(BinarySensorDevice):
"""Return the state attributes of the sensor."""
return {
'observations': [val for val in self.current_obs.values()],
'probability': self.probability,
'probability': round(self.probability, 2),
'probability_threshold': self._probability_threshold
}