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

Use custom Unit_of_measurement with variable #22

Open
georg90 opened this issue May 1, 2019 · 3 comments
Open

Use custom Unit_of_measurement with variable #22

georg90 opened this issue May 1, 2019 · 3 comments

Comments

@georg90
Copy link

georg90 commented May 1, 2019

I use the variables to feed data into Home assistant from local sensors and different apis. For example I have a temperature / humidity sensor, which is updating two variables when it gets an update.

However, I want to show the unit in the UI. How can I set a unit of the variable in use?

I have this:
grafik

I want this (shot from other SH system):
grafik

@OleksandrBerchenko
Copy link

I don't think it's possible to assign a unit of measurement to a variable (treat it like a usual "variable" in a programming language), but you can setup a sensor like:

sensor:
  - platform: template
    sensors:
      temperature:
        value_template: "{{ states('variable.temperature') }}"
        unit_of_measurement: '°C'
\

@oncleben31
Copy link
Contributor

It should be possible as unit_of_measurement is an attribute and you can set the attributes of the variable.
The issue is currently the variable don't restore the attributes after a reboot if you need this.

@oncleben31
Copy link
Contributor

Good news the attributes will be restore if the #32 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants