bspranger / Xiaomi

my Xiaomi Device Handlers for Smartthings
Apache License 2.0
520 stars 1.36k forks source link

Original Xioami Button always pushed IOS #64

Closed joelw135 closed 6 years ago

joelw135 commented 6 years ago

Would you please look at the problem with the Original button where it shows always pushed. It works with the original code on the other thread. 0d44ec2d36876119694c3a1ef46d197feadf874e_1_281x499

alecm commented 6 years ago

Hiya - I just finally paired my old (original) Xiaomi - using iOS. I notice that when I have it set to momentary - it will occasionally hang on pushed if I'm pushing it a lot and fast. Most of the time it's fine though (switches back to released). If I have it set to toggle - if I press it it stays pushed, if I press it again it goes to release, and on and on - but that's kind of what I'd expect for a toggle, no (two states?).

joelw135 commented 6 years ago

Mine when set to toggle always stays pushed, and if pressed does nothing. I just tried it in momentary, and does the same thing. Nothing.. The one from the other developer works. But Brian's battery and advanced setting are much better. I hope it can be fixed.

alecm commented 6 years ago

Wow - that's a bummer! When on toggle my original button stays on 'pushed' until I press it (the physical switch, not the app) and then it releases. Wonder what the difference could be? (I'm also on iOS)

On Mon, Jan 29, 2018 at 4:59 PM, joelw135 notifications@github.com wrote:

Mine when set to toggle always stays pushed, and if pressed does nothing.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bspranger/Xiaomi/issues/64#issuecomment-361401365, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5P19yu8sT6WYnORPcXEAoqK7kLfIIXks5tPj9fgaJpZM4RwiIp .

-- Alec McLure, MPH, RHIA, CCS-P Cell: +1 401-663-1316 Email: alecdjm@gmail.com

joelw135 commented 6 years ago

I just tried again. Changed to the DTH the button says pushed, went to the physical button pressed it and the lights went on but the button for the DTH stays pushed. Only thing that changes is the last push shows on the right of the battery. Not very convenient, as I sometimes turn on that group form the DTH. I think something happened to the code when transferred from the original DTH.

tmleafs commented 6 years ago

can anyone test the pull #65 it fixes the virtual button but the button will always say push instead.

I don't personally care about the released stuff, I have removed all of that from my modified code my "private Map parseCustomMessage" look like this. seems to make the button more reliable and just scrap the held part of the buttons

private Map parseCustomMessage(String description) { def result = [:] if (description?.startsWith('on/off: ')) { if (description == 'on/off: 0'){ result = getContactResult("pushed") } return result } }

joelw135 commented 6 years ago

@tmleafs If you tell me where exactly to place this in the code, I will gladly test this.

tmleafs commented 6 years ago

well the true fix is just add this

capability "Momentary"

to the capabilities the rest of the pull request is fixing other bugs and things that annoy me

joelw135 commented 6 years ago

@tmleafs I don't see where in the code. Give me a hint.

tmleafs commented 6 years ago

where is says

capability "Sensor" capability "Refresh"

And this after

capability "Momentary"

joelw135 commented 6 years ago

@tmleafs I found it, put it in but still stays pushed unless you got to the device itself and press it. It should work just from the DTH in the app.

tmleafs commented 6 years ago

it will say pushed but pressing it will work

joelw135 commented 6 years ago

OK, so no way to get it to say released, unless you do it from the physical button.

joelw135 commented 6 years ago

There has to be a more elegant way. If it works in @a4refillpad DTH why can't we make it work in this?

tmleafs commented 6 years ago

I have sorted it the latest pull request matches smartthings standards of a momentary button https://github.com/SmartThingsCommunity/SmartThingsPublic/blob/master/devicetypes/smartthings/momentary-button-tile.src/momentary-button-tile.groovy

joelw135 commented 6 years ago

@tmleafs OK Steve, then if Brian or one of the other developers writes the momentary code into the DTH for the button it should work? Is that correct?

tmleafs commented 6 years ago

you happy with this? https://www.youtube.com/watch?v=S8AnemCGfH4

joelw135 commented 6 years ago

@tmleafs Of course, as that is how it should work. I am a perfectionist, and if something isn't correct, I am like a dog with a bone.

bspranger commented 6 years ago

I merged the changes

joelw135 commented 6 years ago

Thank you Steve & Brian, nice seeing it working as it should. I am elated.

bspranger commented 6 years ago

Fixed