diff --git a/CHANGELOG.md b/CHANGELOG.md index 1822618..89453f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.2.0] - 2021-08-19 +### Added +- Added handling of temperature in Fahrenheit + ## [0.2.0] - 2021-08-11 ### Added - Added last 24h and last 30 days energy used in KWh to the attributes diff --git a/custom_components/currentcost/sensor.py b/custom_components/currentcost/sensor.py index 0c7d8d9..bc0e6e4 100644 --- a/custom_components/currentcost/sensor.py +++ b/custom_components/currentcost/sensor.py @@ -95,10 +95,15 @@ async def serial_read(self, device, rate, **kwargs): except: appliance = None pass + + temperature = None try: temperature = float(data['msg']['tmpr']) except: - temperature = None + pass + try: + temperature = float(data['msg']['tmprF']) + except: pass try: imp = int(data['msg']['imp']) diff --git a/info.md b/info.md index a4c2072..c0e22df 100644 --- a/info.md +++ b/info.md @@ -23,8 +23,8 @@ sensor: template: - sensor: - name: "CurrentCost Temperature" - unit_of_measurement: '°C' - state: '{{ state_attr("sensor.current_cost", "Temperature") | float -3 }}' # Manual adjustment of -3°C in case the temp sensor is high than real temperature + unit_of_measurement: '°C' # or °F for Fahrenheits + state: '{{ state_attr("sensor.current_cost", "Temperature") | float -3 }}' # Manual adjustment of -3°C in case the temp sensor is higher than real temperature device_class: temperature state_class: measurement # Add state_class: measurement for long term statistics are required - sensor: