Allow customizing unit for temperature and pressure sensors#64366
Allow customizing unit for temperature and pressure sensors#64366emontnemery merged 15 commits intodevfrom
Conversation
|
Hey there @Danielhiversen, @felipediel, @L-I-Am, mind taking a look at this pull request as it has been labeled with an integration ( |
24fdbd8 to
a9873e2
Compare
| and self.device_class in UNIT_CONVERSIONS | ||
| and (device_class := self.device_class) in UNIT_CONVERSIONS |
There was a problem hiding this comment.
Isn't this double?
| and self.device_class in UNIT_CONVERSIONS | |
| and (device_class := self.device_class) in UNIT_CONVERSIONS | |
| and (device_class := self.device_class) in UNIT_CONVERSIONS |
|
|
||
| native_unit_of_measurement = self.native_unit_of_measurement | ||
|
|
||
| if self._sensor_option_unit_of_measurement: |
There was a problem hiding this comment.
Shouldn't this be the first check ?
4a32a28 to
d66f1b2
Compare
d66f1b2 to
46ca5e9
Compare
|
|
||
| if msg["entity_id"] not in registry.entities: | ||
| entity_id = msg["entity_id"] | ||
| if entity_id not in registry.entities: |
There was a problem hiding this comment.
Shouldn't you just store the entry here in a var so you don't need to fetch it inside the disabled_by if ?
| value = round(value_f_new) if prec == 0 else round(value_f_new, prec) | ||
|
|
||
| units = self.hass.config.units | ||
| if ( |
|
|
||
| msg = await client.receive_json() | ||
|
|
||
| assert msg["result"] == { |
There was a problem hiding this comment.
Why is beard_second not an error ?
There was a problem hiding this comment.
Oh I guess that entity registry doesn't know about valid sensor options.
There was a problem hiding this comment.
yeah, that's right.
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
|
@rianadon I think this approach would be useful to allow customizing weather entity units. You can contact me on Discord, emontnemery#6618, if you want to discuss it. |
Proposed change
Allow customizing unit for temperature and pressure sensors
Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: