Comments (14)
Oh, yeah. I agree, if keeping the override then your suggested flow
I think the best option would be to use the override first, if that is not define then use the sensor units and if that is also not defined then drop back to the current silly way.
is a good path to ease any transitions while keeping the most open to the various weather integrations.
from bom-weather-card.
Updated: I see the config variable for show_decimals_pressure. That'll fix the rounding. Mea culpa. Read the source, Luke...
However what is the thinking behind a config variable for the UoM of the pressure entity? Wouldn't it make more sense to let the integration being used to feed the card specify the UoM for its measurements and have that flow thru to the card. Right now I see that I can set config.pressure_units as a way to hard code the UoM. More work for the end user and a possibility for a disconnect between the config file and the integration feeding the card. Thoughts?
In my humble thinking, it would make sense for the integration to specify the UoM for its entities and the card to honor them as they stand. I don't see how that would cause a problem for any source integration. And given that the typical deployment of the card there is a template mapping of from the Integration into the card entities the user can adapt the source units there if they must change them to a local unit that the weather integration does not provide natively. Why not take the complexity out of the card by letting the units flow thru?
from bom-weather-card.
Yeah it's a bloody breaking change.. If you don't configure this at all it will use the configured units to set the UoM just like it always used to do. The pressure in BoM for instance is unitless even though the unit is an attribute it's not linked to the state of the entity a all and is not parsed to the card.
The reason for this change is people in the US for instance use in/Hg as the unit and with imperial it was defaulting to something else. It's really just an override.
I understand your sentiment however NONE of the integrations include the unit in the state so somehow that would need to be read from an attribute. (another template sensor or the like) This is generally not required as the length units (metric or imperial) set the pressure automatically.
from bom-weather-card.
@DavidFW1960,
The NWS integration does provide units natively. See:
Accessing this directly in the javascript could be accomplished by:
${this._hass.states[this.config.entity_pressure].attributes.unit_of_measurement}
Where it is provided by the integration a simple test for it's presence would work and otherwise flow into the getUoM() process being used now.
from bom-weather-card.
Accessing this directly in the javascript could be accomplished by:
${this._hass.states[this.config.entity_pressure].attributes.unit_of_measurement}
Where it is provided by the integration a simple test for it's presence would work and otherwise flow into the getUoM() process being used now.
Ok. Let me take this up with Simon. I'm not opposed to including this. @Makin-Things what do you think?
from bom-weather-card.
Making this change may upset some people. Currently the card uses a weird formula to decide on the units, which I don't think is correct. If the systems length unit is Kilometer then it uses hPa if its anything else it uses mbar. Both hPa and mbar are metric pressure units (in fact they are equivalent).
If I ditch that and use the units from the sensor there is a chance that people will see the displayed pressure switch from hPa to mbar (or vise versa). There is also the chance that people don't have any units set on the sensor (who knows). Just be aware that you may get some whinging.
I think the best option would be to use the override first, if that is not define then use the sensor units and if that is also not defined then drop back to the current silly way.
from bom-weather-card.
I think the best option would be to use the override first, if that is not define then use the sensor units and if that is also not defined then drop back to the current silly way.
I would agree with this.
Making this change may upset some people.
Any change even the most sensible upsets someone. See slots... hahahaha
I hate pissing people off or taking something from them they cherish so we try and accommodate while moving forward....
from bom-weather-card.
Simon, I agree, changes can cause negative reactions...
That being said, the provided weather.yaml example manipulates the integration data into known entities for the card. I'd propose that the better place to make a units change is right there in the template section. If you don't like hPa you can make the change. The card's goals of being agnostic to the weather integration, as I understand it, would align with that thought of accepting the units as presented by the entity.
Please take a look at PR #82 for the NWS.yaml and NWS-lovelace.yaml work that I proposed.
Basically the units get ironed out either by being passed thru from the integration, or manipulated in the template sensor logic. Either way, the card, I propose, should pass it all thru in keeping with the goal being a generic card working with any provider. I do see the edge case where an integration does not provide units of measure for its entity. That's easily remedied in the jinja of the template sensor setup, or via some logic catching "undefined" states and making a best guess or some sort of error communication.
Thoughts?
from bom-weather-card.
@DavidFW1960 I am having second thoughts on this and think removing the initial override might be a better idea. So use units from sensor if available and if not then use the old method.
Interesting thing is I went looking at a bunch of countries weather bureau sites and 99% of them use hPa as that is the accepted unit of measure as specified by the WMO. The US weather site is weird, on the observation map it is in hPa but go to a station and it is in inHg.
from bom-weather-card.
So no flag needed then?
from bom-weather-card.
Yeah, it would remove the pressure_units override and rely on the sensor units if available and use the current method as the fallback if the sensor doesn't have a unit.
from bom-weather-card.
Well its a pity throwing the new override aside but it will likely work better anyway. Just a pity we didn't consider this earlier.
from bom-weather-card.
Sometimes you make poor decisions, just best to recognise that and fess up and move on.
from bom-weather-card.
Ill do the release tomorrow but master should fix the units and use the entity.
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
- After latest update, card shows up minimized on dashboard
- Home Assistant Log error for Heat Index Template sensor HOT 2
- Fresh setup, Config error, does someone wanne bare with me HOT 4
- 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.