Comments (37)
Hmm... I downloaded Opera and it was fine. I'll take a look at the refresh behaviour tomorrow morning. Odd.
from bom-weather-card.
I think now we have the expected result. Each number is displayed in the same way as on the HA core cards. Great work 👍
from bom-weather-card.
I don't believe I am controlling that in the card anywhere. What does HA show in dev-tools as the state? Is that formatted correctly? The card should have the same format as the state does.
from bom-weather-card.
I was thinking about this last night. Its probably html formatting like described here
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
I'm going to see if I can do this.
from bom-weather-card.
Entity states use .
as a decimal separator. Changing to ,
is a matter of formatting. Maybe you could add this as an option?
from bom-weather-card.
As per above I'll see if I can utilise the tolocalesrting in js to do this. I think I can read the locale from HA. I will need you to test this for your system when I get it in there. I may just do the visibility first so you can confirm I'm on the right track. It will be next week as I am going away for a few days.....
from bom-weather-card.
Thanks for your effort. You can count on me for testing. Unfortunately, I can't help with js
because I don't know it.
from bom-weather-card.
I can't help with
js
because I don't know it.
me either lol!! But stay tuned..
from bom-weather-card.
Can you try pulling the js file from master (in HACS set to master) and test if the visibility shows the correct number format - that is the only one I have tried so far.
Please let me know if this works for you
from bom-weather-card.
I'm 100% sure it works if I edit in the locale to the js however not sure if it will pick it up from the browser or if I have to create a variable to parse it to the js. I hopefully won't have to do that!
from bom-weather-card.
Docs in www seem to say we should be golden..
If this parameter is not provided, the toLocaleString() method will use the host environment's current locale.
It will revert back when it auto refreshes in around 30-60 seconds but I can totally fix that. I just don't want to screw around with more code till I know it will work. Then I will fix every other place it might occur as well....
from bom-weather-card.
It works for visibility
but not for humidity
. Both values in states use .
as decimal separator
from bom-weather-card.
Yeah like I said I was only trying to prove I worked it out and only did it for visibility! (After 30-60 seconds it will revert too) Now I know I worked it out I will roll it out for humidity etc as well. Stay tuned..
from bom-weather-card.
OK, so we have proof that your method works 👍
from bom-weather-card.
ok I did visibility, humidity, pressure, temperature (in case you display decimals)
Please confirm it's working for you. The 30 second refresh is also resolved now (I hope) too...
Let me know and I'll draft a new release.....
from bom-weather-card.
Everything seems to be working well 👍
Thanks for your great work.
from bom-weather-card.
Excellent. My pressure has a comma in it now... I wonder why yours doesn't?
from bom-weather-card.
Because the state has no decimal numbers
from bom-weather-card.
No, the reason has to be different, I used an entity with decimal numbers and the card shows a rounded value
from bom-weather-card.
Interesting. My attributes are same as yours and mine is rounded to zero decimals as well but I get a comma as the thousands separator. Has to be something locale related.. I don't see why else it would do it. Is it convention there to only show a thousands sep if there is more than one digit before? (So >9999)? I dunno....
from bom-weather-card.
I added show_decimals: true
to the card configuration and pressure still hasn't decimals numbers 😊
from bom-weather-card.
Ok I wonder if it's a cache issue... In chrome can you open dev-tools (F12) and right click refresh and select Empty Cache and Hard Reload? Although I get the humidity changed ..... grasping straws..
from bom-weather-card.
Also.... thanks for proving I made it work for Temperature as well..
from bom-weather-card.
I always reload the page without the cache when changing the card via SHIFT+F5 (Opera), via CTRL+R from dev tools effect is the same.
from bom-weather-card.
Precip intensity still uses .
as decimal separator.
entity_pop_intensity: sensor.dom_precipitation
from bom-weather-card.
ok I fixed intensity. Published 0.85a as a pre release. Please test and let me know.
from bom-weather-card.
also can you give me your language/locality code so I can see if I can see whats up with the pressure. (mine is en-AU so it's language-region). With chrome the only way to do a full clear cache and hard reload is using the method I describe - there is no keyboard shortcut. Also maybe can you try chrome or another browser if you have it? I'm just perplexed!
from bom-weather-card.
also can you give me your language/locality code
pl-PL
With chrome the only way to do a full clear cache and hard reload is using the method I describe
I'm using Opera 72 on Windows/Debian/Android. I also tested on Edge.
With 0.85a pop intensity uses ,
as decimal separator but only for 30-40 seconds and than .
comes back. The same behavior regardless of the browser used.
from bom-weather-card.
Can you try 0.85b to fix refresh and let me know please?
from bom-weather-card.
And I didn't update to 0.85b in the console so it will still say a instead of b. Grrrrrr
from bom-weather-card.
Refresh is fixed, I have ,
all the time.
from bom-weather-card.
Well that's good! I'm going to check if I missed anything else tomorrow and I'll make a new release. Will also hard-code for your locale and see what I sss in my browser as I don't understand why that is not giving the expected result.
from bom-weather-card.
Except for pressure I assume....
Also so you know this has nothing to do with the HA PR you referenced.. this is purely js using the configured locale on your computer..
from bom-weather-card.
It seems that the thousands separator is not used for pl-PL
And here we have value rounding https://github.com/DavidFW1960/bom-weather-card/blob/master/bom-weather-card.js#L441
IMO, everything is fine now, at least for pl-PL.
from bom-weather-card.
I'm going to hard code pl-PL today and see what it does here...
from bom-weather-card.
You can keep your weather too BTW lol
from bom-weather-card.
Can confirm the pl-PL doesn't show the thousands separator as you said so I agree all is well with this now. I don't think I missed anything else and I just bumped to version 0.85c and released.
Thanks for the suggestion and assistance in debugging.
from bom-weather-card.
Related Issues (20)
- Ability to make certain sensors come from different providers? HOT 2
- when unpkg.com is misbehaving, the bom card won't render. HOT 4
- Daytime_high and daytime_low display values differently HOT 10
- Increase overall scaling HOT 1
- Authenticated depreciated HOT 1
- Installation procedure problem HOT 3
- BOM Integration HOT 3
- How do i configure another weather provider than BOM? HOT 1
- Display Location Title HOT 1
- Clarification of directory structures for manual install in readme HOT 3
- Custom element doesn't exist: bom-weather-card. HOT 2
- BOM Radar Card HOT 1
- UV_summary not displaying HOT 3
- Sunrise / sunset icons incorrect after data update HOT 3
- BOM forecast weird indentation HOT 4
- Commit #85 does not allow UoM from entity HOT 14
- Layout Broken and/or new version not detected? HOT 22
- Average calculation failing for today_temp_bom HOT 3
- Card doesn't work well with HA 2022.6.x HOT 9
- bom_today_max and bom_today_min template sensors HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bom-weather-card.