Skip to content

Commit

Permalink
Merge pull request #3 from Telekatz/DEV
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Telekatz committed Apr 7, 2023
2 parents 3b9f51a + 9c74fb8 commit dc72fb9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions shellyPlug.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ def _shellyUpdate(self):
self._connected = False

if shellyData == None:
powerAC = 0
volatageAC = 0
currentAC = 0
energy = 0
powerAC = None
volatageAC = None
currentAC = None
energy = None
else:
powerAC = shellyData['meters'][0]['power']
volatageAC = 230
Expand All @@ -264,10 +264,10 @@ def _shellyUpdate(self):
self._dbusservice['shelly'][pre + '/Energy/Forward'] = energy

else:
self._dbusservice['shelly'][pre + '/Voltage'] = 0
self._dbusservice['shelly'][pre + '/Current'] = 0
self._dbusservice['shelly'][pre + '/Power'] = 0
self._dbusservice['shelly'][pre + '/Energy/Forward'] = 0
self._dbusservice['shelly'][pre + '/Voltage'] = None if shellyData == None else 0
self._dbusservice['shelly'][pre + '/Current'] = None if shellyData == None else 0
self._dbusservice['shelly'][pre + '/Power'] = None if shellyData == None else 0
self._dbusservice['shelly'][pre + '/Energy/Forward'] = None if shellyData == None else 0

self._dbusservice['shelly']['/Ac/Power'] = powerAC
self._dbusservice['shelly']['/Ac/Current'] = currentAC
Expand Down Expand Up @@ -332,8 +332,8 @@ def _checkShelly(self):
self._dbusservice['shelly']['/FirmwareVersion'] = shellySettings['fw']
self._dbusservice['shelly']['/Connected'] = 1
self._connected = True
logging.info("Shelly_ID%i connected",self._deviceinstance)
logging.info("Shelly_ID%i connected, %s ",self._deviceinstance, self._dbusservice['shelly']['/Serial'])

return

except Exception as e:
Expand Down

0 comments on commit dc72fb9

Please sign in to comment.