HABApp 1.0 Beta Test

@Spaceman_Spiff it looks like a regression (running the latest from Develop branch) or perhaps we are doing something wrong (again :slight_smile: ). Before the fix we were at least able to get_item now, this method throws an item not found error.

from HABApp import Rule
from HABApp.core.events import ValueUpdateEvent, ValueChangeEvent
from HABApp.openhab.events import ItemStateChangedEvent,ItemStateChangedEventFilter
from HABApp.openhab.items import NumberItem, OpenhabItem
 
class MyRule(Rule):
    def __init__(self):
        super().__init__()
        # Get the item or create it if it does not exist
        self.my_item = OpenhabItem.get_item('AstroSunPositionElevation')
        print(self.my_item)
        e = self.my_item.listen_event(self.item_changed, ItemStateChangedEventFilter())
        print(e.__dict__["func"].__dict__)


    def item_changed(self, event: ItemStateChangedEvent):
        print("GOT EVENT")
        print(f'{event.name} changed from "{event.old_value}" to "{event.value}"')
        print(f'Last change of {self.my_item.name}: {self.my_item.last_change}')

MyRule()

What’s in the HABApp log? Your instance might not be connected yet.

From the log it looks like it’s connected. I can confirm that the item AstroSunPositionElevation definitely exits. I also see network traffic from HABapp to the server. Let me know if there is anything else I can send to help debug.

No - it is not completely connected. You manually dropped the file so it gets loaded before the the connection is complete. It’s the same issue as above in the thread.

@Dominik_Bernhardt
Have you already created an issue for openhab? I’ve not found the link in the 3.3 release thread.
Were you able to reproduce the issue?

What’s it doing during the connection? How long should one wait for startup? When I use the master branch I am connected and able to retrieve a value just not updates.

Waiting until openhab ist fully started.

Depends on your openhab installation size.
Dominik described the issue nicely.

see here

So adding the mentioned min_start_level to 60 seems to have worked. I’ve not changed any OH runlevel bits so I would have assumed that since it’s been running for a few days, it was “started”.

Anyway this is great and we’re now getting events coming though. Thanks for the help.

I’ll investigate why my OH instance was only getting as far as runlevel 70.

So it looks like you are experiencing the same openHAB bug/issue as Dominik.
Could you try to reproduce the issue (probably a thing that doesn’t initialize well) and open an issue in the openhab repo, please?

Trying to get going for testing on a less-critical system but running into installation problems on an OpenHABian install. I realize this is not specifically a HABApp issue, but can’t get through it. Any ideas?

  Cloning https://github.com/spacemanspiff2007/HABApp.git (to revision Develop) to /tmp/pip-req-build-uq6tdhj8
  Running command git clone --filter=blob:none --quiet https://github.com/spacemanspiff2007/HABApp.git /tmp/pip-req-build-uq6tdhj8
  Running command git checkout -b Develop --track origin/Develop
  Switched to a new branch 'Develop'
  Branch 'Develop' set up to track remote branch 'Develop' from 'origin'.
  Resolved https://github.com/spacemanspiff2007/HABApp.git to commit a278927d149c33141ac67a5e500dc8cc26c89d06
  Preparing metadata (setup.py) ... done
Requirement already satisfied: aiohttp-sse-client==0.2.1 in ./lib/python3.7/site-packages (from HABApp==0.31.3.Dev) (0.2.1)
Collecting aiohttp<3.9,>=3.8
  Using cached https://www.piwheels.org/simple/aiohttp/aiohttp-3.8.1-cp37-cp37m-linux_armv7l.whl (1.1 MB)
Collecting bidict<0.23,>=0.22
  Using cached https://www.piwheels.org/simple/bidict/bidict-0.22.0-py3-none-any.whl (36 kB)
Collecting eascheduler==0.1.5
  Using cached https://www.piwheels.org/simple/eascheduler/EAScheduler-0.1.5-py3-none-any.whl (20 kB)
ERROR: Ignored the following versions that require a different python version: 0.2.1 Requires-Python >=3.8; 0.2.2 Requires-Python >=3.8; 0.2.3 Requires-Python >=3.8; 0.2.4 Requires-Python >=3.8
ERROR: Could not find a version that satisfies the requirement easyconfig==0.2.4 (from habapp) (from versions: 0.0.1, 0.0.2, 0.1.0, 0.1.1, 0.1.2, 0.2.0)
ERROR: No matching distribution found for easyconfig==0.2.4
WARNING: Ignoring invalid distribution -ip (/opt/habapp/lib/python3.7/site-packages)
WARNING: Ignoring invalid distribution -abapp (/opt/habapp/lib/python3.7/site-packages)
WARNING: Ignoring invalid distribution -ip (/opt/habapp/lib/python3.7/site-packages)
WARNING: Ignoring invalid distribution -abapp (/opt/habapp/lib/python3.7/site-packages)
WARNING: Ignoring invalid distribution -ip (/opt/habapp/lib/python3.7/site-packages)
WARNING: Ignoring invalid distribution -abapp (/opt/habapp/lib/python3.7/site-packages)

I’ve tried a few things but can’t get 3.8 or 3.9 to install and I’m not sure I want to go the route of compiling my own install yet… am I missing something simple?

Python 3.8 should be the standard python for (almost) all distributions by now.
If you don’t want to / can’t upgrade your distribution you can just download the python binaries and install them. There is no need to compile python yourself.
E.g. this will install python 3.10.2 - just make sure to use the latest version which would be 3.10.5 and modify the script accordingly. This would be a step by step tutorial.

Is this a fresh install or an existing, older install of openhabian?

Raspberry Pi reference 2021-03-04
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 461109415073d2eb67083709662ba983cc191f14, stage2

fresh install onto an unused Pi resulted in 3.9.2

1 Like

@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?