-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Temperature displays as -0 instead of 0 when rounding is enabled #74
Comments
That's pretty weird- it's just a "round(x)" statement in the code, so no idea why it would add in a negative sign. My best guess it's something intrinsic to Python, since other people seem to have encountered it before: https://stackoverflow.com/questions/11010683/how-to-have-negative-zero-always-formatted-as-positive-zero-in-a-python-string. I'll throw a "+0" in there following the suggestion in that post in the next update, and hopefully that clears this up! |
I've rain into this issue before when creating my own custom display for OpenWeatherMap for a website a while back. I ended up checking if the temperature is between -0.5 and 0 in which case I set the temperature to zero. I found the code from the repo we were working in and this is how I solved the issue in JSP <c:when test="${weather.weatherTemp gt -0.5 and weather.weatherTemp lt 0 }">
<!-- To prevent -0 from showing as the current tempreature -->
0°C
</c:when> |
I think it must be HA thing, since the values are calculated the same way on the integration end of things. I've corrected this issue in the next integration release, so I'll leave this issue open until that goes out for reference. |
The high temp missing must be an issue with the built in card. I've installed a custom one and it displays 0 as the high temp on the card itself. |
I'm trying to setup Precipitation Probability in the weather card and I get this error and they all show as ---%
I'm guessing the integration does not have this setup as I had to add a sensor to show the probability for the current day forecast. Also if the next day is not forecasting any precipitation accumulation then I get a similar error and it shows ---mm. Can you add in the precipitation probability and if there's no accumulation forecasted then set it to 0 to fix these issues? |
@alexander0042 Any updates here? I haven't seen an update for the integration released and am wondering when that is supposed to release. Also if the issue I mentioned in my last comment could get looked at and fixed that would be awesome. 🙂 |
Hi, Thanks for tagging me with the reminder here! Since I've been working on the API side of things, this was moved to the back burner for a couple weeks, but haven't forgotten about it. This is a larger question than I realized- I'm guessing you're using a manual weather card, and want precipitation probability as the "Secondary Info Attribute", using the card described here: https://www.home-assistant.io/dashboards/weather-forecast/? Are you defining it via yaml, or the UI somehow? |
At first I was using the built in Weather Card but I have since switched to using the Platinum Weather Card. So do I need to define that info attribute on somewhere on the built-in weather card for it to work or do I need to do something else? I'm pretty new to the HA stuff so if you could point me in the correct direction that would be great. Any chance of looking at the precipitation accumulation issue as well? Just defaulting it to 0 would solve the issue that comes up from time to time. |
I'm also far from an expert at HA, so we'll muddle through this together! I think I've worked out what your question is here- it works when I use it as a sensor, but it's not one of the "weather" attributes. I think this should be easy to add, since the data is already there, so testing it now. |
Ok, got it in the weather entity, and corrected the lines issue. I'm a little bit worried that this might break a workflow somewhere, since the way Dark Sky was doing it was returning "None". However, I agree that the lines are weird, and I imagine it would be easier for people to program automation with a zero instead of missing, so I'm going to change it and see if anyone notices. Let me know if you'd like any other parameters added to the weather entity. It's pretty light at the moment, and I can't think of why adding additional things in would hurt. |
That is correct it wasn't part of the weather entity so it was giving a warning about it not existing but glad to see it was added. As long as the change from None to 0 is added in the changelog then it shouldn't be too much of an issue? Though people tend to not read the changelog so you could still get some issues popping up. I can't think of anything else to be added to the weather entity since you can always create sensors as needed to fill in any missing gaps that the entity does not provide. |
Ok, release (v1.1.0) is live! Thank you again for all your help with this, and we are hopefully good to close! |
This is fixed. Thanks! |
I've noticed that when you have rounding selected and when the temperature is below freezing and close enough to zero to get rounded up to zero it displays as -0 instead of 0 as seen in the screenshot below.
The text was updated successfully, but these errors were encountered: