Skip to content

Commit

Permalink
1.0.7 (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 authored Feb 9, 2023
1 parent 9ae69e7 commit 59528d3
Show file tree
Hide file tree
Showing 81 changed files with 785 additions and 247 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[flake8]
# settings for flake8-spellcheck
dictionaries=en_US,python,technical

ignore =
# E201 whitespace after '('
E201,
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:

- name: Get Latest Release
id: latest_version
uses: abatilo/[email protected].0
uses: abatilo/[email protected]
with:
owner: spacemanspiff2007
repo: HABApp

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
with:
version: latest

Expand All @@ -37,7 +37,7 @@ jobs:

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: master
- name: Set up Python 3.9
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.10

- name: Install setuptools
run: |
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/run_tox.yml → .github/workflows/run-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,29 @@ name: Tests
on: [push, pull_request]

jobs:
test:
pre-commit:
name:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: pre-commit/[email protected]


tests:
needs: pre-commit
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
48 changes: 44 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,59 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.4.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: check-merge-conflict
# - id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
exclude: ^docs/(?:images|gifs)
- id: trailing-whitespace


# - repo: https://github.com/pycqa/isort
# rev: 5.8.0
# rev: 5.11.4
# hooks:
# - id: isort
# name: isort (python)

- repo: https://gitlab.com/PyCQA/flake8
rev: '4.0.1'

- repo: https://github.com/PyCQA/flake8
rev: '6.0.0'
hooks:
- id: flake8
# additional_dependencies:
# - flake8-bugbear==23.1.14
# - flake8-comprehensions==3.10.1
# - flake8-pytest-style==1.6
# - flake8-unused-arguments==0.0.12
# - flake8-noqa==1.3
# - pep8-naming==0.13.3


- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: ["--py38-plus"]


- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks


# - repo: https://github.com/igorshubovych/markdownlint-cli
# rev: v0.33.0
# hooks:
# - id: markdownlint


- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
5 changes: 3 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ sphinx:
formats: all

build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.10"
apt_packages:
- graphviz

# Optionally set the version of Python and requirements required to build your docs
python:
install:
- requirements: requirements_setup.txt
- requirements: docs/requirements.txt
- method: setuptools
path: .
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# type: ignore
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Description
======================================

Configuration is done through ``config.yml`` The parent folder of the file can be specified with ``-c PATH`` or ``--config PATH``.
If nothing is specified the file ``config.yml`` is searched in the subdirectory `HABApp` in
If nothing is specified the file ``config.yml`` is searched in the subdirectory ``HABApp`` in

* the current working directory
* the venv directory
Expand Down
2 changes: 1 addition & 1 deletion docs/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ It's possible to filter out certain parts of log files with a
`filter <https://docs.python.org/3/library/logging.html?highlight=logging%20filter#logging.Filter>`_.
The recommendation is to create the filter :ref:`during startup<ref_run_code_on_startup>`.

This example ignores all messages for the ``HABApp.EventBus`` logger that contain `MyIgnoredString`.
This example ignores all messages for the ``HABApp.EventBus`` logger that contain ``MyIgnoredString``.


.. exec_code::
Expand Down
2 changes: 1 addition & 1 deletion docs/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Parameters
------------------------------
Parameters are values which can easily be changed without having to reload the rules.
Values will be picked up during runtime as soon as they get edited in the corresponding file.
If the file doesn't exist yet it will automatically be generated in the configured `param` folder.
If the file doesn't exist yet it will automatically be generated in the configured ``param`` folder.
Parameters are perfect for boundaries (e.g. if value is below param switch something on).
Currently there are is :class:`~HABApp.parameters.Parameter` and :class:`~HABApp.parameters.DictParameter` available.

Expand Down
12 changes: 6 additions & 6 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Packages required to build the documentation
sphinx >= 5.2, < 6.0
sphinx-autodoc-typehints >= 1.19, < 2
sphinx_rtd_theme == 1.0.0
sphinx-exec-code == 0.8
autodoc_pydantic >= 1.7, < 1.8
sphinx >= 6.1, < 7
sphinx-autodoc-typehints >= 1.22, < 2
sphinx_rtd_theme == 1.2.0
sphinx-exec-code == 0.9
autodoc_pydantic >= 1.8, < 1.9

# we use monkeypatch in the RuleRunner which is part of pytest
pytest >= 7.1, < 8
pytest >= 7.2, < 8
9 changes: 7 additions & 2 deletions docs/rule.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ OrFilterGroup
.. autoclass:: HABApp.core.events.OrFilterGroup
:members:

Example
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. exec_code::
:hide_output:
Expand All @@ -176,6 +178,9 @@ OrFilterGroup
super().__init__()
my_item = Item.get_item('MyItem')

# This will only call the callback for ValueUpdateEvents
my_item.listen_event(self.on_val_my_value, ValueUpdateEventFilter())

# This will only call the callback for ValueUpdateEvents where the value==my_value
my_item.listen_event(self.on_val_my_value, ValueUpdateEventFilter(value='my_value'))

Expand All @@ -202,8 +207,8 @@ OrFilterGroup
Scheduler
------------------------------
With the scheduler it is easy to call functions in the future or periodically.
Do not use `time.sleep` but rather `self.run.at`.
Another very useful function is `self.run.countdown` as it can simplify many rules!
Do not use ``time.sleep`` but rather ``self.run.at``.
Another very useful function is ``self.run.countdown`` as it can simplify many rules!

.. list-table::
:widths: auto
Expand Down
37 changes: 21 additions & 16 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,39 +117,44 @@ MyOpenhabRule()
```

# Changelog
#### 1.0.6 (08.11.2022)
#### 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 (20.10.2022)
#### 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 (25.08.2022)
#### 1.0.4 (2022-08-25)
- New RGB & HSB datatype for simpler color handling
- Fixed Docker build
- Bugfixes

#### 1.0.3 (09.08.2022)
#### 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 (29.07.2022)
#### 1.0.2 (2022-07-29)
- Fixed setup issues
- Fixed unnecessary long tracebacks

#### 1.0.1 (25.07.2022)
#### 1.0.1 (2022-07-25)
- Dockerfile is Python 3.10 and non slim

#### 1.0.0 (25.07.2022)
#### 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.
Expand Down Expand Up @@ -208,19 +213,19 @@ MQTT:

---

#### 0.31.2 (17.12.2021)
#### 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 (29.10.2021)
#### 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 (08.10.2021)
#### 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
Expand All @@ -230,29 +235,29 @@ MQTT:
- Examples in the docs get checked with a newly created sphinx extension
- Reworked the openHAB tests

#### 0.30.3 (17.06.2021)
#### 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 (01.06.2021)
#### 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 (26.05.2021)
#### 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 (07.05.2021)
#### 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 (02.05.2021)
#### 0.30.0 (2021-05-02)

Attention:
- No more support for python 3.6!
Expand Down Expand Up @@ -281,7 +286,7 @@ Migration of rules:
- Search for ``HABAppError`` and replace with ``HABAppException``


#### 0.20.2 (07.04.2021)
#### 0.20.2 (2021-04-07)
- Added HABApp.util.functions with min/max
- Reworked small parts of the file watcher
- Doc improvements
Expand Down
11 changes: 6 additions & 5 deletions requirements_setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ aiohttp >= 3.8, < 3.9
pydantic >= 1.10, < 1.11
pendulum >= 2.1.2, < 2.2
bidict >= 0.22, < 0.23
watchdog >= 2.1.7, < 2.2
ujson >= 5.5, < 5.6
watchdog >= 2.2, < 2.3
ujson >= 5.7, < 5.8
paho-mqtt >= 1.6, < 1.7

immutables == 0.19
eascheduler == 0.1.7
easyconfig == 0.2.4
stack_data == 0.5.1
eascheduler == 0.1.8
easyconfig == 0.2.8
stack_data == 0.6.2
colorama == 0.4.6

voluptuous == 0.13.1

Expand Down
Loading

0 comments on commit 59528d3

Please sign in to comment.