Skip to main content

Homeassistant API automation helper

Project description

ReactHass

Introduction

First of all I love Python, Home Assistant and Docker, but I also needed a way to communicate from different devices to Home Assistant and do some twisted automations.

You might need this repo for one of this reasons

  • Interface Home Assistant with other devices
  • There might be the case where you want to run an automation outside Home Assistant
  • In some of my cases, was easier to build an automation from Python
  • You love Python and Docker

Install

pip install reacthass

Usage

from reacthass import Reactor

token = 'YOUR TOKEN'
url = 'HOME ASSISTANT URL'


hass = Reactor(url, token)

if hass.when_value_reached('sensor', 'temperature', 30):
    hass.call_service('turn_on', 'fan.fan')
    

Persistence

If you want to keep the sensor record in the database you might add to your configuration.yaml:

recorder:
  include:
    entities:
      - sensor.test

or if you have another suggestion to keep records of the state made by API let me know opening an issue.

Examples

Some examples are in the /examples folder,

Credits

This package is built on top of the beautiful HomeAssistantAPI

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

reacthass-0.1.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

reacthass-0.1.1-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file reacthass-0.1.1.tar.gz.

File metadata

  • Download URL: reacthass-0.1.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for reacthass-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1d05ed9ae4dc1a122ecf6f7fa269c625633432c5582e701347cc7fc71b74a5a2
MD5 d75b4c3ae14c9581af60303556a2addc
BLAKE2b-256 3b5822e02ead14e253b6f5b33458f4e2ee365fcea5d9c8e8cd878d82fb3e4e83

See more details on using hashes here.

File details

Details for the file reacthass-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: reacthass-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for reacthass-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df71ac4d596521e88294cfae5e31457f4eb7cfaeba7b317b766fb18de0ff96ad
MD5 a4395155eb545bd162863757cc1ee284
BLAKE2b-256 0da31a278c281a604e2e7210300f6c26e5f29a8771a64d8d1ddf6ddc4f034c3c

See more details on using hashes here.

Supported by

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