Samsung S21 & Openhab remote not working correctly

Just got a new phone transferred all my apps over to new phone and it would not connect remotely or via local to 2.4 versions. Tried multiple combinations. Wife’s android would connect however. Eventually went as far as upgrading to openhab 3 however now everything is broke.

I was able to get the sitemap migrated and most all of my items and things from 2.4 to 3. I can get the app to load the local site but can not seem to get the remote connection to work.

Can some please make a walk through of how to setup the openhab 3 for the remote connection on the app to work. I see a online status when I log into the myopenhab site. however I get a Authentication failed (http 401 error). This was easy to setup in the 2.4 versions can someone spend a few days and fix this to be easy. This shouldn’t have to be this frustrating to get a remote cloud connection to work. Seems like it should be easy to setup some kind of 2 factor authentication that would allow the apt to connect with the particular details for the users install.

I’ve spent 4 days trying to figure out why this wont work. And have not made headway. I’m tempted to roll back to a 2.4 version and fight with that to see if I can at least get it working again.

Thanks.

The openHAB Cloud Server works pretty much exactly the same for OH 2.x and 3.x so what ever problem you experienced before is probably the root of any of your problems now. Using the cloud server and cloud connector is exactly as easy as it was in OH 2 as far as I know. You put in the user name and password for the myopenhab.org account under the remote settings in the app and you are done. There are no additional steps if you want to use BasicUI. There are some extra steps to make the Andorid App use MainUI instead of BasicUI by default but you are not looking for that.

There is an alternative way to authenticate with OH 3 but you would have had to change some settings to enable that. In MainUI follow openHAB API tokens | openHAB to generate an API token. You can then use that as the username without a password for local connections. But you are having problems with the remote connection and the API token doesn’t work with the cloud connector, just connecting to OH directly.

The only think I can imagine might cause a problem settings wise would be if you disabled the Implicit User Role in MainUI under Settings → API Security → Advanced. That would lock down the OH REST API to only work with authenticated users which would break BasicUI. But the default is to have that enabled and BasicUI should work when it’s enabled.

So ultimately all I could guess is that there is a problem with your specific phone (since it appears to work on your wife’s phone) and what ever that problem is is unrelated to the version of OH running.

For security reasons the user name and password for local and remote connections isn’t included in the backup and therefore won’t be migrated to the new phone.
Please make sure you have the exact same credentials filled in than before. This should resolve http error 401.

1 Like

I have tried the same log in nothing works going to wipe the pi and start fresh. Maybe 10th times the one. Idk just seems like something is off with the app or openhab3. Just kind of frustrating that it’s working fine on older phone and then new phone and all of a sudden lots of issues. I’ll have to go through all the setup docs again to setup a full install of the Pi. Wish it was a little more automated to install all the default settings and get everything up and running a little more simply. I also wish they had the rasbian install pre-loaded with the openhab system. I find it easier to work with having the pi OS and then VPN into the machine.

Thanks I’ll update if I get it working.

If it works fine with the old phone but not the new phone, I’d have zero expectation that blowing away the entire OH install is going to make any difference in the end. The problem is going to be something unique about that new phone. That means either there is:

  • a bug in the app
  • a missconfiguration
  • a bug in the Cloud Server
  • a bug in the cloud Connector add-on.

Those are where you need to focus your attentions. The actual OH server is working as evidenced by the fact that everything works fine on the old phone.

Something like openHABian | openHAB perhaps?

Have you tried the beta version of the app? Or the non-Google Play version that you can download from GitHub? The log in the Android app might also give you a hint as to what the issue is.

As Rich said, if your phone won’t connect to Myopenhab.org, then it’s hard to imagine how your openHAB server is the problem.

Okay guys after several hours of updates and restarts and getting Openhab back online here’s the outcome.

Wife’s phone - Connects on Local wifi after accepting SSL certs. & On mobile Data (Wifi turned off) But doesn’t show as devices in the myopenhab.org site.

Old Phone - Connects on local wifi after accepting SSL certs / However can no longer test Mobile as sim is in active. (Did show on devices tab on myopenhab.org site)

New Phone - Connects on Local wifi after accepting SSL certs. / Will not connect over Mobile data (wifi turned off)

Tried Master login for myopenhab.org - Also tried a new user account to mirror wifes account. neither worked. I also tried https://myopenhab.org & https://myopenhab.org:443/

when I turn on extended error log this is what I get trying to log into app on mobile data only (No Wifi)

Authentication failed. Please check the configured username and password
respectively the provided ssl client certificate (http code 401).
url:https://myopenhab.org/rest/
exception stack:
org.openhab.habdroid.util.httpclient$httpexception:unauthorized

Hope this can point you guys in what is going on to help get this sorted out. Sorry being frustrated just stressful changing phones and trying to get everything working on something new from something you’ve had for 5 years and know.

I hear you on being frustrated. It’s just important to keep an open mind when troubleshooting. That’s hard when we convince ourselves that something isn’t the source of the problem.

I can’t help you much, but I wonder why the log shows https// without the colon.

url:https//myopenhab.org/rest/

Shouldn’t this be:

url:https://myopenhab.org/rest/

Yep missed the “:”

So, did that fix it?

It’s correct in the app. Just mistyped the error here. And no it doesn’t fix the Samsung issue. I don’t have any idea how to fix this issue.

Okay so after scrolling a bunch of of topics on the subject I found the issue. In the user name email *** DO NOT USE AUTO-COMPLETE*** Their was a extra space on the end of my email. Openhab couldn’t authenticate the email with the additional space. If you are having issues logging in please check that you don’t have a extra space on your email.

Thanks

I recommend filing an issue on the Android app. The value entered there can automatically trim trailing white space. I don’t think any authentication system allows trailing white space in a user name and it’s certainly not allowed in an email address. So I think this problem can be avoided in the app itself.

Thanks for reporting back!

I didn’t find a source saying this is true for HTTP basic authentication and therefore the input isn’t trimmed. However it shows a warning directly under text field: “The last character is a whitespace, which is probably unwanted”

@Michilson Is there any warning shown for you?

My interpretation of the grammar in RFC7613 implies a space at the end of a username is not allowed.

The syntax for a username is defined as follows, using the Augmented
Backus-Naur Form (ABNF) [RFC5234].

      username   = userpart *(1*SP userpart)
      userpart   = 1*(idbyte)
                   ;
                   ; an "idbyte" is a byte used to represent a
                   ; UTF-8 encoded Unicode code point that can be
                   ; contained in a string that conforms to the
                   ; PRECIS IdentifierClass
                   ;

I interpret that to mean userpart with the option to follow it by zero or more optional pairs of one space followed by one userpart. Though I suppose a space could be an idbyte and included in the userpart but I don’t see how the grammar could work in that case.

RFC7617, the RCF for BasicAuth refers to RFC7613 for defining the characters allowed in the user-id with the addition of : which is also not allowed in user-id for BasicAuth.

But as with lots of the RFCs, there is room for interpretation. But I recently had to go through these RFCs for work so they are fresh in my mind.

1 Like

Thanks for looking this up. I guess even if it would be possible, probably nobody uses a whitespace at the end of a username or password.

1 Like