PRICE-01: migration note, and the tests drive the real control cycle
- DOCS: the migration note said markup and taxes do not matter; with the provider they are added to the wholesale price. Step 4 and 5 now say what they set and what static_profile does while no source has a price. - The gap tests run the notification through cycle(), where the check is called, so a check that is never called goes red. - test header: the real-transport checks are section 11. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC
This commit is contained in:
co-authored by
Claude
parent
87ad958842
commit
4eb88f7fda
@@ -21,7 +21,7 @@ THE SERVER IS A MOCK. This session holds no token, so it cannot ask the real
|
||||
one for a price. `Server` below answers the layout the design's API section
|
||||
gives (`unix_seconds`, `price`, `unit`, `zone`, `covers`, `source`,
|
||||
`fetched_at`), over a transport with the same contract as `price.https_get`.
|
||||
Section 12 drives the REAL `https_get` against a local aiohttp server, for the
|
||||
Section 11 drives the REAL `https_get` against a local aiohttp server, for the
|
||||
parts a mock transport cannot show: the header on the wire, the status words,
|
||||
the timeout, a refused connection.
|
||||
|
||||
@@ -637,6 +637,9 @@ class FakeHass:
|
||||
async def number(self, entity, invert=False):
|
||||
return self.values.get(entity)
|
||||
|
||||
async def set_number(self, entity, value):
|
||||
return True
|
||||
|
||||
async def call(self, domain, service, data):
|
||||
self.calls.append((domain, service, data))
|
||||
return True
|
||||
@@ -730,11 +733,13 @@ class Wired:
|
||||
await asyncio.wait_for(task, timeout=5)
|
||||
|
||||
async def tick(self, now=None):
|
||||
"""One 30 s tick: read inputs, then the price-gap check."""
|
||||
"""One control tick as `run_control` makes it: read inputs, then the
|
||||
cycle, which is where the price-gap check is called from."""
|
||||
if now is not None:
|
||||
self.clock.now = now
|
||||
self.ctl.auto = True
|
||||
await self.ctl.read_inputs()
|
||||
await self.ctl.check_price_gap()
|
||||
await self.ctl.cycle()
|
||||
|
||||
def notes(self):
|
||||
return [(s, d) for dom, s, d in self.ctl.hass.calls
|
||||
|
||||
Reference in New Issue
Block a user