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.2.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

reacthass-0.1.2-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: reacthass-0.1.2.tar.gz
  • Upload date:
  • Size: 15.9 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.2.tar.gz
Algorithm Hash digest
SHA256 7bdca4da65cf824517b6d107af69f50b7fef19da39ec42bc7d97b58866eb62f9
MD5 5a02d2f78711df74d4f13eb4eb6fce19
BLAKE2b-256 11e67d985b1eb177192e3e21c79e54bd502013d07da40a857a17b3b996c08e2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: reacthass-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a70cd6bfdea6c3d3305cab02b4732559da40a1a308c3eb123224f3a6fda11bd
MD5 97d6652eb40e061e530c0f9ba5111521
BLAKE2b-256 e5fb87ca50c6687602441d8314c9271dddb82b0f2620e45c38ad354490cf4fe7

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