All Projects β†’ spacemanspiff2007 β†’ HABApp

spacemanspiff2007 / HABApp

Licence: Apache-2.0 license
Easy home automation with MQTT and/or openHAB

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to HABApp

Openhab Core
Core framework of openHAB
Stars: ✭ 472 (+1248.57%)
Mutual labels:  home-automation, openhab
Miflora Mqtt Daemon
Linux service to collect and transfer Xiaomi Mi Flora plant sensor data via MQTT to your smart home system, with cluster support 🌱🌼πŸ₯€πŸ‘🌳
Stars: ✭ 409 (+1068.57%)
Mutual labels:  home-automation, openhab
openhab2 pub 001
openhab2_pub_001
Stars: ✭ 29 (-17.14%)
Mutual labels:  home-automation, openhab
Dsckeybusinterface
An Arduino/esp8266/esp32 library to directly interface with DSC security systems.
Stars: ✭ 202 (+477.14%)
Mutual labels:  home-automation, openhab
Gosdm630
An interface for the Eastron SDM/Modbus smart meter series.
Stars: ✭ 64 (+82.86%)
Mutual labels:  home-automation, openhab
Amazon Dash
Hack your Amazon Dash to run what you want.
Stars: ✭ 703 (+1908.57%)
Mutual labels:  home-automation, openhab
Pyatv
A python client library for the Apple TV
Stars: ✭ 322 (+820%)
Mutual labels:  home-automation, pypi
Homeautomation.codesys3
Home Automation system build in CoDeSys 3 with MQTT communication to any third party Home Automation software
Stars: ✭ 55 (+57.14%)
Mutual labels:  home-automation, openhab
Openhab Ios
The repository of the iOS client
Stars: ✭ 141 (+302.86%)
Mutual labels:  home-automation, openhab
esp32-motorized-roller-blinds
Control your motorized blinds with Web interface/ MQTT. Easy integration with automation systems like Home Assistant and OpenHab. 3d printing model for Leroy Merlin blinds.
Stars: ✭ 51 (+45.71%)
Mutual labels:  home-automation, openhab
DotMatrixDisplay
Display any messages to a LED Matrix Display
Stars: ✭ 19 (-45.71%)
Mutual labels:  home-automation
pycalima
Python interface for Pax Calima Fan via Bluetooth LE
Stars: ✭ 34 (-2.86%)
Mutual labels:  home-automation
ioBroker.homepilot20
Rademacher Homepilot 2.0 (version >= 5.0.39)
Stars: ✭ 19 (-45.71%)
Mutual labels:  home-automation
ertis-auth
Generic token generator and validator service like auth
Stars: ✭ 28 (-20%)
Mutual labels:  pypi
hass-pandora-cas
Home Assistant custom component for Pandora Car Alarm System
Stars: ✭ 15 (-57.14%)
Mutual labels:  home-automation
homeassistant-cli
Control your smart home from the terminal
Stars: ✭ 12 (-65.71%)
Mutual labels:  home-automation
open-energy-view
View resource consumption trends, history, analysis, and insights.
Stars: ✭ 32 (-8.57%)
Mutual labels:  home-automation
infopanel
Show live data, animations, pictures, or anything on simple displays like RGB matrices
Stars: ✭ 29 (-17.14%)
Mutual labels:  home-automation
upcloud-python-api
Python client for UpCloud's API
Stars: ✭ 51 (+45.71%)
Mutual labels:  pypi
instagrammer
Get personal RSS feed access to your Instagrams
Stars: ✭ 15 (-57.14%)
Mutual labels:  home-automation

HABApp

Tests Status Documentation Status Updates PyPI - Python Version

PyPI Downloads Docker Image Version (latest by date) Docker Pulls

Easy automation with MQTT and/or openHAB

HABApp is a asyncio/multithread application that connects to an openhab instance and/or a MQTT broker. It is possible to create rules that listen to events from these instances and then react accordingly.

Goals

The goal of this application is to provide a simple way to create home automation rules in python. With full syntax highlighting and descriptive names it should almost never be required to look something up in the documentation

Documentation

The documentation can be found at here

Examples

MQTT Rule example

import datetime
import random

import HABApp
from HABApp.core.events import ValueUpdateEvent


class ExampleMqttTestRule(HABApp.Rule):
    def __init__(self):
        super().__init__()

        self.run.every(
            time=datetime.timedelta(seconds=60),
            interval=datetime.timedelta(seconds=30),
            callback=self.publish_rand_value
        )

        self.listen_event('test/test', self.topic_updated, ValueUpdateEvent)

    def publish_rand_value(self):
        print('test mqtt_publish')
        self.mqtt.publish('test/test', str(random.randint(0, 1000)))

    def topic_updated(self, event):
        assert isinstance(event, ValueUpdateEvent), type(event)
        print( f'mqtt topic "test/test" updated to {event.value}')


