Skip to content

Commit

Permalink
Return 0 from is_online if no network
Browse files Browse the repository at this point in the history
  • Loading branch information
fboundy committed Nov 15, 2024
1 parent 1ef8b3d commit 4a80957
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/pv_opt/pv_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1566,11 +1566,11 @@ def _expose_configs(self, over_write=True):
)

def status(self, status):
entity_id = f"sensor.{self.prefix.lower()}status"
entity_id = f"sensor.{self.prefix.lower()}_status"
attributes = {"last_updated": pd.Timestamp.now().strftime(DATE_TIME_FORMAT_LONG)}
self.log(f">>> {status}")
self.log(f">>> {entity_id}")
self.log(f">>> {self.set_state(state=status, entity_id=entity_id, attributes=attributes)}")
# self.log(f">>> {status}")
# self.log(f">>> {entity_id}")
self.set_state(state=status, entity_id=entity_id, attributes=attributes)

@ad.app_lock
def optimise_state_change(self, entity_id, attribute, old, new, kwargs):
Expand Down
2 changes: 2 additions & 0 deletions apps/pv_opt/solis.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ def inverter_details(self):

if response.status_code == HTTPStatus.OK:
return response.json()["data"]
else:
return {"state": 0}

@property
def is_online(self):
Expand Down

0 comments on commit 4a80957

Please sign in to comment.