openhab / openhab-android

openHAB client for Android
https://play.google.com/store/apps/details?id=org.openhab.habdroid
Eclipse Public License 2.0
606 stars 314 forks source link

special rollershutter switch not rendered correct #219

Closed jupe76 closed 8 years ago

jupe76 commented 8 years ago

When a "Rollershutter" item is defined under items and referenced as switch in the sitemap, the OH2 Classic UI and Basic UI do render it as special rollershutter switch. This switch has up / down and stop buttons.

Until recently the rollershutter-switch was rendered like this also in habdroid. In the latest nightly builds (ie. #462) the rollershutter-switch is rendered as ordinary on-off switch. It cant be used to operate the rollershutters any longer.

See the screenshot under https://community.openhab.org/t/rolleshutter-broken-since-latest-snapshot/13519/5?u=peter_juenger

kaikreuzer commented 8 years ago

Thanks for entering the issue.

I have investigated what might have changed and I tracked it down to this recent change in ESH, which actually fixed a bug in the REST API, which was there since a looooong time.

The effect is that the REST API used to provide:

{
                        "widgetId": "FF_Bath_3",
                        "type": "Switch",
                        "label": "Bath",
                        "icon": "rollershutter",
                        "mappings": [],
                        "item": {
                          "link": "http://demo.openhab.org:8080/rest/items/Shutter_FF_Bath",
                          "state": "0",
                          "type": "RollershutterItem",
                          "name": "Shutter_FF_Bath",
                          "label": "Bath",
                          "tags": [],
                          "groupNames": [
                            "FF_Bath",
                            "Shutters"
                          ]
                        }

and now provides

{
                        "widgetId": "FF_Bath_3",
                        "type": "Switch",
                        "label": "Bath",
                        "icon": "rollershutter",
                        "mappings": [],
                        "item": {
                          "link": "http://demo.openhab.org:8080/rest/items/Shutter_FF_Bath",
                          "state": "0",
                          "type": "Rollershutter",
                          "name": "Shutter_FF_Bath",
                          "label": "Bath",
                          "tags": [],
                          "groupNames": [
                            "FF_Bath",
                            "Shutters"
                          ]
                        }

instead (note the "RollershutterItem" vs "Rollershutter").

I wouldn't want to revert this fix, so I'd rather suggest that HABDroid (as well as the iOS app, I guess) are adapted.

@digitaldan Could you easily fix the handling in the apps (they probably should just be indifferent to whether the "Item" suffix is there or not)?

kaikreuzer commented 8 years ago

iOS equivalent entered at https://github.com/openhab/openhab.ios/issues/85.

digitaldan commented 8 years ago

There are new unsigned packages at https://openhab.ci.cloudbees.com/job/HABDroid/lastSuccessfulBuild/artifact/mobile/build/outputs/apk/ if all tests well I will plan a release for Monday.

kaikreuzer commented 8 years ago

I won't be able to test it before tonight. @jupe76 Could you install the new build and confirm that it fixes the issue?

jupe76 commented 8 years ago

Hi,

sorry for being late :-)

Unfortunately I can't confirm that it works as intended.

1.)I tried to install mobile-release-unsigned.apk on two different devices (Nexus 5 with android 6 and Nexus 5X with android 7), result was "parsing package error" from the installer. The error comes up as well from the direct download as from the apk in the zip-file.

2.) I was able to install mobile-debug.apk and mobile-debug-unaligned.apk. The app works, but if I enter the frame with the "rollershutter-switch" the app is halted.

I'll try to get a grip on the log, will post it if I'm successful.

Peter

jupe76 commented 8 years ago

Not sure if that will help:

`09-12 21:04:40.196 9900 9900 E AndroidRuntime: FATAL EXCEPTION: main 09-12 21:04:40.196 9900 9900 E AndroidRuntime: Process: org.openhab.habdroid, PID: 9900 09-12 21:04:40.196 9900 9900 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference 09-12 21:04:40.196 9900 9900 E AndroidRuntime: at org.openhab.habdroid.ui.OpenHABWidgetAdapter.getItemViewType(OpenHABWidgetAdapter.java:711 09-12 21:04:40.196 9900 9900 E AndroidRuntime: at org.openhab.habdroid.ui.OpenHABWidgetAdapter.getView(OpenHABWidgetAdapter.java:681) 09-12 21:04:40.196 9900 9900 E AndroidRuntime: at android.widget.AbsListView.obtainView(AbsListView.java:2360)

digitaldan commented 8 years ago

Yep , this is my bad, I'll push out another fix soon, thanks .

jupe76 commented 8 years ago

Hi @digitaldan , I can confirm that the problem with the rollershutter switch is fixed now with the commits above. It's rendered as it should now, everything works fine. Thanks!

christophhaase commented 8 years ago

@digitaldan Thanks for quick fix. Is it possible that you upload the fixed version to Playstore?

Thanks!

digitaldan commented 8 years ago

Hi sorry for the delay! I am planning on preparing a release this weekend, thanks for the reminder ;-)

lutzb91 commented 8 years ago

Already found some time for the release? :-) Still nothing in my play store...

digitaldan commented 8 years ago

Thanks for the reminder ;-) I was waiting to get another PR in, but its not a good enough reason to hold it. I will try and get it released today.

digitaldan commented 8 years ago

Android and IOS apps have been released, thanks.

jupe76 commented 8 years ago

@digitaldan YMMD, Thanks!