# HABApp
![Tests Status](https://github.com/spacemanspiff2007/HABApp/workflows/Tests/badge.svg)
[![Documentation Status](https://readthedocs.org/projects/habapp/badge/?version=latest)](https://habapp.readthedocs.io/en/latest/?badge=latest)
[![Updates](https://pyup.io/repos/github/spacemanspiff2007/HABApp/shield.svg)](https://pyup.io/repos/github/spacemanspiff2007/HABApp/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/habapp)
![PyPI](https://img.shields.io/pypi/v/HABapp)
[![Downloads](https://static.pepy.tech/badge/habapp/month)](https://pepy.tech/project/habapp)
![Docker Image Version (latest by date)](https://img.shields.io/docker/v/spacemanspiff2007/habapp?label=docker)
![Docker Pulls](https://img.shields.io/docker/pulls/spacemanspiff2007/habapp)
_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](https://habapp.readthedocs.io)
## Help out
HABApp was created for my own use, but I wanted others to profit from it, too.
Creating, maintaining and developing it takes a lot of time.
If you think this is a great tool and want to support it you can donate,
so I can buy some more coffee to keep development going. :wink:
[![Donate with PayPal](https://img.shields.io/badge/Donate-PayPal-informational?logo=paypal)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YU5U9YQN56JVA)
All donations are greatly appreciated!
## Examples
### MQTT Rule example
```python
import datetime
import random
import HABApp
from HABApp.mqtt.items import MqttItem
from HABApp.core.events import ValueChangeEvent, ValueChangeEventFilter, ValueUpdateEvent, ValueUpdateEventFilter
class ExampleMqttTestRule(HABApp.Rule):
def __init__(self):
super().__init__()
self.run.every(
start_time=datetime.timedelta(seconds=60),
interval=datetime.timedelta(seconds=30),
callback=self.publish_rand_value
)
# this will trigger every time a message is received under "test/test"
self.listen_event('test/test', self.topic_updated, ValueUpdateEventFilter())
# This will create an item which will store the payload of the topic so it can be accessed later.
self.item = MqttItem.get_create_item('test/value_stored')
# Since the payload is now stored we can trigger only if the value has changed
self.item.listen_event(self.item_topic_updated, ValueChangeEventFilter())
def publish_rand_value(self):
print('test mqtt_publish')
self.mqtt.publish('test/test', str(random.randint(0, 1000)))
def topic_updated(self, event: ValueUpdateEvent):
assert isinstance(event, ValueUpdateEvent), type(event)
print( f'mqtt topic "test/test" updated to {event.value}')
def item_topic_updated(self, event: ValueChangeEvent):
print(self.item.value) # will output the current item value
print( f'mqtt topic "test/value_stored" changed from {event.old_value} to {event.value}')
ExampleMqttTestRule()
```
### openHAB rule example
```python
import HABApp
from HABApp.core.events import ValueUpdateEvent, ValueChangeEvent, ValueChangeEventFilter, ValueUpdateEventFilter
from HABApp.openhab.events import ItemCommandEvent, ItemStateUpdatedEventFilter, ItemCommandEventFilter, \
ItemStateChangedEventFilter
class MyOpenhabRule(HABApp.Rule):
def __init__(self):
super().__init__()
# Trigger on item updates
self.listen_event('TestContact', self.item_state_update, ItemStateUpdatedEventFilter())
self.listen_event('TestDateTime', self.item_state_update, ValueUpdateEventFilter())
# Trigger on item changes
self.listen_event('TestDateTime', self.item_state_change, ItemStateChangedEventFilter())
self.listen_event('TestSwitch', self.item_state_change, ValueChangeEventFilter())
# Trigger on item commands
self.listen_event('TestSwitch', self.item_command, ItemCommandEventFilter())
def item_state_update(self, event: ValueUpdateEvent):
assert isinstance(event, ValueUpdateEvent)
print(f'{event}')
def item_state_change(self, event: ValueChangeEvent):
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: ItemCommandEvent):
assert isinstance(event, ItemCommandEvent)
print(f'{event}')
# interaction is available through self.openhab or self.oh
self.oh.post_update('TestItemUpdate', 123)
MyOpenhabRule()
```
# Changelog
#### 24.08.1 (2024-08-02)
- Fixed a possible infinite loop during thing re-sync
#### 24.08.0 (2024-08-01)
- Fixed an issue with thing re-sync
- Updated number parsing logic
- ``ItemTimeSeriesEvent`` gets ignored
- Removed verbose error messages when openHAB server disconnects
- Updated dependencies
- Reformatted some files
#### 24.02.0 (2024-02-14)
- For openHAB >= 4.1 it's possible to wait for a minimum openHAB uptime before connecting (defaults to 60s)
- Renamed config entry mqtt.connection.client_id to identifier (backwards compatible)
- ``ItemTimeSeriesUpdatedEvent`` gets ignored
- Updated dependencies
- Updated docs
#### 24.01.0 (2024-01-08)
- Added HABApp.util.RateLimiter
- Added CompressedMidnightRotatingFileHandler
- Updated dependencies
- Small improvement for RGB and HSB types
- Small improvements for openHAB items
- Added toggle for SwitchItem
#### 23.11.0 (2023-11-23)
- Fix for very small float values (#425)
- Fix for writing to persistence (#424)
- Updated dependencies
#### 23.09.2 (2023-09-24)
- Made channel type on a ``Thing`` optional (#416)
- Fixed an issue with mqtt publish and reconnect
#### 23.09.1 (2023-09-18)
- Log a warning for broken links between items and things
- Fix CI
#### 23.09.0 (2023-09-12)
- Switched version number scheme to CalVer (Calendar Versioning): ``YEAR.MONTH.COUNTER``
- Fail fast when a value instead of a callback is passed to the event listener / scheduler
- Completely removed types and type hints from traceback
- Completely reworked connection logic for openHAB and mqtt
- Added support for transformations
- Updated dependencies:
- Improved performance
- Support for docker secrets and environment variables in the config file
- Support sending scheduler datetimes to an item
- Search in the docs finally works again
- Updated dependencies
#### 1.1.2 (2023-06-19)
- Re-added `ItemStateEventFilter`
- Improved parsing of `DateTime` values
#### 1.1.1 (2023-06-16)
- Fixed a bug where the rule context was not found
#### 1.1.0 (2023-06-15)
This is a breaking change!
- Renamed `GroupItemStateChangedEvent` to `GroupStateChangedEvent`
- Groups issue a `GroupStateUpdateEvent` when the state updates on OH3 (consistent with OH4 behavior)
- Groups work now with `ValueUpdateEvent` and `ValueChangedEvent` as expected
- ~~Renamed `ItemStateEvent` to `ItemStateUpdatedEvent`~~
- Ignored ItemStateEvent on OH4
- Fewer warnings for long-running functions (execution of <FUNC_NAME> took too long)
- `Thing` status and status_detail are now an Enum
- Added `status_detail` to `Thing`
- `LocationItem` now provides the location as a tuple
- Added support for `Point` events
- Improved item sync from openHAB (no more false item state `None` after startup)
- Improved startup behavior when openHAB and HABApp get started together (e.g. after reboot)
- Fixed an issue with short tracebacks for HABApp internal files
- Doc improvements
#### 1.0.8 (2023-02-09)
- Fixed an issue when using token based authentication with openHAB
- Fixed an issue with the asyncio event loop under Python < 3.10
#### 1.0.7 (2023-02-09)
- ``ContactItem`` has ``open()``/``closed()`` methods
- Setting persistence values now works for some persistence services
- Don't connect when user/password is missing for openHAB
#### 1.0.6 (2022-11-08)
- Added log message if item for ping does not exist
- Added ``execute_python`` and reworked ``execute_subprocess``:
HABApp will now by default pass only the captured output as a str into the callback.
- Reworked ``Thing`` handling
#### 1.0.5 (2022-10-20)
- Added new item function ``post_value_if`` and ``oh_post_update_if`` to conditionally update an item
- Added support for new alive event with openHAB 3.4
- Reworked file writer for textual thing config
- Added support for ThingConfigStatusInfoEvent
- MultiModeValue returns True/False if item value was changed
- Updated dependencies
#### 1.0.4 (2022-08-25)
- New RGB & HSB datatype for simpler color handling
- Fixed Docker build
- Bugfixes
#### 1.0.3 (2022-08-09)
- OpenHAB Thing can now be enabled/disabled with ``thing.set_enabled()``
- ClientID for MQTT should now be unique for every HABApp installation
- Reworked MultiModeItem, now a default value is possible when no mode is active
- Added some type hints and updated documentation
#### 1.0.2 (2022-07-29)
- Fixed setup issues
- Fixed unnecessary long tracebacks
#### 1.0.1 (2022-07-25)
- Dockerfile is Python 3.10 and non slim
#### 1.0.0 (2022-07-25)
- OpenHAB >= 3.3 and Python >= 3.8 only!
- Major internal refactoring
- Startup issues are gone with a new and improved connection mechanism.
- New configuration library: More settings can be configured in the configuration file.
Config values are also described in the docs. Also better error messages (hopefully)
- Improved event log performance (``BufferEventFile`` no longer needed and should be removed)
- Improved openhab performance (added some buffers)
- Improved mqtt performance
- Better tracebacks in case of error
- EventFilters can be logically combined ("and", "or") so rules trigger only once
- Label, Groups and Metadata is part of the OpenhabItem and can easily be accessed
- Added possibility to run arbitrary user code before the HABApp configuration is loaded
- Fixed setup issues
- Fixed some known bugs and introduced new ones ;-)
- Docker file changed to a multi stage build. Mount points changed to ``/habapp/config``.
**Migration to new version**
``self.listen_event`` now requires an instance of EventFilter.
Old:
```python
from HABApp.core.events import ValueUpdateEvent
...
self.my_sensor = Item.get_item('my_sensor')
self.my_sensor.listen_event(self.movement, ValueUpdateEvent)
```
New:
```python
from HABApp.core.events import ValueUpdateEventFilter
...
self.my_sensor = Item.get_item('my_sensor')
self.my_sensor.listen_event(self.movement, ValueUpdateEventFilter()) # <-- Instance of EventFilter
```
```text
HABApp:
ValueUpdateEvent -> ValueUpdateEventFilter()
ValueChangeEvent -> ValueChangeEventFilter()
Openhab:
ItemStateEvent -> ItemStateEventFilter()
ItemStateChangedEvent -> ItemStateChangedEventFilter()
ItemCommandEvent -> ItemCommandEventFilter()
MQTT:
MqttValueUpdateEvent -> MqttValueUpdateEventFilter()
MqttValueChangeEvent -> MqttValueChangeEventFilter()
```
**Migration to new docker image**
- change the mount point of the config from ``/config`` to ``/habapp/config``
- The new image doesn't run as root. You can set `USER_ID` and `GROUP_ID` to the user you want habapp to run with. It's necessary to modify the permissions of the mounted folder accordingly.
---
#### 0.31.2 (2021-12-17)
- 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 (2021-10-29)
- 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 (2021-10-08)
- 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 (2021-06-17)
- 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 (2021-06-01)
- 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 (2021-05-26)
- 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 (2021-05-07)
- 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 (2021-05-02)
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 accuracy (finally!)
- Has a new .countdown() 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 (2021-04-07)
- Added HABApp.util.functions with min/max
- Reworked small parts of the file watcher
- Doc improvements
- Dependency updates
Raw data
{
"_id": null,
"home_page": "https://github.com/spacemanspiff2007/HABApp",
"name": "HABApp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "mqtt, openhab, habapp, home automation",
"author": "spaceman_spiff",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/42/9d/4ef417bfddd1c0257566fb23c6a1d2debb8398a76e92438d83401683bf6f/habapp-24.8.1.tar.gz",
"platform": null,
"description": "# HABApp\n![Tests Status](https://github.com/spacemanspiff2007/HABApp/workflows/Tests/badge.svg)\n[![Documentation Status](https://readthedocs.org/projects/habapp/badge/?version=latest)](https://habapp.readthedocs.io/en/latest/?badge=latest)\n[![Updates](https://pyup.io/repos/github/spacemanspiff2007/HABApp/shield.svg)](https://pyup.io/repos/github/spacemanspiff2007/HABApp/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/habapp)\n\n![PyPI](https://img.shields.io/pypi/v/HABapp)\n[![Downloads](https://static.pepy.tech/badge/habapp/month)](https://pepy.tech/project/habapp)\n![Docker Image Version (latest by date)](https://img.shields.io/docker/v/spacemanspiff2007/habapp?label=docker)\n![Docker Pulls](https://img.shields.io/docker/pulls/spacemanspiff2007/habapp)\n\n_Easy automation with MQTT and/or openHAB_\n\n\nHABApp is a asyncio/multithread application that connects to an openHAB instance and/or a MQTT broker.\nIt is possible to create rules that listen to events from these instances and then react accordingly.\n\n## Goals\nThe goal of this application is to provide a simple way to create home automation rules in python.\nWith full syntax highlighting and descriptive names it should almost never be required to look something up in the documentation\n\n## Documentation\n[The documentation can be found at here](https://habapp.readthedocs.io)\n\n## Help out\nHABApp was created for my own use, but I wanted others to profit from it, too.\nCreating, maintaining and developing it takes a lot of time.\nIf you think this is a great tool and want to support it you can donate,\nso I can buy some more coffee to keep development going. :wink:\n\n[![Donate with PayPal](https://img.shields.io/badge/Donate-PayPal-informational?logo=paypal)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YU5U9YQN56JVA)\n\nAll donations are greatly appreciated!\n\n\n## Examples\n\n### MQTT Rule example\n```python\nimport datetime\nimport random\n\nimport HABApp\nfrom HABApp.mqtt.items import MqttItem\nfrom HABApp.core.events import ValueChangeEvent, ValueChangeEventFilter, ValueUpdateEvent, ValueUpdateEventFilter\n\n\nclass ExampleMqttTestRule(HABApp.Rule):\n def __init__(self):\n super().__init__()\n\n self.run.every(\n start_time=datetime.timedelta(seconds=60),\n interval=datetime.timedelta(seconds=30),\n callback=self.publish_rand_value\n )\n\n # this will trigger every time a message is received under \"test/test\"\n self.listen_event('test/test', self.topic_updated, ValueUpdateEventFilter())\n\n # This will create an item which will store the payload of the topic so it can be accessed later.\n self.item = MqttItem.get_create_item('test/value_stored')\n # Since the payload is now stored we can trigger only if the value has changed\n self.item.listen_event(self.item_topic_updated, ValueChangeEventFilter())\n\n def publish_rand_value(self):\n print('test mqtt_publish')\n self.mqtt.publish('test/test', str(random.randint(0, 1000)))\n\n def topic_updated(self, event: ValueUpdateEvent):\n assert isinstance(event, ValueUpdateEvent), type(event)\n print( f'mqtt topic \"test/test\" updated to {event.value}')\n\n def item_topic_updated(self, event: ValueChangeEvent):\n print(self.item.value) # will output the current item value\n print( f'mqtt topic \"test/value_stored\" changed from {event.old_value} to {event.value}')\n\n\nExampleMqttTestRule()\n```\n\n### openHAB rule example\n\n```python\nimport HABApp\nfrom HABApp.core.events import ValueUpdateEvent, ValueChangeEvent, ValueChangeEventFilter, ValueUpdateEventFilter\nfrom HABApp.openhab.events import ItemCommandEvent, ItemStateUpdatedEventFilter, ItemCommandEventFilter, \\\n ItemStateChangedEventFilter\n\n\nclass MyOpenhabRule(HABApp.Rule):\n\n def __init__(self):\n super().__init__()\n\n # Trigger on item updates\n self.listen_event('TestContact', self.item_state_update, ItemStateUpdatedEventFilter())\n self.listen_event('TestDateTime', self.item_state_update, ValueUpdateEventFilter())\n\n # Trigger on item changes\n self.listen_event('TestDateTime', self.item_state_change, ItemStateChangedEventFilter())\n self.listen_event('TestSwitch', self.item_state_change, ValueChangeEventFilter())\n\n # Trigger on item commands\n self.listen_event('TestSwitch', self.item_command, ItemCommandEventFilter())\n\n def item_state_update(self, event: ValueUpdateEvent):\n assert isinstance(event, ValueUpdateEvent)\n print(f'{event}')\n\n def item_state_change(self, event: ValueChangeEvent):\n assert isinstance(event, ValueChangeEvent)\n print(f'{event}')\n\n # interaction is available through self.openHAB or self.oh\n self.openhab.send_command('TestItemCommand', 'ON')\n\n def item_command(self, event: ItemCommandEvent):\n assert isinstance(event, ItemCommandEvent)\n print(f'{event}')\n\n # interaction is available through self.openhab or self.oh\n self.oh.post_update('TestItemUpdate', 123)\n\n\nMyOpenhabRule()\n```\n\n# Changelog\n#### 24.08.1 (2024-08-02)\n- Fixed a possible infinite loop during thing re-sync\n\n#### 24.08.0 (2024-08-01)\n- Fixed an issue with thing re-sync\n- Updated number parsing logic\n- ``ItemTimeSeriesEvent`` gets ignored\n- Removed verbose error messages when openHAB server disconnects\n- Updated dependencies\n- Reformatted some files\n\n#### 24.02.0 (2024-02-14)\n- For openHAB >= 4.1 it's possible to wait for a minimum openHAB uptime before connecting (defaults to 60s)\n- Renamed config entry mqtt.connection.client_id to identifier (backwards compatible)\n- ``ItemTimeSeriesUpdatedEvent`` gets ignored\n- Updated dependencies\n- Updated docs\n\n#### 24.01.0 (2024-01-08)\n- Added HABApp.util.RateLimiter\n- Added CompressedMidnightRotatingFileHandler\n- Updated dependencies\n- Small improvement for RGB and HSB types\n- Small improvements for openHAB items\n- Added toggle for SwitchItem\n\n#### 23.11.0 (2023-11-23)\n- Fix for very small float values (#425)\n- Fix for writing to persistence (#424)\n- Updated dependencies\n\n#### 23.09.2 (2023-09-24)\n- Made channel type on a ``Thing`` optional (#416)\n- Fixed an issue with mqtt publish and reconnect\n\n#### 23.09.1 (2023-09-18)\n- Log a warning for broken links between items and things\n- Fix CI\n\n#### 23.09.0 (2023-09-12)\n- Switched version number scheme to CalVer (Calendar Versioning): ``YEAR.MONTH.COUNTER``\n- Fail fast when a value instead of a callback is passed to the event listener / scheduler\n- Completely removed types and type hints from traceback\n- Completely reworked connection logic for openHAB and mqtt\n- Added support for transformations\n- Updated dependencies:\n - Improved performance\n - Support for docker secrets and environment variables in the config file\n- Support sending scheduler datetimes to an item\n- Search in the docs finally works again\n- Updated dependencies\n\n#### 1.1.2 (2023-06-19)\n- Re-added `ItemStateEventFilter`\n- Improved parsing of `DateTime` values\n\n#### 1.1.1 (2023-06-16)\n- Fixed a bug where the rule context was not found\n\n#### 1.1.0 (2023-06-15)\nThis is a breaking change!\n- Renamed `GroupItemStateChangedEvent` to `GroupStateChangedEvent`\n- Groups issue a `GroupStateUpdateEvent` when the state updates on OH3 (consistent with OH4 behavior)\n- Groups work now with `ValueUpdateEvent` and `ValueChangedEvent` as expected\n- ~~Renamed `ItemStateEvent` to `ItemStateUpdatedEvent`~~\n- Ignored ItemStateEvent on OH4\n- Fewer warnings for long-running functions (execution of <FUNC_NAME> took too long)\n- `Thing` status and status_detail are now an Enum\n- Added `status_detail` to `Thing`\n- `LocationItem` now provides the location as a tuple\n- Added support for `Point` events\n- Improved item sync from openHAB (no more false item state `None` after startup)\n- Improved startup behavior when openHAB and HABApp get started together (e.g. after reboot)\n- Fixed an issue with short tracebacks for HABApp internal files\n- Doc improvements\n\n#### 1.0.8 (2023-02-09)\n- Fixed an issue when using token based authentication with openHAB\n- Fixed an issue with the asyncio event loop under Python < 3.10\n\n#### 1.0.7 (2023-02-09)\n- ``ContactItem`` has ``open()``/``closed()`` methods\n- Setting persistence values now works for some persistence services\n- Don't connect when user/password is missing for openHAB\n\n#### 1.0.6 (2022-11-08)\n- Added log message if item for ping does not exist\n- Added ``execute_python`` and reworked ``execute_subprocess``:\n HABApp will now by default pass only the captured output as a str into the callback.\n- Reworked ``Thing`` handling\n\n#### 1.0.5 (2022-10-20)\n- Added new item function ``post_value_if`` and ``oh_post_update_if`` to conditionally update an item\n- Added support for new alive event with openHAB 3.4\n- Reworked file writer for textual thing config\n- Added support for ThingConfigStatusInfoEvent\n- MultiModeValue returns True/False if item value was changed\n- Updated dependencies\n\n#### 1.0.4 (2022-08-25)\n- New RGB & HSB datatype for simpler color handling\n- Fixed Docker build\n- Bugfixes\n\n#### 1.0.3 (2022-08-09)\n- OpenHAB Thing can now be enabled/disabled with ``thing.set_enabled()``\n- ClientID for MQTT should now be unique for every HABApp installation\n- Reworked MultiModeItem, now a default value is possible when no mode is active\n- Added some type hints and updated documentation\n\n#### 1.0.2 (2022-07-29)\n- Fixed setup issues\n- Fixed unnecessary long tracebacks\n\n#### 1.0.1 (2022-07-25)\n- Dockerfile is Python 3.10 and non slim\n\n#### 1.0.0 (2022-07-25)\n- OpenHAB >= 3.3 and Python >= 3.8 only!\n- Major internal refactoring\n- Startup issues are gone with a new and improved connection mechanism.\n- New configuration library: More settings can be configured in the configuration file.\n Config values are also described in the docs. Also better error messages (hopefully)\n- Improved event log performance (``BufferEventFile`` no longer needed and should be removed)\n- Improved openhab performance (added some buffers)\n- Improved mqtt performance\n- Better tracebacks in case of error\n- EventFilters can be logically combined (\"and\", \"or\") so rules trigger only once\n- Label, Groups and Metadata is part of the OpenhabItem and can easily be accessed\n- Added possibility to run arbitrary user code before the HABApp configuration is loaded\n- Fixed setup issues\n- Fixed some known bugs and introduced new ones ;-)\n- Docker file changed to a multi stage build. Mount points changed to ``/habapp/config``.\n\n**Migration to new version**\n\n\n``self.listen_event`` now requires an instance of EventFilter.\n\nOld:\n```python\nfrom HABApp.core.events import ValueUpdateEvent\n...\nself.my_sensor = Item.get_item('my_sensor')\nself.my_sensor.listen_event(self.movement, ValueUpdateEvent)\n```\n\nNew:\n```python\nfrom HABApp.core.events import ValueUpdateEventFilter\n...\nself.my_sensor = Item.get_item('my_sensor')\nself.my_sensor.listen_event(self.movement, ValueUpdateEventFilter()) # <-- Instance of EventFilter\n```\n\n```text\nHABApp:\n ValueUpdateEvent -> ValueUpdateEventFilter()\n ValueChangeEvent -> ValueChangeEventFilter()\n\nOpenhab:\n ItemStateEvent -> ItemStateEventFilter()\n ItemStateChangedEvent -> ItemStateChangedEventFilter()\n ItemCommandEvent -> ItemCommandEventFilter()\n\nMQTT:\n MqttValueUpdateEvent -> MqttValueUpdateEventFilter()\n MqttValueChangeEvent -> MqttValueChangeEventFilter()\n```\n\n**Migration to new docker image**\n- change the mount point of the config from ``/config`` to ``/habapp/config``\n- The new image doesn't run as root. You can set `USER_ID` and `GROUP_ID` to the user you want habapp to run with. It's necessary to modify the permissions of the mounted folder accordingly.\n\n---\n\n#### 0.31.2 (2021-12-17)\n- Added command line switch to display debug information\n- Display debug information on missing dependencies\n- Added a small splash screen when HABApp is started\n- May doc updates\n- Reworked EventListenerGroup\n\n#### 0.31.1 (2021-10-29)\n- Added support for item metadata\n- Added possibility to search for items by metadata\n- Added EventListenerGroup to subscribe/cancel multiple listeners at once\n\n#### 0.31.0 (2021-10-08)\n- added self.get_items to easily search for items in a rule\n- added full support for tags and groups on OpenhabItem\n- Application should now properly shut down when there is a PermissionError\n- Added DatetimeItem to docs\n- Label in commandOption is optional\n- Added message when file is removed\n- Examples in the docs get checked with a newly created sphinx extension\n- Reworked the openHAB tests\n\n#### 0.30.3 (2021-06-17)\n- add support for custom ca cert for MQTT\n- Scheduler runs only when the rule file has been loaded properly\n- Sync openHAB calls raise an error when called from an async context\n- Replaced thread check for asyncio with a contextvar (internal)\n\n#### 0.30.3 (2021-06-01)\n- Scheduler runs only when the rule file has been loaded properly\n- Replaced thread check for asyncio with a contextvar\n- Sync openHAB calls raise an error when called from an async context\n\n#### 0.30.2 (2021-05-26)\n- Item and Thing loading from openHAB is more robust and disconnects now properly if openHAB is only partly ready\n- Renamed command line argument \"-s\" to \"-wos\" or \"--wait_os_uptime\"\n- Updated dependencies\n\n#### 0.30.1 (2021-05-07)\n- latitude is now set correctly for sunrise/sunset calculation (closes #217)\n- Added missing \" for tags in textual thing configuration\n- Updated scheduler which fixes an overflow error(#216)\n- States of openHAB groups are now unpacked correctly\n\n#### 0.30.0 (2021-05-02)\n\nAttention:\n- No more support for python 3.6!\n- Migration of rules is needed!\n\nChangelog\n- Switched to Apache2.0 License\n- Fix DateTime string parsing for OH 3.1 (#214)\n- State of Groupitem gets set correctly\n- About ~50% performance increase for async calls in rules\n- Significantly less CPU usage when no functions are running\n- Completely reworked the file handling (loading and dependency resolution)\n- Completely reworked the Scheduler!\n - Has now subsecond accuracy (finally!)\n - Has a new .countdown() job which can simplify many rules.\n It is made for functions that do something after a certain period of time (e.g. switch a light off after movement)\n- Added hsb_to_rgb, rgb_to_hsb functions which can be used in rules\n- Better error message if configured foldes overlap with HABApp folders\n- Renamed HABAppError to HABAppException\n- Some Doc improvements\n\nMigration of rules:\n- Search for ``self.run_`` and replace with ``self.run.``\n- Search for ``self.run.in`` and replace with ``self.run.at``\n- Search for ``.get_next_call()`` and replace with ``.get_next_run()`` (But make sure it's a scheduled job)\n- Search for ``HABAppError`` and replace with ``HABAppException``\n\n\n#### 0.20.2 (2021-04-07)\n- Added HABApp.util.functions with min/max\n- Reworked small parts of the file watcher\n- Doc improvements\n- Dependency updates\n",
"bugtrack_url": null,
"license": null,
"summary": "Easy automation with MQTT and/or openHAB. Create home automation rules in python.",
"version": "24.8.1",
"project_urls": {
"Documentation": "https://habapp.readthedocs.io/",
"GitHub": "https://github.com/spacemanspiff2007/HABApp",
"Homepage": "https://github.com/spacemanspiff2007/HABApp"
},
"split_keywords": [
"mqtt",
" openhab",
" habapp",
" home automation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0f6934afe0c49f02acf14ed961347a340df9b71b9754cc80d9313f08c618e649",
"md5": "8c8196631eaff8b9d120c48a3c79ffea",
"sha256": "027610e3f21597e39664974b8da0591944a3e09bc555ec609af5835a20381f03"
},
"downloads": -1,
"filename": "HABApp-24.8.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8c8196631eaff8b9d120c48a3c79ffea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 242661,
"upload_time": "2024-08-02T07:30:13",
"upload_time_iso_8601": "2024-08-02T07:30:13.577345Z",
"url": "https://files.pythonhosted.org/packages/0f/69/34afe0c49f02acf14ed961347a340df9b71b9754cc80d9313f08c618e649/HABApp-24.8.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "429d4ef417bfddd1c0257566fb23c6a1d2debb8398a76e92438d83401683bf6f",
"md5": "15a1d81745b0ca5ba6e7f58d74b52087",
"sha256": "65d070a12f14e4c003ed4641158bd665233e98603ea644655321d4403a8bcf79"
},
"downloads": -1,
"filename": "habapp-24.8.1.tar.gz",
"has_sig": false,
"md5_digest": "15a1d81745b0ca5ba6e7f58d74b52087",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 161997,
"upload_time": "2024-08-02T07:30:15",
"upload_time_iso_8601": "2024-08-02T07:30:15.195882Z",
"url": "https://files.pythonhosted.org/packages/42/9d/4ef417bfddd1c0257566fb23c6a1d2debb8398a76e92438d83401683bf6f/habapp-24.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-02 07:30:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "spacemanspiff2007",
"github_project": "HABApp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "habapp"
}