Skip to content

Commit

Permalink
Attempt to fix issue #26, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
linsvensson committed Jul 1, 2022
1 parent 3f0a015 commit 39d0b54
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ sensor:
sold: true
sold_daily: true
sold_measure: 6
time_format: '%H'
time_format: '%H:%M'
date_format: '%d/%m/%Y'
```
Expand Down
2 changes: 1 addition & 1 deletion custom_components/greenely/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "greenely",
"name": "Greenely Sensors",
"version": "1.0.4",
"version": "1.0.5",
"documentation": "https://github.com/linsvensson/sensor.greenely",
"issue_tracker": "https://github.com/linsvensson/sensor.greenely/issues",
"codeowners": ["@linsvensson"],
Expand Down
4 changes: 2 additions & 2 deletions custom_components/greenely/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def make_attributes(self, today, response):
daily_data['localtime'] = dateTime.strftime(self._date_format)
usage = response[k]['usage']
if (dateTime == yesterday):
self._state = usage / 1000 if usage != 0 else 0
self._state = usage / 1000 if usage != None else 0
daily_data['usage'] = (usage / 1000) if usage != None else 0
data.append(daily_data)
return data
Expand Down Expand Up @@ -370,7 +370,7 @@ def make_attributes(self, today, response):
and dateTime.day == yesterday.day
and dateTime.month == yesterday.month
and dateTime.year == yesterday.year):
self._state = usage / 1000 if usage != 0 else 0
self._state = usage / 1000 if usage != None else 0
hourly_data['usage'] = (usage / 1000) if usage != None else 0
data.append(hourly_data)
return data
Expand Down

0 comments on commit 39d0b54

Please sign in to comment.