Giter VIP home page Giter VIP logo

python-nuheat's Introduction

Python NuHeat

PyPI - Python Version PyPI - Version PyPI - Downloads GitHub Workflow Status Coveralls Snyk Vulnerabilities for GitHub Repo

A Python 3 library that allows control of connected NuHeat Signature radiant floor thermostats.

This also supports the Mapei MapeHeat line of smart thermostats.

  • This uses the web-based NuHeat API, so it requires an external internet connection
  • The API in use is not an officially published API, so it could change without notice
  • Please contribute!

Installation

$ pip install nuheat

Usage

from nuheat import NuHeat

# Initalize an API session with your login credentials
api = NuHeat("[email protected]", "your-secure-password")
api.authenticate()

# Initialize an API session for a specific brand
api = NuHeat("[email protected]", "your-secure-password", brand="MAPEHEAT")
api.authenticate()

# Fetch a thermostat by serial number / ID. This can be found on the NuHeat website by selecting
# your thermostat and noting the Thermostat ID
thermostat = api.get_thermostat("12345")

# Get the current temperature of the thermostat
thermostat.fahrenheit
thermostat.celsius

# Get the current target temperature of the thermostat
thermostat.target_fahrenheit
thermostat.target_celsius

# Get the minimum and maximum temperatures supported by the thermostat
thermostat.min_fahrenheit
thermostat.max_fahrenheit
thermostat.min_celsius
thermostat.max_celsius

# Get the current mode of the thermostat
thermostat.schedule_mode

# The possible schedule modes are one of the following 3 integers:
# 1. Run the schedule programmed into the thermostat
# 2. Temporarily hold a target temperature until the next scheduled event
# 3. Permanently hold a target temperature until the mode is manually changed

# Get other properties
thermostat.heating
thermostat.online
thermostat.serial_number

# Set a new temperature and permanently hold
# Note: Any pre-programmed thermostat schedules will be ignored until you resume the schedule or
# change the mode.
thermostat.set_target_fahrenheit(72)

# If you prefer celsius...
thermostat.set_target_celsius(22)

# You can also do this via the convenience property setters
thermostat.target_fahrenheit = 72

# or with celsius
thermostat.target_celsius = 22

# To resume the schedule programmed into the thermostat
thermostat.resume_schedule()

# Which is effectively the same as explicitly changing the mode like so
thermostat.schedule_mode = 1

# To set a new target temperature with an explicit schedule mode
thermostat.set_target_fahrenheit(72, mode=2)

# If you prefer celsius, you can use that too
thermostat.set_target_celsius(22, mode=2)

# Set a target temperature until a specified datetime
# Note: A timezone aware datetime should be passed in, otherwise UTC will be assumed
from datetime import datetime, timedelta, timezone
hold_time = datetime.now() + timedelta(hours=4)
thermostat.set_target_fahrenheit(69, mode=2, hold_time=hold_time)

Contributing

Pull requests are always welcome!

Running locally with Docker

# Build and run the docker container:
$ docker build -t python-nuheat .
$ docker run -it --rm -v $(pwd):/python-nuheat python-nuheat

# To run the interactive shell:
$ ipython

# To run tests:
$ pytest

python-nuheat's People

Contributors

broox avatar brab avatar tstabrawa avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.