Skip to content

Commit

Permalink
Add device class for sensor state translation (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
oncleben31 committed Nov 13, 2020
1 parent f161335 commit 3b76e3d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

from homeassistant.util import slugify

from homeassistant.util import slugify


async def async_setup_entry(hass, entry, async_add_devices):
"""Setup sensor platform."""
Expand All @@ -31,3 +29,8 @@ def state(self):
def icon(self):
"""Return the icon of the sensor."""
return ICON

@property
def device_class(self):
"""Return de device class of the sensor."""
return "{{cookiecutter.domain_name}}__custom_device_class"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"state": {
"_": {
"{{cookiecutter.domain_name}}__custom_device_class": {
"some_sample_static_text": "Some sample static text."
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"state": {
"_": {
"{{cookiecutter.domain_name}}__custom_device_class": {
"some_sample_static_text": "Exemple de texte statique."
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"state": {
"_": {
"{{cookiecutter.domain_name}}__custom_device_class": {
"some_sample_static_text": "Eksempel tekst."
}
}
Expand Down

0 comments on commit 3b76e3d

Please sign in to comment.