Your __str__ methods of a dimmer or rollershutter item return the value, not str(value). So if one tries to print an item with {item} instead of {repr(item)}, it fails with " TypeError: __str__ returned non-string (type …)"
Presumably the __str__ is also called in event.describe(), which casues the error I posted
This is mostly a bugfix release which properly ignores all ItemTimeSeries events from OH4.2.
Also this is probably the last version to support Python 3.8 and Python 3.9 so if you are still running those please think about upgrading (currently to 3.10 or 3.11).
Changelog:
Fixed an issue with thing re-sync
Updated number parsing logic
ItemTimeSeriesEvent gets ignored
Removed verbose error messages when openHAB server disconnects
this does not end until i move all things (all file based) out of the things folder. after that i can move them back and then i do not see this loop again until next reboot.
i tried several reboots, cleared the cache, totally uninstalled habapp, removed the /opt/habapp folder and installed it again. tried to install manually as in the docs and with the openhabian-config menu.
did i miss something? i saved the log but i am not able to attach here because its size is more than 10mb (it covers 6 minutes). thank you for any hints
Additionally a helper simplifies the timestamp handling
# the items have it on last_change and last_update
if my_item.last_change.older_than(seconds(30)):
print('Item was changed before 30s')
timestamp = InstantView.now()
assert timestamp.newer_than(minutes=1)
!! This is a breaking change !!
Changelog:
Switched to new scheduler
Added ValueCommandEvent. The openhab command event inherits from this event.
Added InstantView which simplifies dealing with timestamps
Migration of rules:
Search for self.run.at and replace with self.run.once
If you use job.offset, job.earliest, job.latest or job.jitter you have to rewrite the condition to the new syntax: self.run.on_sunrise(self.my_function).offset(timedelta(hours=2))
becomes self.run.at(self.run.trigger.sunrise().offset(timedelta(hours=2)), self.my_function)
All other scheduler functions will emit deprecation warnings with a hint how to rewrite them
item.last_update and item.last_change can now directly used to check if it’s newer/older than a delta.
Replace item.last_update > datetime_obj with item.last_update > timedelta_obj or item.last_update.newer_than(minutes=10)
thanks for your work, again
I updated my test system to the latest HABApp version and python 3.13.
With this setup I have the SimpleQueue issue, again.
If I remove the HABApp.EventBus logger there is no issue.
For testing purpose I changed line 134 of HABApp.config.logging.config to q = Queue() (same as for python 3.12). This fixes the issue.
Can you please release a bugfix-release with:
for handler_name, buffered_handler_name in buffered_handlers.items():
# https://github.com/python/cpython/issues/124653
if PYTHON_313 or PYTHON_312:
q = Queue()
else:
q: SimpleQueue = SimpleQueue()
Hey Seb. I just upgraded to the latest, and all seems fine so far. I don’t use as many HABApp facilities as others, but I do want to report the status. Thanks so much for all the hard work (I see so many dependency updates)!
Is there some workaround to do a sendNotification through the cloud connector ? (I guess it’s an “action” and not available through API) …I usually use pushover directly in habapp but have some family that only uses the “openhab” app
Sidenote: OH 4.3.0 and latest habapp works nicely here aswell
This was a much requested feature during the last HABApp user meeting but currently there is no easy way to invoke actions. I’ve briefly looked into it but it seems the openHAB side of the actions endpoint is very lacking and provides no easy way to achieve this.
I’ve added a feature request, maybe somebody is kind enough and implements something.
The standard workaround is to create an openHAB item which contains the data and an openHAB rule that then calls the action when this item receives an update.
Hi Sebastian. I have a very special issue or question.
I want to write a python script outside the rules folder to maintain the data in the influxdb. Especially I want to drop measurements that are no longer collected by openHAB.
In order to do so I want to get the actual members of the openHAB group that contains the items to be collected.
In short: I would want to iterate through GroupItem.get_item(…).members.
Unfortunately one cannot use GroupItem.get_item() directly:
Traceback (most recent call last):
File "/srv/openhab-conf/scripts/drop_measurements.py", line 26, in <module>
group_item = GroupItem.get_item(name)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/habapp/lib/python3.11/site-packages/HABApp/core/items/base_item.py", line 38, in get_item
item = get_item(name)
^^^^^^^^^^^^^^
File "/opt/habapp/lib/python3.11/site-packages/HABApp/core/internals/proxy/proxy_obj.py", line 20, in __call__
raise ProxyObjHasNotBeenReplacedError(self)
HABApp.core.errors.ProxyObjHasNotBeenReplacedError: <StartUpProxyObj uses_get_item> has not been replaced on startup!
If I try to call it within a rule the following exception is raised:
Traceback (most recent call last):
File "/srv/openhab-conf/scripts/drop_measurements.py", line 46, in <module>
g = GetInfluxItems('test')
^^^^^^^^^^^^^^^^^^^^^^
File "/srv/openhab-conf/habapp/lib/ownbase.py", line 292, in __init__
Rule.__init__(self)
File "/opt/habapp/lib/python3.11/site-packages/HABApp/rule/rule.py", line 70, in __init__
hook = _get_rule_hook()
^^^^^^^^^^^^^^^^
File "/opt/habapp/lib/python3.11/site-packages/HABApp/rule/rule_hook.py", line 72, in get_rule_hook
raise RuntimeError('HABApp rule files are not meant to be executed directly! '
RuntimeError: HABApp rule files are not meant to be executed directly! Put the file in the HABApp "rule" folder and HABApp will load it automatically.
Any hints how I can use GroupItem.get_item() in a script outside the rules universe?
Unforunately you can’t access lots of internal things outside the rules scope.
But how about you create the scripts and pass the items as an argument?
The item names could be a comma separated string passed as the first argument.
Then you can use self.execute_python to call that script.
Presumably I will create a rule script that creates a yaml containing the members. This can be touched by the script that needs the member information, in order to retrieve the actual list.
Just for better understanding - why don’t you run it as a normal rule?
Small hint:
I would prefer passing through a command line argument because it makes things stateless and you don’t depend on a file. Just serialize your data to json and load it back in your script.
Of course I could do. But I prefer to distingish between controlling the home and maintenance. So I have also a script that performs an export of the influxdb data, that is run regularly as cron job, not by rule.
Especially in this case here, before dropping measurements I want to have a look to the measurements to be dropped. So there is a need for some interaction, which is easily satisfied by using a script rather than a rule.