I am trying to get habapp working and not having any luck.
system: Raspberry Pi, running buster, openhab 3.1 and python 3.7.3
I am troubleshooting my problem as though it is an authentication issue but I am out of ideas. I have a username and password in my /etc/openhab/habapp/comfig.yml file. Habapp is running.
root@zippy:/home/chris# service habapp status
● habapp.service - HABApp
Loaded: loaded (/etc/systemd/system/habapp.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-09-29 13:28:11 PDT; 2s ago
Docs: https://habapp.readthedocs.io
Main PID: 6896 (habapp)
Tasks: 1 (limit: 2059)
CGroup: /system.slice/habapp.service
└─6896 /opt/habapp/bin/python3 /opt/habapp/bin/habapp -c /etc/openhab/habapp
Sep 29 13:28:11 zippy systemd[1]: Started HABApp.
My /var/log/openhab/HABapp.log is
root@zippy:/home/chris# cat /var/log/openhab/HABApp.log
[2021-09-29 13:28:15,308] [ HABApp] INFO | HABApp Version 0.30.3
[2021-09-29 13:28:15,315] [ HABApp.mqtt.connection] INFO | MQTT disabled
[2021-09-29 13:28:15,317] [ HABApp.openhab.thing] INFO | Config folder does not exist - textual thing config disabled!
[2021-09-29 13:28:15,318] [ HABApp.RuleParameters] INFO | Parameter files disabled: Folder /etc/openhab/habapp/params does not exist!
[2021-09-29 13:28:20,513] [HABApp.openhab.connection] WARNING | Status 403 for GET http://localhost:8080/rest/uuid/
[2021-09-29 13:28:20,515] [HABApp.openhab.connection] INFO | ... offline!
[2021-09-29 13:28:26,568] [HABApp.openhab.connection] WARNING | Status 403 for GET http://localhost:8080/rest/uuid/
[2021-09-29 13:28:26,569] [HABApp.openhab.connection] INFO | ... offline!
[2021-09-29 13:28:33,611] [HABApp.openhab.connection] WARNING | Status 403 for GET http://localhost:8080/rest/uuid/
[2021-09-29 13:28:33,612] [HABApp.openhab.connection] INFO | ... offline!
[2021-09-29 13:28:42,638] [HABApp.openhab.connection] WARNING | Status 403 for GET http://localhost:8080/rest/uuid/
[2021-09-29 13:28:42,639] [HABApp.openhab.connection] INFO | ... offline!
[2021-09-29 13:28:55,667] [HABApp.openhab.connection] WARNING | Status 403 for GET http://localhost:8080/rest/uuid/
[2021-09-29 13:28:55,669] [HABApp.openhab.connection] INFO | ... offline!
[2021-09-29 13:29:16,698] [HABApp.openhab.connection] WARNING | Status 403 for GET http://localhost:8080/rest/uuid/
Allow Basic Authentication is turned on, though I have tried switch off.
I tried purging my openhab installation and starting over, but no matter what I do, I can’t get this resolved. The documentation for this app is so good, I am sure I am just missing something. Please help.
Thanks,
Chris
The UUID should work even without authentication so this looks really strange.
When you replace localhost with the IP of the device does it work in your browser?
Can you check if “implicit user role” is enabled (should be) under api-security in the openhab settings?
Thanks for your response. I tried replacing the local host with the IP, but same results. That lead me to look more into API Security on my openhab installations. There are parameters missing under the advanced settings. I will look into that more.
Things are looking better with the update to openhab 3.1. I had mistakenly thought my test instance of openhab was at the same level as my production instance.
Now I have “Basic Authentication” and “Implicit User Role” enabled. My logs are looking better, but there still seems to be a problem with connecting to the “rest/things”, but it is a warning and maybe not an issue.
root@zippy:/home/chris# cat /var/log/openhab/HABApp.log
[2021-09-30 13:47:13,226] [ HABApp] INFO | HABApp Version 0.30.3
[2021-09-30 13:47:13,233] [ HABApp.mqtt.connection] INFO | Connecting to 192.168.92.208:8883
[2021-09-30 13:47:13,237] [ HABApp.openhab.thing] INFO | Config folder does not exist - textual thing config disabled!
[2021-09-30 13:47:13,238] [ HABApp.RuleParameters] INFO | Parameter files disabled: Folder /etc/openhab/habapp/params does not exist!
[2021-09-30 13:47:13,707] [HABApp.openhab.connection] INFO | Connected to OpenHAB instance f91f5793-29c0-4821-aa32-88e452bd22f1
[2021-09-30 13:47:13,708] [HABApp.openhab.connection] INFO | OpenHAB version 3.1.0 (Release Build)
[2021-09-30 13:47:13,853] [ HABApp.openhab.items] INFO | Updated 10 Items
[2021-09-30 13:47:13,875] [HABApp.openhab.connection] WARNING | Disconnected! Expected success but got status 401 for /rest/things/
[2021-09-30 13:47:15,213] [HABApp.openhab.connection] INFO | Connected to OpenHAB instance f91f5793-29c0-4821-aa32-88e452bd22f1
[2021-09-30 13:47:15,214] [HABApp.openhab.connection] INFO | OpenHAB version 3.1.0 (Release Build)
[2021-09-30 13:47:15,326] [ HABApp.openhab.items] INFO | Updated 10 Items
[2021-09-30 13:47:15,348] [HABApp.openhab.connection] WARNING | Disconnected! Expected success but got status 401 for /rest/things/
[2021-09-30 13:47:17,694] [HABApp.openhab.connection] INFO | Connected to OpenHAB instance f91f5793-29c0-4821-aa32-88e452bd22f1
[2021-09-30 13:47:17,695] [HABApp.openhab.connection] INFO | OpenHAB version 3.1.0 (Release Build)
[2021-09-30 13:47:17,807] [ HABApp.openhab.items] INFO | Updated 10 Items
[2021-09-30 13:47:17,835] [HABApp.openhab.connection] WARNING | Disconnected! Expected success but got status 401 for /rest/things/
[2021-09-30 13:47:18,922] [ HABApp.Rule] WARNING | /opt/habapp/lib/python3.7/site-packages/HABApp/rule/rule.py:245: DeprecationWarning:self.run_soon is deprecated. Please use self.run.soon
[2021-09-30 13:47:18,931] [ HABApp.Rules] INFO | Added rule "MyFirstRule" from rules/easy2.py
[2021-09-30 13:47:19,021] [ HABApp.Rules] INFO | Added rule "MyRule" from rules/sched.py
[2021-09-30 13:47:22,240] [HABApp.openhab.connection] INFO | Connected to OpenHAB instance f91f5793-29c0-4821-aa32-88e452bd22f1
[2021-09-30 13:47:22,241] [HABApp.openhab.connection] INFO | OpenHAB version 3.1.0 (Release Build)
[2021-09-30 13:47:22,355] [ HABApp.openhab.items] INFO | Updated 10 Items
[2021-09-30 13:47:22,380] [HABApp.openhab.connection] WARNING | Disconnected! Expected success but got status 401 for /rest/things/
[2021-09-30 13:47:30,710] [HABApp.openhab.connection] INFO | Connected to OpenHAB instance f91f5793-29c0-4821-aa32-88e452bd22f1
[2021-09-30 13:47:30,711] [HABApp.openhab.connection] INFO | OpenHAB version 3.1.0 (Release Build)
[2021-09-30 13:47:30,845] [ HABApp.openhab.items] INFO | Updated 10 Items
[2021-09-30 13:47:30,868] [HABApp.openhab.connection] WARNING | Disconnected! Expected success but got status 401 for /rest/things/
It does look like habapp is working, but I am pretty much a novice at Python3. Test rules that I copied from examples are running.
I am pretty sure it isn’t a typo. To verify, I edited my config.yml file with a new username and password. I had tried it before with the username and password values at ‘’. That gave 401 errors. Then I added the new credentials with the karaf console. For good measure, I changed the cache expiration time to 0. Errors went from 401 errors to 403.
[2021-09-30 20:48:14,798] [ HABApp.Worker] ERROR |
[2021-09-30 20:48:14,798] [ HABApp.Worker] ERROR | UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 37: invalid start byte
[2021-09-30 20:48:14,812] [HABApp.openhab.connection] WARNING | Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
[2021-09-30 20:48:15,117] [ HABApp.Rules] WARNING | Found no instances of HABApp.Rule in /etc/openhab/habapp/rules/._easy2.py
[2021-09-30 20:48:15,132] [ HABApp.Rule] WARNING | /opt/habapp/lib/python3.7/site-packages/HABApp/rule/rule.py:245: DeprecationWarning:self.run_soon is deprecated. Please use self.run.soon
[2021-09-30 20:48:15,138] [ HABApp.Rules] INFO | Added rule "MyFirstRule" from rules/easy2.py
[2021-09-30 20:48:15,176] [ HABApp.Rules] INFO | Added rule "MyHolidayRule" from rules/holiday.py
[2021-09-30 20:48:15,237] [ HABApp.Rules] INFO | Added rule "MyRule" from rules/sched.py
[2021-09-30 20:48:16,397] [HABApp.openhab.connection] WARNING | Disconnected! Expected success but got status 403 for /rest/things/
[2021-09-30 20:49:22,911] [HABApp.openhab.connection] INFO | Connected to OpenHAB instance f91f5793-29c0-4821-aa32-88e452bd22f1
[2021-09-30 20:49:22,913] [HABApp.openhab.connection] INFO | OpenHAB version 3.1.0 (Release Build)
[2021-09-30 20:49:28,121] [ HABApp.openhab.items] INFO | Updated 10 Items
[2021-09-30 20:49:31,187] [HABApp.openhab.connection] WARNING | Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
[2021-09-30 20:49:33,215] [HABApp.openhab.connection] WARNING | Disconnected! Expected success but got status 403 for /rest/things/
I noticed a new status 404 warning that I had not noticed before.
I am running on very low sleep for the past few days, and could have messed something up. Probably about time to give it up for the evening.
It’s the openhab ping you configured in your config.yml.
You can always check if the auth settings are correct by manually executing the get command in the browser: http://user:password@YOUR_OPENHAB_IP:8080/rest/things
I suggest you make that work first before trying anything else.
It’s still an auth issue - even if it’s not clear atm why.
I tried several times to renew the config and logging files.
(habapp) openhabian@openhabian:/opt/openhab/conf/habapp $ sudo systemctl status habapp.service
[sudo] password for openhabian:
● habapp.service - HABApp
Loaded: loaded (/etc/systemd/system/habapp.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2021-12-12 21:42:09 CET; 21h ago
Docs: https://habapp.readthedocs.io
Main PID: 780 (habapp)
Tasks: 11 (limit: 4454)
CGroup: /system.slice/habapp.service
└─780 /opt/habapp/bin/python3 /opt/habapp/bin/habapp -c /opt/openhab/conf/habapp
Dec 13 19:27:10 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:27:16 openhabian habapp[780]: Error loading logging config: Unable to configure handler 'EventFile'
Dec 13 19:27:16 openhabian habapp[780]: Executing <Handle <TaskWakeupMethWrapper object at 0xb3780d50>(<Future fini
Dec 13 19:27:20 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:27:30 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:27:40 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:27:50 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:28:00 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:28:10 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:28:20 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
lines 1-19/19 (END)...skipping...
● habapp.service - HABApp
Loaded: loaded (/etc/systemd/system/habapp.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2021-12-12 21:42:09 CET; 21h ago
Docs: https://habapp.readthedocs.io
Main PID: 780 (habapp)
Tasks: 11 (limit: 4454)
CGroup: /system.slice/habapp.service
└─780 /opt/habapp/bin/python3 /opt/habapp/bin/habapp -c /opt/openhab/conf/habapp
Dec 13 19:27:10 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:27:16 openhabian habapp[780]: Error loading logging config: Unable to configure handler 'EventFile'
Dec 13 19:27:16 openhabian habapp[780]: Executing <Handle <TaskWakeupMethWrapper object at 0xb3780d50>(<Future finis...events.py:396>) cr
Dec 13 19:27:20 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:27:30 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:27:40 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:27:50 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:28:00 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:28:10 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
Dec 13 19:28:20 openhabian habapp[780]: Status 404 for PUT http://localhost:8080/rest/items/HABApp_Ping/state/ NULL
~
Thats the latest try
(habapp) openhabian@openhabian:/opt/openhab/conf/habapp $ sudo systemctl restart habapp.service
(habapp) openhabian@openhabian:/opt/openhab/conf/habapp $ sudo systemctl status habapp.service
● habapp.service - HABApp
Loaded: loaded (/etc/systemd/system/habapp.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-12-13 19:32:46 CET; 1s ago
Docs: https://habapp.readthedocs.io
Main PID: 2930 (habapp)
Tasks: 7 (limit: 4454)
CGroup: /system.slice/habapp.service
└─2930 /opt/habapp/bin/python3 /opt/habapp/bin/habapp -c /opt/openhab/conf/habapp
Dec 13 19:32:47 openhabian habapp[2930]: self._context.run(self._callback, *self._args)
Dec 13 19:32:47 openhabian habapp[2930]: File "/opt/habapp/lib/python3.7/site-packages/HABApp/openhab/connection_handler/http_connectio
Dec 13 19:32:47 openhabian habapp[2930]: ON_CONNECTED()
Dec 13 19:32:47 openhabian habapp[2930]: File "/opt/habapp/lib/python3.7/site-packages/HABApp/openhab/connection_logic/_plugin.py", lin
Dec 13 19:32:47 openhabian habapp[2930]: p.on_connect()
Dec 13 19:32:47 openhabian habapp[2930]: File "/opt/habapp/lib/python3.7/site-packages/HABApp/openhab/connection_logic/_plugin.py", lin
Dec 13 19:32:47 openhabian habapp[2930]: self.fut = asyncio.create_task(self.on_connect_function())
Dec 13 19:32:47 openhabian habapp[2930]: File "/usr/lib/python3.7/asyncio/tasks.py", line 325, in create_task
Dec 13 19:32:47 openhabian habapp[2930]: return loop.create_task(coro)
Dec 13 19:32:47 openhabian habapp[2930]: concurrent.futures._base.CancelledError