Skip to main content

A library for controlling Navien NWP500 Water Heaters via NaviLink

Project description

Python library for Navien NWP500 Heat Pump Water Heater

A Python library for monitoring and controlling the Navien NWP500 Heat Pump Water Heater through the Navilink cloud service. This library provides comprehensive access to device status, temperature control, operation mode management, and real-time monitoring capabilities.

Features

  • Device Monitoring: Access real-time status information including temperatures, power consumption, and tank charge level

  • Temperature Control: Set target water temperature (100-140°F)

  • Operation Mode Control: Switch between Heat Pump, Energy Saver, High Demand, Electric, and Vacation modes

  • Reservation Management: Schedule automatic temperature and mode changes

  • Time of Use (TOU): Configure energy pricing schedules for demand response

  • Anti-Legionella Protection: Monitor periodic disinfection cycles (140°F heating)

  • Comprehensive Status Data: Access to 70+ device status fields including compressor status, heater status, flow rates, and more

  • MQTT Protocol Support: Low-level MQTT communication with Navien devices

  • Non-Blocking Async Operations: Fully compatible with async event loops (Home Assistant safe)

  • Automatic Reconnection: Reconnects automatically with exponential backoff during network interruptions

  • Command Queuing: Commands sent while disconnected are queued and sent automatically when reconnected

  • Data Models: Type-safe data classes with automatic unit conversions

Quick Start

Installation

pip install nwp500-python

Basic Usage

from nwp500 import NavienAuthClient, NavienAPIClient

# Authentication happens automatically when entering the context
async with NavienAuthClient("your_email@example.com", "your_password") as auth_client:
    # Create API client
    api_client = NavienAPIClient(auth_client=auth_client)

    # Get device data
    devices = await api_client.list_devices()
    device = devices[0] if devices else None

    if device:
        # Access status information
        status = device.status
        print(f"Water Temperature: {status.dhwTemperature}°F")
        print(f"Tank Charge: {status.dhwChargePer}%")
        print(f"Power Consumption: {status.currentInstPower}W")

        # Set temperature
        await api_client.set_device_temperature(device, 130)

        # Change operation mode
        await api_client.set_device_mode(device, "heat_pump")

Command Line Interface

The library includes a command line interface for quick monitoring and device information retrieval:

# Set credentials via environment variables
export NAVIEN_EMAIL="your_email@example.com"
export NAVIEN_PASSWORD="your_password"

# Get current device status (one-time)
python -m nwp500.cli --status

# Get device information
python -m nwp500.cli --device-info

# Get device feature/capability information
python -m nwp500.cli --device-feature

# Turn device on
python -m nwp500.cli --power-on

# Turn device off
python -m nwp500.cli --power-off

# Turn device on and see updated status
python -m nwp500.cli --power-on --status

# Set operation mode and see response
python -m nwp500.cli --set-mode energy-saver

# Set DHW target temperature and see response
python -m nwp500.cli --set-dhw-temp 140

# Set temperature and then get updated status
python -m nwp500.cli --set-dhw-temp 140 --status

# Set mode and then get updated status
python -m nwp500.cli --set-mode energy-saver --status

# Just get current status (one-time)
python -m nwp500.cli --status

# Monitor continuously (default - writes to CSV)
python -m nwp500.cli --monitor

# Monitor with custom output file
python -m nwp500.cli --monitor --output my_data.csv

Available CLI Options:

  • --status: Print current device status as JSON. Can be combined with control commands to see updated status.

  • --device-info: Print comprehensive device information (firmware, model, capabilities) via MQTT as JSON and exit

  • --device-feature: Print device capabilities and feature settings via MQTT as JSON and exit

  • --power-on: Turn the device on and display response

  • --power-off: Turn the device off and display response

  • --set-mode MODE: Set operation mode and display response. Valid modes: heat-pump, energy-saver, high-demand, electric, vacation, standby

  • --set-dhw-temp TEMP: Set DHW (Domestic Hot Water) target temperature in Fahrenheit (115-150°F) and display response

  • --monitor: Continuously monitor status every 30 seconds and log to CSV (default)

  • -o, --output: Specify CSV output filename for monitoring mode

  • --email: Override email (alternative to environment variable)

  • --password: Override password (alternative to environment variable)

Device Status Fields

The library provides access to comprehensive device status information:

Temperature Sensors
  • Water temperature (current and target)

  • Tank upper/lower temperatures

  • Ambient temperature

  • Discharge, suction, and evaporator temperatures

  • Inlet temperature

System Status
  • Operation mode (Heat Pump, Energy Saver, High Demand, Electric, Vacation)

  • Compressor status

  • Heat pump and electric heater status

  • Evaporator fan status

  • Tank charge percentage

Power & Energy
  • Current power consumption (Watts)

  • Total energy capacity (Wh)

  • Available energy capacity (Wh)

