HABApp 1.0 Beta Test

@imaginator @Dominik_Bernhardt
I’ve created #3037 in the openhab repo. Could you please add some more information why your installation never reached startlevel 100?

Please provide a configuration that can reproduce this issue.

Done

I think Jan meant more in a way how he can reproduce or investigate the issue.
E.g. the config of the blocking netatmo thing or some log messages.
Optimal would be a thing config to reproduce the issue.

1 Like

HABApp will ship with min_start_level set to 70 which will fix the startup problem.


Did you have to perform additional steps to make HABApp work (e.g. is something missing in the migration description)?
Did the setup work or was it necessary to manually install packages?

I’m using a derived Dockerfile based on the one currently on the dev branch in the habapp repo and the container is already running as my “production smarthome”.
The only changed I needed to do is

  • change the mount point of my config from /config to /habapp/config

  • Adjust the ownership of the files in the config directory.

Where would you document the upgrade procedure? In your readme.md?

Adjust how? Did the user change or have you not set the UID/GID for the old image?

I’ll provide them with the release notes. I keep track of the changes in the first post.

I definitely did not have the UID defined for the old image. Wasn’t in the old image HABApp running as root and hence it did not matter what UID owned the files in the config dir?

You are correct - I thought it was already possible to set UID/GID. My mistake.


I really would have liked some general feedback.
However since most of the (obvious) bugs have been purged I think I’ll make it a release version in the middle of the next week.

i am afraid i am not good enough to provide useful information but i can say that lately i startet to try habapp, before that i worked with jython. i got first easy rules to work but (i think it happened) when i upgraded to oh 3.3.0 release build it stopped working. i uninstalled hapapp and installed your current dev branch from git. with the changes you noted in your first post here it now works again. like this:

    def __init__(self):
        super().__init__()
        self.log = logging.getLogger('My_HABApp')

        self.log.debug('### init HABApp.Rule basic_1.py')
        self.my_sensor = Items.get_item('ivi')
        self.log.debug('ivi (Items.get_item) = %s', self.my_sensor )
        self.my_sensor.listen_event(self.item_changed, ValueChangeEventFilter())

    def item_changed(self, event: ValueChangeEvent):
        self.log.debug(f'{event.name} changed from "{event.old_value}"  to "{event.value}"')

one thing i cannot get work is the ChannelTriggeredEvent

i use openhabian on a rpi4

Do you see the ChannelTriggeredEvent in the HABApp event log? I think it’s currently not propagated from openHAB to HABApp.
Cann’t you just bind an item to the Channel and then use the value events?

thank you, i am glad about your response.

i see the event in the log:

[2022-07-20 08:15:14,328] [          HABApp.EventBus]     INFO | openwebnet:bus_cen_scenario_control:bticino:Abstell_Cen_PIr:button#6: <ChannelTriggeredEvent name: openwebnet:bus_cen_scenario_control:bticino:Abstell_Cen_PIr:button#6, event: SHORT_PRESS>

thats why i tought i would be the correct way to manage this and should work. but i dont know how to code that, because i am missing something like ChannelTriggeredEventFilter() to use in listen_event

Just use EventFilter and pass ChannelTriggeredEvent as the first parameter. See Docs

thanks for the hint, i am a little further but i still do something wrong. this is my rule so far:

class Basic_2(HABApp.Rule):
    def __init__(self):
        super().__init__()
        self.log = logging.getLogger('My_HABApp')

        self.trig_chn_item = Items.get_item('iViGenOff')
        self.trig_chn_item.listen_event(self.triggered_channel, EventFilter(ChannelTriggeredEvent))

    def triggered_channel(self, event):
        self.log.debug('### triggered!! ###')

Basic_2()

it is loaded without error but the function triggered_channel is not called when the channel triggers. this is the channel i want to trigger:

openwebnet:bus_cen_scenario_control:bticino:Cen_GenOnOff:button#1

and to be onest i do not understand what the item trig_chn_item has to be in this case.

I have migrated my production environment to the latest dev version and it successfully runs without any problems since more than two weeks now. Due to time availability I could not really test a lot of the new functionality. Take it as a compliment: Even the existing HABapp already served its purpose and had all the functionality I needed.
But I really like the better startup/openhab sync behavior.
From my perpective I would feel comfortable with releasing a version.
And last but not least: @Spaceman_Spiff Thanks a lot lot for the new release.

1 Like

You have to bind the item on the openhab side. Just create a new one and link it to the thing channel.
That’s how I would do it. Then you get the corresponding ValueUpdate and ValueChanged events.

Otherwise it’s

self.listen_event('openwebnet:bus_cen_scenario_control:bticino:Cen_GenOnOff:button#1', EventFilter(ChannelTriggeredEvent))

nearly, thanks to your hint i got it work like this (function call was missing in the listen_event):

class Basic_2(HABApp.Rule):
    def __init__(self):
        super().__init__()
        self.log = logging.getLogger('My_HABApp')

        self.listen_event('openwebnet:bus_cen_scenario_control:bticino:Cen_GenOnOff:button#1', self.triggered_channel, EventFilter(ChannelTriggeredEvent))

    def triggered_channel(self, event):
        self.log.debug('### channel triggered!! ###')
        self.log.debug(f'{event.name} event: "{event.event}"')

although i have this message in the log when the rule loads but the rule works, thank you!

[2022-07-21 18:29:12,969] [              HABApp.Rule]     WARN | Item "openwebnet:bus_cen_scenario_control:bticino:Cen_GenOnOff:button#1" does not exist (yet)! self.listen_event in "Basic_2" may not work as intended.

@Spaceman_Spiff
I have looked for for a docker image of the 1.0 beta. It seems not to be on the docker hub?

You can build it on your own with the DOCKERFILE from the dev-branch

Was about to do so, but getting a build warning and errors:

Step 3/12 : RUN set -eux; 	cd /tmp/app_install; 	pip wheel --wheel-dir=/root/wheels --use-feature=in-tree-build .
 ---> Running in 88f748c07855
+ cd /tmp/app_install
+ pip wheel --wheel-dir=/root/wheels --use-feature=in-tree-build .
DEPRECATION: In-tree builds are now the default. pip 22.1 will enforce this behaviour change. A possible replacement is to remove the --use-feature=in-tree-build flag.
 WARNING: Missing build requirements in pyproject.toml for ujson<5.5,>=5.4 from https://files.pythonhosted.org/packages/fb/94/44fbbb059fe5d295f1f73e731a0b9c2e1b5073c2c6b58bb9c068715e9b72/ujson-5.4.0.tar.gz#sha256=6b953e09441e307504130755e5bd6b15850178d591f66292bba4608c4f7f9b00 (from HABApp==0.31.3.Dev).
  WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'wheel'.
Collecting ruamel.yaml.clib>=0.2.6
  Downloading ruamel.yaml.clib-0.2.6.tar.gz (180 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 180.7/180.7 KB 10.4 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      sys.argv ['/tmp/pip-wheel-31xc4upe/ruamel-yaml-clib_726b4d0e3d734bc2bc920fb743da0868/setup.py', 'egg_info', '--egg-base', '/tmp/pip-pip-egg-info-yxmkwmg8']
      test compiling /tmp/tmp_ruamel_ouu5dw75/test_ruamel_yaml.c -> test_ruamel_yaml compile error: /tmp/tmp_ruamel_ouu5dw75/test_ruamel_yaml.c
      Exception: command 'gcc' failed: No such file or directory
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: You are using pip version 22.0.4; however, version 22.2 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.

I am going to try to sort out what’s going wrong.
Posting here if someone has already sorted it out