openhab / openhab-pebble

Pebble client for openHAB
Apache License 2.0
11 stars 20 forks source link

Fixes for openHAB 2 & new Pebble firmware #37

Closed ghys closed 7 years ago

ghys commented 7 years ago

Signed-off-by: Yannick Schaus habpanel@schaus.net

kaikreuzer commented 7 years ago

@llamahunter Just for our information: Are you still actively maintaining this repository? I haven't seen much activity over the past months, so I want to make sure that this PR is being looked at by someone.

llamahunter commented 7 years ago

Sorry.. must have missed the PR email. There hasn't been much need for activity on the project for a while, and I don't fiddle with the code when it's basically working, for me, at least.

I'm a bit busy the next few days, but I can take a look at this PR this weekend.

kaikreuzer commented 7 years ago

Ok, good to know that you are still with us, no urgency on the PR, leave your time.

There hasn't been much need for activity on the project for a while

Well, in this case you should consider to close/answer the open issues :-)

llamahunter commented 7 years ago

The open issues seem like minor inconveniences at the moment. Some of them are related to OH2, which, in my experience, still seems sort of 'early beta' quality, and so I've been holding off on upgrading my home install to it until it matures.

kaikreuzer commented 7 years ago

Some of them are related to OH2, which, in my experience, still seems sort of 'early beta' quality

This is a false impression, many people use it already productively and it is close to becoming the official release (planned for early next year). So it is definitely time to get the Pebble app ready to work well with OH2!

ghys commented 7 years ago

I'd like to point out that switches, dimmers, setpoints are broken at the moment for those running the latest stable openHAB 2 beta4 - the item types lost their 'Item' suffix (e.g. 'SwitchItem'>'Switch') as reported by the REST API some time in August. This is the main issue addressed in this PR :)

llamahunter commented 7 years ago

Alrighty. I'll give OH2 another go and verify this PR with it this weekend.

llamahunter commented 7 years ago

Finally got my system updated to openhab 2.0 (took a lot of time, and still not everything works yet). Anyway, when I try this change, it fails due to the startsWith() method not existing.

[PHONE] pebble-app.js:?: JS: openHAB: October 30, 2016 at 9:47:07 PM PDT: widget.item.type = Switch [PHONE] pebble-app.js:?: JS: openHAB: JavaScript Error: TypeError: undefined is not a function (evaluating 'widget.item.type.startsWith('Switch')') at page.js:192:42 at emitToHandlers (lib/emitter.js:121:21) at emit (lib/emitter.js:145:35) at _emit (ui/window.js:282:16) at emit (ui/window.js:294:22) at emitSelect (ui/menu.js:378:16) at onPacket (ui/simply-pebble.js:1465:22) at onAppMessage (ui/simply-pebble.js:1491:26)

Are you using iOS or Android? I've seen differences in the past between what javascript functions are available to the pebble scripts.

llamahunter commented 7 years ago

I found this shim for String.prototype.startsWith() that seems to work. It's MIT licensed, so that should be ok to include in the openhab.pebble distribution, I think.

https://github.com/mathiasbynens/String.prototype.startsWith

I dropped the contents into a new file 'startswith.js' and then in page.js added a require('startswith')

ghys commented 7 years ago

Oh, bummer. Sorry about this - those can be replaced rather safely with indexOf(...) == 0 as an alternative if you don't want to include the shim. Your call.

digitaldan commented 7 years ago

@ghys @llamahunter is this ready to be merged and pushed to the store?

ghys commented 7 years ago

@digitaldan @llamahunter the above commit is likely to fix the iOS issue. I'm only able to test it on Android and I saw no regression there.

llamahunter commented 7 years ago

Thx for the updated pull request. Unfortunately, I'm out of the country for a few weeks. As soon as I'm back in town, I'll test this on iOS and push up a new build to the store.

joeduck commented 7 years ago

Hi, it would be great if this will work with oh2. Very useful links app. It's much easier as with tasker :-)

kaikreuzer commented 7 years ago

@llamahunter Are you back in town by now? It would be fantastic if you could push a OH2 compatible version to the store - note that OH2 is going to be released next weekend!

llamahunter commented 7 years ago

Thx. I verified your pull on iOS and merged it. I made a new release v1.6 and posted it on github. Unfortunately, I've lost access to the pebble@openhab.org address and pebbledev account, so I'm not able to push the new release to the app store at the moment. Waiting on @kaikreuzer for that.

Also, I'm looking for a new maintainer of this repo, as I'm no longer an active pebble user as of last month's sad news. http://arstechnica.com/gadgets/2016/12/pebble-confirms-fitbit-sale-hardware-is-dead-software-in-maintenance-mode/

kaikreuzer commented 7 years ago

Thanks, @llamahunter, I just published it: https://apps.getpebble.com/en_US/application/5542604d45bf334314000098?query=openhab&section=watchapps

I'm no longer an active pebble use

That's a pity, but anyhow a big thanks for all the work you have put into it in the past! I will try to stay with it until the last minute, but I am afraid that I won't be an adequate maintainer... Maybe @ghys feels a bit bored in the minutes when he isn't working on HABPanel? ;-)

joeduck commented 7 years ago

Hello. Many many thanks from my side. Great work. Now the switches works. 2 hours from my post to the fixed version. Again. Many thanks.

I hope my kickstarter pebble will work for again 2 or 3 years

ghys commented 7 years ago

Maybe @ghys feels a bit bored in the minutes when he isn't working on HABPanel? ;-)

I still use this app daily, perhaps as much as HABPanel actually 😉 and I have a few Pebble apps under my belt so I don't mind taking over - it's doing the job nicely alraedy I don't expect huge amounts of work maintaining it anyways.

Obligatory huge thanks to @llamahunter for building this in the first place!

llamahunter commented 7 years ago

As well as @trusk89 for the initial inspiration. And the openHAB team for making an open source, open API home automation platform!

alexbartisro commented 7 years ago

Awesome job everyone! Glad it helped and sad to see pebble go down.

I personally switched to garmin last summer, so maybe I'll give that a try :)

kaikreuzer commented 7 years ago

so I don't mind taking over

You're incredible, @ghys, glad to have you in the team 👍