Diagnostics
  • WiFi signal strength

  • Error codes

  • Fault status

  • Cumulative operation time

  • Flow rates

Operation Modes

Operation Modes

Mode

ID

Description

Heat Pump Mode

1

Most energy-efficient mode using only the heat pump. Longest recovery time.

Electric Mode

2

Fastest recovery using only electric heaters. Least energy-efficient.

Energy Saver Mode

3

Default mode. Balances efficiency and recovery time using both heat pump and electric heater.

High Demand Mode

4

Uses electric heater more frequently for faster recovery time.

Vacation Mode

5

Suspends heating to save energy during extended absences.

Important: When you set a mode, you’re configuring the dhwOperationSetting (what mode to use when heating). The device’s current operational state is reported in operationMode (0=Standby, 32=Heat Pump active, 64=Energy Saver active, 96=High Demand active). See the Device Status Fields documentation for details on this distinction.

MQTT Protocol

The library supports low-level MQTT communication with Navien devices:

Control Topics
  • cmd/{deviceType}/{deviceId}/ctrl - Send control commands

  • cmd/{deviceType}/{deviceId}/ctrl/rsv/rd - Manage reservations

  • cmd/{deviceType}/{deviceId}/ctrl/tou/rd - Time of Use settings

  • cmd/{deviceType}/{deviceId}/st - Request status updates

Control Commands
  • Power control (on/off)

  • DHW mode changes (including vacation mode)

  • Temperature settings

  • Reservation management (scheduled mode/temperature changes)

  • Time of Use (TOU) pricing schedules

Status Requests
  • Device information

  • General device status

  • Energy usage queries

  • Reservation information

  • TOU settings

See the full MQTT Protocol Documentation for detailed message formats.

Documentation

Comprehensive documentation is available in the docs/ directory:

Data Models

The library includes type-safe data models with automatic unit conversions:

  • DeviceStatus: Complete device status with 70+ fields

  • DeviceFeature: Device capabilities, firmware versions, and configuration limits

  • OperationMode: Enumeration of available operation modes

  • TemperatureUnit: Celsius/Fahrenheit handling

  • MqttRequest/MqttCommand: MQTT message structures

Temperature conversions are handled automatically:
  • DHW temperatures: raw_value + 20 (°F)

  • Heat pump temperatures: raw_value / 10.0 (°F)

  • Ambient temperature: (raw_value * 9/5) + 32 (°F)

Requirements

  • Python 3.9+

  • aiohttp >= 3.8.0

  • websockets >= 10.0

  • cryptography >= 3.4.0

  • pydantic >= 2.0.0

  • awsiotsdk >= 1.21.0

Development

To set up a development environment, clone the repository and install the required dependencies:

# Clone the repository
git clone https://github.com/eman/nwp500-python.git
cd nwp500-python

# Install in development mode
pip install -e .

# Run tests
pytest

Linting and CI Consistency

To ensure your local linting matches CI exactly:

# Install tox (recommended)
pip install tox

# Run linting exactly as CI does
tox -e lint

# Auto-fix and format
tox -e format

For detailed linting setup instructions, see LINTING_SETUP.md.

For comprehensive development guide, see DEVELOPMENT.md.

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Author

Emmanuel Levijarvi <emansl@gmail.com>

Acknowledgments

This project has been set up using PyScaffold 4.6. For details and usage information on PyScaffold see https://pyscaffold.org/.

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

nwp500_python-1.2.3.tar.gz (173.3 kB view details)

Uploaded Source

Built Distribution

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

nwp500_python-1.2.3-py3-none-any.whl (48.3 kB view details)

Uploaded Python 3

File details

Details for the file nwp500_python-1.2.3.tar.gz.

File metadata

  • Download URL: nwp500_python-1.2.3.tar.gz
  • Upload date:
  • Size: 173.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nwp500_python-1.2.3.tar.gz
Algorithm Hash digest
SHA256 6ea1733a67706eebb38b4406bc8e2e79456f14be2f296c48e86cea871ffdb7b2
MD5 7084a22e4b9266c7f8ae864293132bef
BLAKE2b-256 2e6a93c6eeeac04148fe47f972499d7b6e5d4fe5615c9690a4f54b6255347ede

See more details on using hashes here.

Provenance

The following attestation bundles were made for nwp500_python-1.2.3.tar.gz:

Publisher: release.yml on eman/nwp500-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nwp500_python-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: nwp500_python-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 48.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nwp500_python-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ab2eed4e6203d334e456d7aa78e9b49f5df494bdf164beefc95cede757f7e1f3
MD5 8a0a66e5267c290e19e9dbe3a133d3c0
BLAKE2b-256 3f4895323a0312ee721e27dd8e164b5995918a3d60b6add7dc3a91e1776b09bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for nwp500_python-1.2.3-py3-none-any.whl:

Publisher: release.yml on eman/nwp500-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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