コード例 #1
0
def test_get_last_meter_read(event_loop):
    meter = Meter(
        email=os.getenv("EMAIL"),
        password=os.getenv("PASSWORD"),
        mfa_type=os.getenv("MFA_TYPE"),
        mfa_secret=os.getenv("MFA_SECRET"),
        account_id=os.getenv("ACCOUNT_ID"),
        meter_id=os.getenv("METER_NUM"),
        # browser_path="/Users/bvlaicu/Library/Application Support/pyppeteer/local-chromium/588429/chrome-mac/Chromium.app/Contents/MacOS/Chromium"
    )
    val, uom = event_loop.run_until_complete(meter.last_read())
    assert isinstance(val, float)
コード例 #2
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the sensor platform."""

    meter_number = config[CONF_METER_NUMBER]

    try:
        meter = Meter(meter_number)

    except MeterError:
        _LOGGER.error("Unable to create Oru meter")
        return

    add_entities([CurrentEnergyUsageSensor(meter)], True)

    _LOGGER.debug("Oru meter_number = %s", meter_number)
コード例 #3
0
def setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Set up the sensor platform."""

    meter_number = config[CONF_METER_NUMBER]

    try:
        meter = Meter(meter_number)

    except MeterError:
        _LOGGER.error("Unable to create Oru meter")
        return

    add_entities([CurrentEnergyUsageSensor(meter)], True)

    _LOGGER.debug("Oru meter_number = %s", meter_number)