overthesun / simoc-sam

Live backend for SAM at Biosphere 2
2 stars 1 forks source link

Add the hostinfo.py script and the `info` command to simoc-sam.py. #61

Closed ezio-melotti closed 9 months ago

ezio-melotti commented 9 months ago

This PR adds the hostinfo.py script and the info, sensors-info, network-info commands to simoc-sam.py.

The hostinfo.py can be run directly with python3 hostinfo.py (the venv must be active), or can be invoked using python3 simoc-sam.py info.

It will print something like:

===== Network info =====
Hostname: samrpi1
IP/MAC addresses:
* wlan0:
  MAC : e4:5f:01:b5:73:90
  IPv6: fe80::e65f:1ff:feb5:7390%wlan0
* bat0:
  MAC : 42:3d:94:c7:3e:30
  IPv4: 172.27.0.1
  IPv6: fe80::403d:94ff:fec7:3e30%bat0
===== Sensors info =====
MCP2221 connected: True
Found 2 sensors:
* SGP30 (I2C addr: 0x58)
* SCD30 (I2C addr: 0x61)

In addition, the network-info and sensors-info commands have been added to simoc-sam.py to print only network or sensors information.

These commands will help with troubleshooting and with host identification.