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

Ambi dashboard view is missing a truthy case for displaying air_purity #7

Open
jhodapp opened this issue Feb 7, 2022 · 1 comment
Labels
bug Something isn't working frontend Any change related to the Ambi frontend good first issue Good for newcomers

Comments

@jhodapp
Copy link
Member

jhodapp commented Feb 7, 2022

If a client adds air_purity data that isn't in the literal form of "Dangerous Pollution" or something like that with the first letters uppercase and the others lowercase, it will fail to display and raises a runtime error where it's missing a truthy value for a cond statement.

E.g.
Screen Shot 2022-02-07 at 08 48 42

This should have a "else" clause that always handles the invalid case but can also handle any kind of upper/lower case scenario as discussed in this Elixir forum post.

Advanced fix to consider:

A better fix would be to make the air_purity levels be an enumerated type across the board, from the HW sensor (Edge), ambi_mock_client and to the Ambi web backend. So instead of using strings like "Dangerous Pollution" it would be a type AirPurity with type values:

  • NoPollution
  • LowPollution
  • MediumPollution
  • HighPollution

etc...

@jhodapp jhodapp added this to Ambi Feb 7, 2022
@jhodapp
Copy link
Member Author

jhodapp commented Feb 7, 2022

This change from @wumbabum fixes the immediate issue from the ambi_mock_client side but does not address this bug for Ambi specifically, so leaving this issue open still.

@jhodapp jhodapp moved this to Todo in Ambi Feb 12, 2022
@jhodapp jhodapp added bug Something isn't working good first issue Good for newcomers labels Feb 20, 2022
@jhodapp jhodapp added the frontend Any change related to the Ambi frontend label Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend Any change related to the Ambi frontend good first issue Good for newcomers
Projects
No open projects
Status: Todo
Development

No branches or pull requests

1 participant