HABApp 24

I guess I found the culprit.

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

1 Like

Thank you for you help and thorough investigation. I’ll make sure to fix this issue with the next release.

Good news everyone!

HABApp 24.08.0 is out!

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
  • Updated dependencies
  • Reformatted some files
1 Like

i updated to 24.8.0 today in the morning and everything worked as before.

now i did a reboot of the rpi and now i have an endless loop when habapp starts like:

2024-08-01 18:49:15.224 [DEBUG] [HABApp.openhab.items                ] - Starting Thing sync
2024-08-01 18:49:15.290 [DEBUG] [HABApp.openhab.items                ] - Re-synced solarlog:meter:pv
2024-08-01 18:49:15.291 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:Hwr_CenPlus_PIr
2024-08-01 18:49:15.292 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_dimmer:bticino:EWoK_Kueche_Li
2024-08-01 18:49:15.292 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_Solar_KollektorRL
2024-08-01 18:49:15.293 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_dimmer:bticino:EWoK_Fenster_Li
2024-08-01 18:49:15.293 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_sensor:bticino:EWoK_Heizung_Slave
2024-08-01 18:49:15.294 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_PufferMitte
2024-08-01 18:49:15.295 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:Schlafzi_CenPl_Li
2024-08-01 18:49:15.295 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_dimmer:bticino:WC_Li
2024-08-01 18:49:15.296 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_dimmer:bticino:EWoK_TV_Li
2024-08-01 18:49:15.296 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_Solar_PoolRL
2024-08-01 18:49:15.297 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:WC_CenPl_Musik
2024-08-01 18:49:15.297 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_KaminVL
2024-08-01 18:49:15.298 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_KWL_Solebox
2024-08-01 18:49:15.299 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:EGFlur_Cen_PIr
2024-08-01 18:49:15.299 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:OGFlur_Treppe_CenPl
2024-08-01 18:49:15.300 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_EGKl_Fbh_RL
2024-08-01 18:49:15.301 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:Garage_CenPlus_PIr
2024-08-01 18:49:15.302 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Schlafzi_Cen_Li
2024-08-01 18:49:15.302 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_Technikraum
2024-08-01 18:49:15.303 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:EWoK_Cen_Abzug
2024-08-01 18:49:15.304 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Cen_MorgenFeiertag
2024-08-01 18:49:15.304 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_BetriebPufferUnten
2024-08-01 18:49:15.305 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Hwr_Cen
2024-08-01 18:49:15.305 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_PufferOben
2024-08-01 18:49:15.306 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_KWL_Aussen
2024-08-01 18:49:15.306 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_zone:bticino:Hwr_Heizung
2024-08-01 18:49:15.307 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_zone:bticino:Abstell_Heizung
2024-08-01 18:49:15.308 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_PufferUnten
2024-08-01 18:49:15.308 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_Solar_KollektorVL
2024-08-01 18:49:15.309 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_KaminRL
2024-08-01 18:49:15.310 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_BetriebPufferOben
2024-08-01 18:49:15.310 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_Solar_PoolVL
2024-08-01 18:49:15.311 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Buero_Cen_Ro
2024-08-01 18:49:15.311 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_zone:bticino:EGFlur_Heizung
2024-08-01 18:49:15.312 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_zone:bticino:Jana_Heizung
2024-08-01 18:49:15.313 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Schlafzi_Cen_Ro_Morg
2024-08-01 18:49:15.313 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_zone:bticino:Tim_Heizung
2024-08-01 18:49:15.314 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:Schlafzi_CenPl_Hu_Li
2024-08-01 18:49:15.315 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_dry_contact_ir:bticino:Hwr_Kt
2024-08-01 18:49:15.315 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Garage_Cen_PIr
2024-08-01 18:49:15.316 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_Pool
2024-08-01 18:49:15.316 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_KWL_Abluft
2024-08-01 18:49:15.317 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:Schlafzi_CenPl_TV
2024-08-01 18:49:15.318 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Schlafzi_Cen_Hundemelder
2024-08-01 18:49:15.318 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_NotVL
2024-08-01 18:49:15.319 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:OGFlur_Cen_PIr
2024-08-01 18:49:15.319 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Schlafzi_Cen_WC
2024-08-01 18:49:15.320 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:WC_Cen_PIr
2024-08-01 18:49:15.321 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_zone:bticino:Bad_Heizung
2024-08-01 18:49:15.324 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_KWL_Zuluft
2024-08-01 18:49:15.325 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_FbhRL
2024-08-01 18:49:15.326 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:Bad_CenPl_Div
2024-08-01 18:49:15.327 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Tim_Cen_Li
2024-08-01 18:49:15.327 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_KWL_Fortluft
2024-08-01 18:49:15.328 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_zone:bticino:WC_Heizung
2024-08-01 18:49:15.329 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:WC_Cen_Musik
2024-08-01 18:49:15.329 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_NotRL
2024-08-01 18:49:15.330 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:EWoK_CenPl_Li
2024-08-01 18:49:15.331 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Hwr_Cen_PIr
2024-08-01 18:49:15.331 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Schlafzi_Cen_Ro_Abend
2024-08-01 18:49:15.332 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Bad_Cen_Musik
2024-08-01 18:49:15.333 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_dry_contact_ir:bticino:Garage_TuereHolz_Kt
2024-08-01 18:49:15.334 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Jana_Cen_Li
2024-08-01 18:49:15.334 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:EWoK_Cen_Lamellen
2024-08-01 18:49:15.335 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_dimmer:bticino:Abstell_Li
2024-08-01 18:49:15.336 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Hoftor_Cen
2024-08-01 18:49:15.336 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_EGKl_Fbh_VL
2024-08-01 18:49:15.337 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:EWoK_CenPl_Div
2024-08-01 18:49:15.338 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:Bad_Cen_Li
2024-08-01 18:49:15.339 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_FbhVL
2024-08-01 18:49:15.340 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_zone:bticino:OGFlur_Heizung
2024-08-01 18:49:15.340 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cen_scenario_control:bticino:EWoK_Cen_Ja
2024-08-01 18:49:15.341 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:Schlafzi_CenPl_Ro
2024-08-01 18:49:15.344 [DEBUG] [HABApp.openhab.items                ] - Starting Thing sync
2024-08-01 18:49:15.404 [DEBUG] [HABApp.openhab.items                ] - Re-synced solarlog:meter:pv
2024-08-01 18:49:15.405 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_cenplus_scenario_control:bticino:Hwr_CenPlus_PIr
2024-08-01 18:49:15.405 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_dimmer:bticino:EWoK_Kueche_Li
2024-08-01 18:49:15.408 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_Solar_KollektorRL
2024-08-01 18:49:15.408 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_dimmer:bticino:EWoK_Fenster_Li
2024-08-01 18:49:15.409 [DEBUG] [HABApp.openhab.items                ] - Re-synced openwebnet:bus_thermo_sensor:bticino:EWoK_Heizung_Slave
2024-08-01 18:49:15.409 [DEBUG] [HABApp.openhab.items                ] - Re-synced onewire:basic:mybridge:OwTemp_PufferMitte

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

1 Like

Good news everyone!

HABApp 24.08.1 is out!

This fixes a possible infinite loop during the thing sync which @bastler was hitting

2 Likes

I also updated to the latest version (24.08.1) and face no issues till now. Thanks for your work :slight_smile:

Good news everyone!

After countless hours of work I present to you

HABApp 24.11.0

The highlight of this release is the new scheduler which is very powerful yet very easy to use. It also brings support for public holidays.

self.run.at(
    self.run.trigger.time('12:00:00').only_on(self.run.filter.weekdays('Mo-Fr')),
    self.my_func
)

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)
3 Likes

Hi Sebastian,

thanks for your work, again :slight_smile:
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()

Done - I’ve pushed a fix

Thanks, I updated my main system and see no other issues, so far.

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)!

just a information: i updated to openhab release 4.3.0 and for me everything works as intended :grinning:

1 Like

same here :slight_smile:

1 Like

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 :thinking:

Sidenote: OH 4.3.0 and latest habapp works nicely here aswell :ok_hand:

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.

3 Likes

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.

Ok, I thought so… thank you.

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.