Skip to content

Commit

Permalink
⛲️ fix for water fountain (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Jan 31, 2023
1 parent 86b0fe0 commit fece5f5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions custom_components/petkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,19 @@ async def _async_update_data(self):
did = dat.get('id')
if not did:
continue
typ = dat['type'] = dvc.get('type') or ''
dat['type'] = dvc.get('type') or ''
old = self.hass.data[DOMAIN][CONF_DEVICES].get(did)
if old:
dvc = old
dvc.update_data(dat)
else:
if typ.lower() in ['p3']:
typ = dat['type'].lower()
if typ in ['p3']:
dvc = FitDevice(dat, self)
elif typ.lower() in ['t3', 't4']:
elif typ in ['t3', 't4']:
dvc = LitterDevice(dat, self)
elif typ in ['w5']:
dvc = W5Device(dat, self)
else:
dvc = FeederDevice(dat, self)
self.hass.data[DOMAIN][CONF_DEVICES][did] = dvc
Expand Down

0 comments on commit fece5f5

Please sign in to comment.