-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Netatmo wind sensor probably not parsed correctly #15
Comments
You're correct, only degrees or abbreviation is possible at the moment (as stated in the README). I can parse for the numbers and only use those, so I'll change this to an enhancement. |
Thank you! As a C programmer that triple equal sign gave me a heart attack, but it seems I‘ve just discovered one of the wonders of javascript :) I’ll test your edit on monday, when I have a little time ! Ps: I love the design of your compass card, it’s a strange thing that we don’t have it natively in Homeassistant. Thank you for this magnificent work! |
I think I got it, a input_text entity helps a lot with testing this as you can set it to whatever you want. One note though, currently all characters which are not numbers or dots are removed from the entity state. If the state is something like My RegEx-fu is not strong enough yet (or my google skills fail me) at only getting the first number sequence in the string and only use that. Workaround in all not supported cases would be
|
If you can use a regex, you could try with something like this:
This should get you just the first time you find at least 1 number, maximum 3, and no other number, if any, afterwards. I'm not a regex expert, but I've tried it and it seems to get the result we want :) |
Better direction detection in Netatmo sensor state (only use first group of numbers for direction)
I updated the regex a bit, your propsal inspired me to have a second look. First I replace all the whitespaces now, so any negative sign in front of the number would have a space removed if it was in between. Note, I'll put this in the next version (0.2.1, or 0.3.0, depending on the other changes in the next version) |
Checklist:
Release with the issue:
not relevant
Last working release (if known):
Browser and Operating System:
safari,chrome, homeassistant app, MacOs
Description of problem:
I have a Netatmo wind sensor, but the default HA integration provides the information with both text and degrees, for example like
W (240°)
, as shown in picture.I think that there's a problem for the compass-card to parse this kind of information as, I assume, it expects just one of the two information and not both.
As you can see, it does not crash or anything, but obviously the arrow does not point in the correct direction!
![image](https://user-images.githubusercontent.com/3541957/90120544-2625df00-dd5b-11ea-9f5c-811edd93e425.png)
For reference, this is the code that generates this card:I'm not fluent in javascript nor python, but i think that the problem could just be that the code just checks if the value given is NaN and does not search for a number in the string, to be parsed.
Javascript errors shown in the web inspector (if applicable):
Additional information:
If needed, I can do some testing.
The text was updated successfully, but these errors were encountered: