Skip to content

tim-oe/piSolar

Repository files navigation

piSolar

Solar system monitoring service for Raspberry Pi. Collects metrics from temperature sensors (1-Wire) and renogy modbus data from bluetooth or serial connection.

test bed

Features

  • Temperature Sensors: Reads 1-Wire temperature sensors via w1thermsensor
  • Renogy Bluetooth: Reads solar charge controller data via BT-1/BT-2 modules
  • Renogy Serial: Reads solar charge controller data via RS232/RS485 Modbus
  • Cron Scheduling: Configurable schedules using cron syntax
  • YAML Configuration: Config files with environment variable overrides
  • External Logging Config: Python logging dictConfig from YAML with !ENV tag support
  • Event-Driven Architecture: Pluggable consumers via event bus
  • Systemd Service: Run as a system service

Prereguisits

  • python
  • poetry
  • raspberry pi 3, 4, 5, zero
  • renogy charge controller
    • wanderer BT-1
    • rover B2-2

Installation

poetry install

Hardware Setup

Raspberry Pi Prerequisites

Renogy Sensors

Renogy charge controllers can be read via Bluetooth or Serial connections:

Connection status Module Documentation
Bluetooth verified BT-1/BT-2 bluetooth setup
RS232 verified RJ12 cable rs 232
RS485 verified RJ45 cable rs 485

For Modbus protocol details, see rover modbus.

Configuration

See yaml configuration for configuration options.

Usage

CLI Commands

pisolar --help                           # Show help
pisolar run                              # Start the monitoring service
pisolar check                            # Check sensor availability
pisolar read-once                        # Read all sensors once (for testing)
pisolar show-config                      # Display current configuration
pisolar -c config.yaml -l logging.yaml run  # Specify config files

Development Commands

Poetry Run Targets

The project provides convenient run targets for common tasks:

poetry run pisolar          # Run the pisolar CLI
poetry run lint             # Check code style (isort, black, flake8)
poetry run format           # Auto-fix code formatting (isort, black)
poetry run test             # run all tests will coverage

Testing

poetry run pytest                          # Run all tests
poetry run pytest tests/test_pisolar.py    # Run a single test file
poetry run pytest tests/test_pisolar.py::test_version  # Run a single test
poetry run pytest -k "test_read"           # Run tests matching pattern
poetry run pytest --cov                    # Run tests with coverage
poetry run pytest tests/ --cov=src/pisolar --cov-report=html --cov-report=term  # Coverage with HTML report

Systemd Service

To run piSolar as a system service, see systemd.

About

project to monitor solar sensors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors