Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-BS-AMS committed Oct 6, 2021
1 parent 83f0d3a commit 697503d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions custom_components/hildebrandglow_dcc/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,10 @@ def device_info(self) -> Optional[Dict[str, Any]]:
@property
def device_class(self) -> str:
"""Return the device class."""
if self._state is not None and self._state["units"] == "kWh":
if self.resource["dataSourceResourceTypeInfo"]["type"] == "ELEC":
return DEVICE_CLASS_ENERGY
elif self.resource["dataSourceResourceTypeInfo"]["type"] == "GAS":
return DEVICE_CLASS_GAS
if self.resource["dataSourceResourceTypeInfo"]["type"] == "ELEC":
return DEVICE_CLASS_ENERGY
if self.resource["dataSourceResourceTypeInfo"]["type"] == "GAS":
return DEVICE_CLASS_GAS
if self._state is not None and self._state["units"] == "pence":
return DEVICE_CLASS_MONETARY
return None
Expand Down

0 comments on commit 697503d

Please sign in to comment.