ExampleMqttTestRule()

Openhab rule example

import HABApp
from HABApp.core.events import ValueUpdateEvent, ValueChangeEvent
from HABApp.openhab.events import ItemStateEvent, ItemCommandEvent, ItemStateChangedEvent

class MyOpenhabRule(HABApp.Rule):

    def __init__(self):
        super().__init__()

        # Trigger on item updates
        self.listen_event( 'TestContact', self.item_state_update, ItemStateEvent)
        self.listen_event( 'TestDateTime', self.item_state_update, ValueUpdateEvent)

        # Trigger on item changes
        self.listen_event( 'TestDateTime', self.item_state_change, ItemStateChangedEvent)
        self.listen_event( 'TestSwitch', self.item_state_change, ValueChangeEvent)

        # Trigger on item commands
        self.listen_event( 'TestSwitch', self.item_command, ItemCommandEvent)

    def item_state_update(self, event):
        assert isinstance(event, ValueUpdateEvent)
        print( f'{event}')

    def item_state_change(self, event):
        assert isinstance(event, ValueChangeEvent)
        print( f'{event}')

        # interaction is available through self.openhab or self.oh
        self.openhab.send_command('TestItemCommand', 'ON')

    def item_command(self, event):
        assert isinstance(event, ItemCommandEvent)
        print( f'{event}')

        # interaction is available through self.openhab or self.oh
        self.oh.post_update('TestItemUpdate', 123)

MyOpenhabRule()

Changelog

0.31.2 (17.12.2021)

  • Added command line switch to display debug information
  • Display debug information on missing dependencies
  • Added a small splash screen when HABApp is started
  • May doc updates
  • Reworked EventListenerGroup

0.31.1 (29.10.2021)

  • Added support for item metadata
  • Added possibility to search for items by metadata
  • Added EventListenerGroup to subscribe/cancel multiple listeners at once

0.31.0 (08.10.2021)

  • added self.get_items to easily search for items in a rule
  • added full support for tags and groups on OpenhabItem
  • Application should now properly shut down when there is a PermissionError
  • Added DatetimeItem to docs
  • Label in commandOption is optional
  • Added message when file is removed
  • Examples in the docs get checked with a newly created sphinx extension
  • Reworked the openhab tests

0.30.3 (17.06.2021)

  • add support for custom ca cert for MQTT
  • Scheduler runs only when the rule file has been loaded properly
  • Sync openhab calls raise an error when called from an async context
  • Replaced thread check for asyncio with a contextvar (internal)

0.30.3 (01.06.2021)

  • Scheduler runs only when the rule file has been loaded properly
  • Replaced thread check for asyncio with a contextvar
  • Sync openhab calls raise an error when called from an async context

0.30.2 (26.05.2021)

  • Item and Thing loading from openHAB is more robust and disconnects now properly if openHAB is only partly ready
  • Renamed command line argument "-s" to "-wos" or "--wait_os_uptime"
  • Updated dependencies

0.30.1 (07.05.2021)

  • latitude is now set correctly for sunrise/sunset calculation (closes #217)
  • Added missing " for tags in textual thing configuration
  • Updated scheduler which fixes an overflow error(#216)
  • States of openHAB groups are now unpacked correctly

0.30.0 (02.05.2021)

Attention:

  • No more support for python 3.6!
  • Migration of rules is needed!

Changelog

  • Switched to Apache2.0 License
  • Fix DateTime string parsing for OH 3.1 (#214)
  • State of Groupitem gets set correctly
  • About ~50% performance increase for async calls in rules
  • Significantly less CPU usage when no functions are running
  • Completely reworked the file handling (loading and dependency resolution)
  • Completely reworked the Scheduler!
    • Has now subsecond accuracity (finally!)
    • Has a new .coundown() job which can simplify many rules. It is made for functions that do something after a certain period of time (e.g. switch a light off after movement)
  • Added hsb_to_rgb, rgb_to_hsb functions which can be used in rules
  • Better error message if configured foldes overlap with HABApp folders
  • Renamed HABAppError to HABAppException
  • Some Doc improvements

Migration of rules:

  • Search for self.run_ and replace with self.run.
  • Search for self.run.in and replace with self.run.at
  • Search for .get_next_call() and replace with .get_next_run() (But make sure it's a scheduled job)
  • Search for HABAppError and replace with HABAppException

0.20.2 (07.04.2021)

  • Added HABApp.util.functions with min/max
  • Reworked small parts of the file watcher
  • Doc improvements
  • Dependency updates
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].