Show learning activity with Learning Progress and Last Sample sensors
During a first test the Status entity only said "learning" for the first half hour (the radiator-lag wait after a restart), and the attributes explaining why were hard to find. Add two sensors: - Learning Progress (%): for the least trained room, the mean of its three readiness requirements (200 samples, 30 ON, 30 OFF), each capped at 100 %; 100 % means ready. Attributes show the counts. - Last Sample: an enum of the last poll's learning outcome, with English and Romanian state names (e.g. "Waiting for radiators to settle"). Its history shows when learning happens. Polls blocked by missing shared inputs now report waiting_for_inputs. Readiness thresholds move to const.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3c949333bd
commit
d2bd398a0f
9 files changed
+179
-11
No files matched your search
@@ -686,3 +686,14 @@ class BoundaryTests(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(data['forecast_accuracy'][15]['samples'], 2)
|
||||
self.fresh('sensor.room', 'sensor.outside')
|
||||
self.assertEqual((await self.sample())['forecast_accuracy'][15]['samples'], 3)
|
||||
|
||||
async def test_learning_progress_and_waiting_result(self):
|
||||
data = await self.sample()
|
||||
self.assertEqual((data['sample_result'], data['learning_progress']), ('first_sample', 0))
|
||||
self.ready()
|
||||
self.fresh('sensor.room', 'sensor.outside')
|
||||
self.assertEqual((await self.sample())['learning_progress'], 100)
|
||||
self.states['sensor.outside'].state = 'unavailable'
|
||||
data = await self.sample()
|
||||
self.assertEqual(data['sample_result'], 'waiting_for_inputs')
|
||||
self.assertEqual(data['sample_results_since_start']['waiting_for_inputs'], 1)
|
||||
Reference in new issue
Block a user