Skip to content

Commit

Permalink
Merge pull request #19 from robbinjanssen/rja/v1.3.1
Browse files Browse the repository at this point in the history
Make unique identifier work again
  • Loading branch information
robbinjanssen authored May 7, 2020
2 parents 64c9241 + 7b75d65 commit e8c11c3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions custom_components/omnik_inverter/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import re
import pickle

VERSION = '1.3.0'
VERSION = '1.3.1'

CONF_CACHE_POWER_TODAY = 'cache_power_today'
CONF_USE_JSON = 'use_json'
Expand Down Expand Up @@ -108,6 +108,7 @@ def update(self):
if matches is not None:
data = matches.group(0).split(',')
self.result = [
data[0],
int(data[5]),
int(data[6]),
int(data[7])
Expand Down Expand Up @@ -141,6 +142,7 @@ def update(self):
# Split the values
if data is not None:
self.result = [
data["g_sn"],
int(data["i_pow_n"]),
int(float(data["i_eday"]) * 100),
int(float(data["i_eall"]) * 10)
Expand Down Expand Up @@ -204,13 +206,13 @@ def update(self):

if self.type == 'powercurrent':
# Update the sensor state
self._state = result[0]
self._state = result[1]
elif self.type == 'powertoday':
# Define the cache name
cacheName = CACHE_NAME.format(self.type)

# Prepare the current actual values
currentValue = result[1]
currentValue = result[2]
currentDay = int(datetime.now().strftime('%Y%m%d'))

# Check if caching is enabled
Expand Down Expand Up @@ -259,4 +261,4 @@ def update(self):
self._state = (currentValue / 100)
elif self.type == 'powertotal':
# Update the sensor state, divide by 10 to make it kWh
self._state = (result[2] / 10)
self._state = (result[3] / 10)

0 comments on commit e8c11c3

Please sign in to comment.