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

The battery level return value is incorrect #3

Open
VF7777 opened this issue Sep 16, 2017 · 2 comments
Open

The battery level return value is incorrect #3

VF7777 opened this issue Sep 16, 2017 · 2 comments

Comments

@VF7777
Copy link

VF7777 commented Sep 16, 2017

Hi,
When I send command 'device_subscribe bat ON' to get battery level, it always returns the value 1 or 0.01,
I tested servel hours.

Thank you

@hyorkim11
Copy link

can you provide relevant code?

@Aeefire
Copy link

Aeefire commented Sep 20, 2017

I can confirm the issue. I also do only get 1 or 0.01 every now and then.

Unfortunately I can't share the code with you and don't have time to prepare a minimal sample. But what I am doing is simply splitting responses by "\r\n" to retrieve a single data set, then split this line by empty spaces to receive the parts of a response, then take the third element (i.e. the actual value) and parse a double using
bool parseSuccess = Double.TryParse(valueString, NumberStyles.Number, CultureInfo.CreateSpecificCulture(HostCulture), out value);

Whereas HostCulture is either "en-US" or "de-DE", depending on the host culture I am using.

This worked for most data sets.

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

3 participants