Skip to content

Commit

Permalink
Added mac-address attribute to the BaseDevice class
Browse files Browse the repository at this point in the history
  • Loading branch information
albertogeniola committed Apr 1, 2023
1 parent de1c226 commit 91a03ca
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.5.9
0.4.5.10rc1
2 changes: 1 addition & 1 deletion examples/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def main():

# Retrieve all the devices that implement the garage-door opening mixin
await manager.async_device_discovery()
openers = manager.find_devices(device_class=GarageOpenerMixin)
openers = manager.find_devices(device_class=GarageOpenerMixin, device_type="msg100")

if len(openers) < 1:
print("No garage opener found...")
Expand Down
6 changes: 6 additions & 0 deletions meross_iot/controller/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class BaseDevice(object):
_hwversion: str = "unknown"
_online: OnlineStatus = OnlineStatus.UNKNOWN
_inner_ip: Optional[str] = None
_mac_address: Optional[str] = None
_mqtt_host: str = DEFAULT_MQTT_HOST
_mqtt_port: int = DEFAULT_MQTT_PORT

Expand Down Expand Up @@ -87,6 +88,10 @@ def cached_http_info(self) -> Optional[HttpDeviceInfo]:
def lan_ip(self):
return self._inner_ip

@property
def mac_address(self):
return self._mac_address

@property
def mqtt_host(self):
return self._mqtt_host
Expand Down Expand Up @@ -240,6 +245,7 @@ async def async_handle_update(self, namespace: Namespace, data: dict) -> bool:
# TODO: we might update name/uuid/other stuff in here...
system = data.get('all', {}).get('system', {})
self._inner_ip = system.get('firmware', {}).get('innerIp')
self._mac_address = system.get('hardware', {}).get('macAddress', None)

await self._fire_push_notification_event(namespace=namespace, data=data, device_internal_id=self.internal_id)
self._last_full_update_ts = time.time() * 1000
Expand Down
2 changes: 1 addition & 1 deletion utilities/meross_sniffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async def _async_sniff(device_sniffer: FakeDeviceSniffer, zip_obj: ZipFile, mero
messages.add(key)
print(f"New message type received: {method} {namespace}: {payload}")
note = input("Describe the command you issued on the APP which caused this message. If unsure, just type \"?\" or \"IDK\": ")
f.write(f"Command Description: {note}\n\n")
f.write(f"\n\nCommand Description: {note}\n\n")
f.write(f"Request: \n")
f.write(raw_message.payload.decode('utf8'))
f.flush()
Expand Down

0 comments on commit 91a03ca

Please sign in to comment.