Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Almond device value conversion to homebridge #3

Open
pablopoo opened this issue Sep 6, 2017 · 4 comments
Open

Almond device value conversion to homebridge #3

pablopoo opened this issue Sep 6, 2017 · 4 comments

Comments

@pablopoo
Copy link
Collaborator

pablopoo commented Sep 6, 2017

There are 2 instances where the almond device value for a switch property fails to sync with homebridge.

  1. The first time homebridge load
  2. After a device is updated.

This makes the home app to not get the real device value when it refresh the device state (after the home app is in background state).

Found one line where the almond value is not converted from string and another line where conversion from true/false to 1/0 is wrong.

I will share my findings and solution after I tested it.

@jedimdan
Copy link
Collaborator

jedimdan commented Mar 6, 2018

How's your attempt to find a solution? I'm keen to try and fix this too.

@pablopoo
Copy link
Collaborator Author

pablopoo commented Mar 6, 2018

The first one, I think was a bug in the code, I don't have that behaviour anymore on my fork.

The second one, I found that the hombridge plugin won't try to reconnect if, for example, I reboot the almond, until I do something on the homekit app (like turning a light on, that force a reconnect). This one is not completely solved right now on my fork. I think it need a reconnection mechanism to try indefinitely until can reach the almond again.

@jedimdan
Copy link
Collaborator

jedimdan commented Mar 6, 2018

Found one line where the almond value is not converted from string and another line where conversion from true/false to 1/0 is wrong.

@pablopoo are you referring to this, this and this?

I'm proposing to changing them all to

if(typeof state != 'boolean') {
    state = state == 'true';
}

What do you think?

@jedimdan
Copy link
Collaborator

jedimdan commented Mar 6, 2018

The first one, I think was a bug in the code, I don't have that behaviour anymore on my fork.

The second one, I found that the hombridge plugin won't try to reconnect if, for example, I reboot the almond, until I do something on the homekit app (like turning a light on, that force a reconnect). This one is not completely solved right now on my fork. I think it need a reconnection mechanism to try indefinitely until can reach the almond again.

Ah okay. This part I'm quite clueless about right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants