smart_meter_texas/__init__.py
async def read_meter(self, client: Client):
        """Triggers an on-demand meter read and returns it when complete."""
        _LOGGER.debug("Requesting meter reading")

        # Trigger an on-demand meter read.
        await client.request(
            OD_READ_ENDPOINT,
            json={"ESIID": self.esiid, "MeterNumber": self.meter},
        )

        # Occasionally check to see if on-demand meter reading is complete.
        while True:
            json_response = await client.request(
                LATEST_OD_READ_ENDPOINT,
                json={"ESIID": self.esiid},
            )
            try:
                data = json_response["data"]
                status = data["odrstatus"]
            except KeyError:
                _LOGGER.error("Error reading meter: ", json_response)
                raise SmartMeterTexasAPIError(
                    f"Error parsing response: {json_response}"
                )
            else:
                if status == "COMPLETED":
                    _LOGGER.debug("Reading completed: %s", self.reading_data)
                    self.reading_data = data
                    return self.reading_data
                elif status == "PENDING":
                    _LOGGER.debug("Meter reading %s", status)
                    _LOGGER.debug("Sleeping for %s seconds", OD_READ_RETRY_TIME)
                    await asyncio.sleep(OD_READ_RETRY_TIME)
                else:
                    _LOGGER.error("Unknown meter reading status: %s", status)
                    raise SmartMeterTexasAPIError(f"Unknown meter status: {status}")
Triggers an on-demand meter read and returns it when complete.
Triggers an on-demand meter read and returns it when complete.
Triggers an on - demand meter read and returns it when complete .
async def read_meter(self, client: Client):
        _LOGGER.debug("Requesting meter reading")
        await client.request(
            OD_READ_ENDPOINT,
            json={"ESIID": self.esiid, "MeterNumber": self.meter},
        )
        while True:
            json_response = await client.request(
                LATEST_OD_READ_ENDPOINT,
                json={"ESIID": self.esiid},
            )
            try:
                data = json_response["data"]
                status = data["odrstatus"]
            except KeyError:
                _LOGGER.error("Error reading meter: ", json_response)
                raise SmartMeterTexasAPIError(
                    f"Error parsing response: {json_response}"
                )
            else:
                if status == "COMPLETED":
                    _LOGGER.debug("Reading completed: %s", self.reading_data)
                    self.reading_data = data
                    return self.reading_data
                elif status == "PENDING":
                    _LOGGER.debug("Meter reading %s", status)
                    _LOGGER.debug("Sleeping for %s seconds", OD_READ_RETRY_TIME)
                    await asyncio.sleep(OD_READ_RETRY_TIME)
                else:
                    _LOGGER.error("Unknown meter reading status: %s", status)
                    raise SmartMeterTexasAPIError(f"Unknown meter status: {status}")
async def read_meter ( self , client : Client ) : _LOGGER . debug ( "Requesting meter reading" ) await client . request ( OD_READ_ENDPOINT , json = { "ESIID" : self . esiid , "MeterNumber" : self . meter } , ) while True : json_response = await client . request ( LATEST_OD_READ_ENDPOINT , json = { "ESIID" : self . esiid } , ) try : data = json_response [ "data" ] status = data [ "odrstatus" ] except KeyError : _LOGGER . error ( "Error reading meter: " , json_response ) raise SmartMeterTexasAPIError ( f"Error parsing response: {json_response}" ) else : if status == "COMPLETED" : _LOGGER . debug ( "Reading completed: %s" , self . reading_data ) self . reading_data = data return self . reading_data elif status == "PENDING" : _LOGGER . debug ( "Meter reading %s" , status ) _LOGGER . debug ( "Sleeping for %s seconds" , OD_READ_RETRY_TIME ) await asyncio . sleep ( OD_READ_RETRY_TIME ) else : _LOGGER . error ( "Unknown meter reading status: %s" , status ) raise SmartMeterTexasAPIError ( f"Unknown meter status: {status}" )
Triggers an on-demand meter read and returns it when complete.
Triggers an on - demand meter read and returns it when complete .
"""Triggers an on-demand meter read and returns it when complete.""" # Trigger an on-demand meter read. # Occasionally check to see if on-demand meter reading is complete.
self
client
Client