Skip to main content

Async Python client for Generac PWRview / Neurio energy monitors

Project description

generac-pwrview

Async Python client for Generac PWRview (formerly Neurio) energy monitors.

Supports both the cloud API and direct local device access over your network.

Features

  • Async-first — built on aiohttp, no blocking calls
  • Cloud API — OAuth2 authentication, live samples, energy stats, full channel data
  • Local API — direct device polling with no cloud account required
  • Typed — full type hints with py.typed (PEP 561)
  • Session injection — pass your own aiohttp.ClientSession or let the client manage one

Installation

pip install generac-pwrview

Usage

Cloud API

import aiohttp
from generac_pwrview import PWRviewClient

async with aiohttp.ClientSession() as session:
    client = PWRviewClient(
        api_key="your_api_key",
        api_secret="your_api_secret",
        session=session,
    )

    # Discover sensors on your account
    user_info = await client.get_user_information()
    sensor = user_info.locations[0].sensors[0]
    print(f"Sensor: {sensor.serial_number} at {sensor.ip_address}")

    # Get current power readings
    live = await client.get_live_sample(sensor.sensor_id)
    print(f"Consumption: {live.consumption_power} W")
    print(f"Generation:  {live.generation_power} W")
    print(f"Net:         {live.net_power} W")

    # Get today's energy stats
    stats = await client.get_stats(sensor.sensor_id, start, "days", end)

    # Get full samples with voltage and phase data
    samples = await client.get_samples(
        sensor.sensor_id, start, "hours", end, full=True
    )

Local API

No cloud account needed — connect directly to the device on your network.

import aiohttp
from generac_pwrview import PWRviewLocalClient

async with aiohttp.ClientSession() as session:
    client = PWRviewLocalClient(host="192.168.1.100", session=session)
    sample = await client.get_current_sample()

    for channel in sample.channels:
        print(f"[{channel.channel_type}] {channel.power} W @ {channel.voltage} V")

Standalone (no session injection)

from generac_pwrview import PWRviewClient

async with PWRviewClient(api_key="...", api_secret="...") as client:
    user_info = await client.get_user_information()

API Reference

PWRviewClient (cloud)

Method Description
get_user_information() Discover sensors and locations on your account
get_live_sample(sensor_id) Current power and energy readings
get_stats(sensor_id, start, granularity, end) Aggregated energy statistics
get_samples(sensor_id, start, granularity, end, full=False) Historical samples with optional channel/voltage data

PWRviewLocalClient (local)

Method Description
get_current_sample() Real-time reading from the device

Exceptions

Exception Meaning
PWRviewError Base exception
PWRviewConnectionError Cannot reach the API or device
PWRviewAuthError Invalid or expired credentials
PWRviewResponseError Unexpected API response

Getting API credentials

  1. Go to https://my.neur.io/#settings/applications/register
  2. Create a new application (homepage and callback URLs are optional)
  3. Note your API key and secret

Attribution

This library is a modernized fork of neurio-python by Jordan Husney. The original library provided the foundation for understanding the Neurio/Generac API. This version has been rewritten with async support, type hints, and structured response models.

License

Apache License 2.0 — see LICENSE for details.

Original work copyright 2015, 2016 Jordan Husney.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

generac_pwrview-0.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

generac_pwrview-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file generac_pwrview-0.1.0.tar.gz.

File metadata

  • Download URL: generac_pwrview-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for generac_pwrview-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e610f2e86d79d689da6114f071003396c194151d0445de61f587ad2f1009a809
MD5 9e5a591c1d4e0c8aafa0a249e0785ba4
BLAKE2b-256 9ba223a70512faa6558fefcc9fceeea80cd931cad2c0e35c146204f82690b9ad

See more details on using hashes here.

File details

Details for the file generac_pwrview-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for generac_pwrview-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28255fad09a39c80fecdcec6e0ce2d885efdaa48a12c3ceb7f620677f7ab03d8
MD5 af1f804e530a48bb74dc1df6cf64f7df
BLAKE2b-256 fda0c5e9282b6b62f1676da6413a0f73519f0f558cdaadb049f013d544bd9921

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page