Skip to content

Commit

Permalink
fix wifi info for stock and pre 2.11.0 fw (#1003)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Blackburn <[email protected]>
  • Loading branch information
andyblac and Andrew Blackburn authored Jan 21, 2023
1 parent f6ac761 commit f53a3de
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/flash-shelly.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,9 @@ def get_info(self, force_update=False, error_message=True, scanner='Manual'):
if self.info.get('stock_fw_model') is None: # TODO remove when 2.9.x is mainstream.

This comment has been minimized.

Copy link
@madusankalahiru
self.info['stock_fw_model'] = self.info.get('stock_model')
self.info['sys_mode_str'] = self.get_mode(self.info.get('sys_mode'))
if self.info.get('wifi_conn_ssid') is None: # TODO remove when 2.11.x is mainstream.
self.info['wifi_conn_ssid'] = self.info.get('wifi_ssid')
self.info['wifi_conn_rssi'] = self.info.get('wifi_rssi')
return True

@staticmethod
Expand Down Expand Up @@ -703,8 +706,8 @@ def get_info(self, force_update=False, error_message=True, scanner='Manual'):
self.info['app'] = self.shelly_model(stock_fw_model)[1]
self.info['device_id'] = self.info.get('mqtt', {}).get('id', self.friendly_host)
self.info['color_mode'] = self.info.get('mode')
self.info['wifi_ssid'] = self.info.get('status', {}).get('wifi_sta', {}).get('ssid')
self.info['wifi_rssi'] = self.info.get('status', {}).get('wifi_sta', {}).get('rssi')
self.info['wifi_conn_ssid'] = self.info.get('status', {}).get('wifi_sta', {}).get('ssid')
self.info['wifi_conn_rssi'] = self.info.get('status', {}).get('wifi_sta', {}).get('rssi')
self.info['uptime'] = self.info.get('status', {}).get('uptime', 0)
self.info['battery'] = self.info.get('status', {}).get('bat', {}).get('value')
return True
Expand Down

1 comment on commit f53a3de

@madusankalahiru
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.