This module implements the Viam Sensor API in a wifi_sensor:linux
model.
With this model, you can gather information about connected wireless signals on your Linux machine, including wifi network availability, signal strength, and noise.
You must have a Linux machine to use the python example module
modular resource.
To use this module, follow these instructions to add a module from the Viam Registry and select the wifi_sensor:linux
model from the python-example-module
module.
Note
Before configuring your wifi_sensor:linux
component, you must create a machine.
Navigate to the Config tab of your machine's page in the Viam app.
Click on the Components subtab and click Create component.
Select the sensor
type, then select the wifi_sensor:linux
model.
Enter a name for your component and click Create.
Note
For more information, see Configure a Machine.
There are no attributes available for configuration with this service.
{
"components": [
{
"name": "my-wifi-sensor",
"model": "viam:wifi_sensor:linux",
"type": "sensor",
"namespace": "rdk",
"attributes": {},
"depends_on": []
}
],
"modules": [
{
"type": "registry",
"name": "viam_python-example-module",
"module_id": "viam:python-example-module",
"version": "0.0.13"
}
]
}
Once the wifi_sensor
has started collecting data, you can view reported readings from the Data tab in the Viam app, under the Sensors subtab.
You can also:
- Filter your results using specific search criteria.
- Export your readings to your local workstation or another machine.
- Query your results using SQL or MQL directly in the App or from a MQL-compatible client.
- Visualize your results using popular third-party visualization platforms.
- Change the data capture frequency or cloud sync frequency
This module includes basic module logic in its src/wifi_sensor.py
file.
Follow the instructions to create your own module to learn how to write a custom module that extends a Viam API.
This module includes a setup.sh
file to help configure a virtualenv
for this module.
Follow the instructions to prepare your Python virtual environment to learn how to set up and distribute a virtualenv
configuration with your custom module.
This module includes a .github/workflows
directory, which contains workflows that you can use to automatically publish a new version of your module to the Viam registry when you create a GitHub release.
For more information, see Update a module using a GitHub action.
src
: Directory containing Python source code.exec.sh
,setup.sh
: Entrypoint file and dependencies setup, and ran on your machine when running the module.Makefile
: Builds and bundles your module into a tarball for distribution..github/workflows
: Uploads the module automatically when you create a GitHub releasemeta.json
: The Viam module configuration file.requirements.txt
: A file that defines your module's required dependencies. When run as a module,setup.sh
installs these in thevirtualenv
.
If you want to copy this repository and use it as a foundation for your own module, you'll need to make a few changes:
- Get the Viam CLI
- Rename the existing
meta.json
tometa.json.old
- Use
viam module create
to create a copy in your own account - Copy all the fields except
name
frommeta.json.old
(your choice whether to make it public or private)
You'll need to change all the namespace references in the codebase ('viam') to the namespace of your organization on Viam.
- You should already have done this in
meta.json
above - In the "model" field in
meta.json
(on line 9 when this was written) - In the ModelFamily in wifi_sensor.py, around here.
Instructions for setting the secret are here.
- If you are not seeing sensor readings appear in the Logs tab on the Viam app, make sure that both the Data capture and Cloud sync features are enabled on the data management service, and that your
wifi_sensor:linux
component is configured to capture data.