iotswarm.scripts package
Submodules
iotswarm.scripts.cli module
iot-swarm
Core group of the cli.
iot-swarm [OPTIONS] COMMAND [ARGS]...
Options
- --log-config <log_config>
Path to a logging config file. Uses default if not given.
- --log-level <log_level>
Overrides the logging level.
- Options
DEBUG | INFO | WARNING | ERROR | CRITICAL
Environment variables
- IOT_SWARM_LOG_LEVEL
Provide a default for
--log-level
cosmos
Uses the COSMOS database as the source for data to send.
iot-swarm cosmos [OPTIONS] COMMAND [ARGS]...
Options
- --site <site>
Adds a site to be initialized. Can be invoked multiple times for other sites. Grabs all sites from database query if none provided
- --dsn <dsn>
Required Data source name (DSN) for the COSMOS database.
- --user <user>
Required Username for accessing the COSMOS database. Must have at least read access.
- --password <password>
Required Password corresponding to –user for COMSOS database login.
Environment variables
- IOT_SWARM_COSMOS_DSN
Provide a default for
--dsn
- IOT_SWARM_COSMOS_USER
Provide a default for
--user
- IOT_SWARM_COSMOS_PASSWORD
Provide a default for
--password
list-sites
Lists unique site_id from an oracle database table.
iot-swarm cosmos list-sites [OPTIONS] {LEVEL_1_SOILMET_30MIN|LEVEL_1_NMDB_1HOU
R|LEVEL_1_PRECIP_1MIN|LEVEL_1_PRECIP_RAINE_1MIN|CO
SMOS_STATUS_1HOUR}
Options
- --max-sites <max_sites>
Arguments
- TABLE
Required argument
mqtt
Sends The cosmos data via MQTT protocol using IoT Core. Data is from the cosmos database TABLE and sent using CLIENT_ID.
Currently only supports sending through AWS IoT Core.
iot-swarm cosmos mqtt [OPTIONS] {LEVEL_1_SOILMET_30MIN|LEVEL_1_NMDB_1HOUR|LEVE
L_1_PRECIP_1MIN|LEVEL_1_PRECIP_RAINE_1MIN|COSMOS_STATUS_
1HOUR} CLIENT_ID
Options
- --no-send-probability <no_send_probability>
Probability of not sending a message, can be 0 - 100 where 0 is no skip and 100 is always skip
- --device-type <device_type>
- Options
basic | cr1000x
- --delay-start
Adds a random delay before the first message from each site up to –sleep-time.
- --swarm-name <swarm_name>
Name given to swarm. Appears in the logs.
- --max-sites <max_sites>
Maximum number of sites allowed to initialize. No limit if set to 0.
- --max-cycles <max_cycles>
Maximum number message sending cycles. Runs forever if set to 0.
- --sleep-time <sleep_time>
The number of seconds each site goes idle after sending a message.
- --mqtt-suffix <mqtt_suffix>
Suffixes the MQTT topic with a string. Can augment the calculated MQTT topic returned by each site.
- --mqtt-prefix <mqtt_prefix>
Prefixes the MQTT topic with a string. Can augment the calculated MQTT topic returned by each site.
- --ca-cert-path <ca_cert_path>
Required Path to the root Certificate Authority (CA) for the MQTT host.
- --key-path <key_path>
Required Path to the private key that pairs with the –cert-path.
- --cert-path <cert_path>
Required Path to public key certificate for the device. Must match key assigned to the –client-id in the cloud provider.
- --endpoint <endpoint>
Required Endpoint of the MQTT receiving host.
- --dry
Doesn’t send out any data.
Arguments
- TABLE
Required argument
- CLIENT_ID
Required argument
Environment variables
- IOT_SWARM_MQTT_CA_CERT_PATH
Provide a default for
--ca-cert-path
- IOT_SWARM_MQTT_KEY_PATH
Provide a default for
--key-path
- IOT_SWARM_MQTT_CERT_PATH
Provide a default for
--cert-path
- IOT_SWARM_MQTT_ENDPOINT
Provide a default for
--endpoint
looping-csv
Instantiates a pandas dataframe from a csv file which is used as the database. Responsibility falls on the user to ensure the correct file is selected.
iot-swarm looping-csv [OPTIONS] COMMAND [ARGS]...
Options
- --site <site>
Adds a site to be initialized. Can be invoked multiple times for other sites. Grabs all sites from database query if none provided
Environment variables
- IOT_SWARM_CSV_DB
Provide a default for
--file
list-sites
Prints the sites present in database.
iot-swarm looping-csv list-sites [OPTIONS]
Options
- --max-sites <max_sites>
mqtt
Sends The cosmos data via MQTT protocol using IoT Core. Data is collected from the db using QUERY and sent using CLIENT_ID.
Currently only supports sending through AWS IoT Core.
iot-swarm looping-csv mqtt [OPTIONS] CLIENT_ID
Options
- --no-send-probability <no_send_probability>
Probability of not sending a message, can be 0 - 100 where 0 is no skip and 100 is always skip
- --device-type <device_type>
- Options
basic | cr1000x
- --delay-start
Adds a random delay before the first message from each site up to –sleep-time.
- --swarm-name <swarm_name>
Name given to swarm. Appears in the logs.
- --max-sites <max_sites>
Maximum number of sites allowed to initialize. No limit if set to 0.
- --max-cycles <max_cycles>
Maximum number message sending cycles. Runs forever if set to 0.
- --sleep-time <sleep_time>
The number of seconds each site goes idle after sending a message.
- --mqtt-suffix <mqtt_suffix>
Suffixes the MQTT topic with a string. Can augment the calculated MQTT topic returned by each site.
- --mqtt-prefix <mqtt_prefix>
Prefixes the MQTT topic with a string. Can augment the calculated MQTT topic returned by each site.
- --ca-cert-path <ca_cert_path>
Required Path to the root Certificate Authority (CA) for the MQTT host.
- --key-path <key_path>
Required Path to the private key that pairs with the –cert-path.
- --cert-path <cert_path>
Required Path to public key certificate for the device. Must match key assigned to the –client-id in the cloud provider.
- --endpoint <endpoint>
Required Endpoint of the MQTT receiving host.
- --dry
Doesn’t send out any data.
- --resume-session
Resumes the session if it exists. Must be used with “session-name”.
Arguments
- CLIENT_ID
Required argument
Environment variables
- IOT_SWARM_MQTT_CA_CERT_PATH
Provide a default for
--ca-cert-path
- IOT_SWARM_MQTT_KEY_PATH
Provide a default for
--key-path
- IOT_SWARM_MQTT_CERT_PATH
Provide a default for
--cert-path
- IOT_SWARM_MQTT_ENDPOINT
Provide a default for
--endpoint
looping-sqlite3
Instantiates a sqlite3 database as sensor source..
iot-swarm looping-sqlite3 [OPTIONS] COMMAND [ARGS]...
Options
- --site <site>
Adds a site to be initialized. Can be invoked multiple times for other sites. Grabs all sites from database query if none provided
Environment variables
- IOT_SWARM_LOCAL_DB
Provide a default for
--file
list-sites
Prints the sites present in database.
iot-swarm looping-sqlite3 list-sites [OPTIONS] {LEVEL_1_SOILMET_30MIN|LEVEL_1_
NMDB_1HOUR|LEVEL_1_PRECIP_1MIN|LEVEL_1_PR
ECIP_RAINE_1MIN|COSMOS_STATUS_1HOUR}
Options
- --max-sites <max_sites>
Arguments
- TABLE
Required argument
mqtt
Sends The cosmos data via MQTT protocol using IoT Core. Data is collected from the db using QUERY and sent using CLIENT_ID.
Currently only supports sending through AWS IoT Core.
iot-swarm looping-sqlite3 mqtt [OPTIONS] CLIENT_ID {LEVEL_1_SOILMET_30MIN|LEVE
L_1_NMDB_1HOUR|LEVEL_1_PRECIP_1MIN|LEVEL_1_PREC
IP_RAINE_1MIN|COSMOS_STATUS_1HOUR}
Options
- --no-send-probability <no_send_probability>
Probability of not sending a message, can be 0 - 100 where 0 is no skip and 100 is always skip
- --device-type <device_type>
- Options
basic | cr1000x
- --delay-start
Adds a random delay before the first message from each site up to –sleep-time.
- --swarm-name <swarm_name>
Name given to swarm. Appears in the logs.
- --max-sites <max_sites>
Maximum number of sites allowed to initialize. No limit if set to 0.
- --max-cycles <max_cycles>
Maximum number message sending cycles. Runs forever if set to 0.
- --sleep-time <sleep_time>
The number of seconds each site goes idle after sending a message.
- --mqtt-suffix <mqtt_suffix>
Suffixes the MQTT topic with a string. Can augment the calculated MQTT topic returned by each site.
- --mqtt-prefix <mqtt_prefix>
Prefixes the MQTT topic with a string. Can augment the calculated MQTT topic returned by each site.
- --ca-cert-path <ca_cert_path>
Required Path to the root Certificate Authority (CA) for the MQTT host.
- --key-path <key_path>
Required Path to the private key that pairs with the –cert-path.
- --cert-path <cert_path>
Required Path to public key certificate for the device. Must match key assigned to the –client-id in the cloud provider.
- --endpoint <endpoint>
Required Endpoint of the MQTT receiving host.
- --dry
Doesn’t send out any data.
- --resume-session
Resumes the session if it exists. Must be used with “session-name”.
Arguments
- CLIENT_ID
Required argument
- TABLE
Required argument
Environment variables
- IOT_SWARM_MQTT_CA_CERT_PATH
Provide a default for
--ca-cert-path
- IOT_SWARM_MQTT_KEY_PATH
Provide a default for
--key-path
- IOT_SWARM_MQTT_CERT_PATH
Provide a default for
--cert-path
- IOT_SWARM_MQTT_ENDPOINT
Provide a default for
--endpoint
sessions
Group for managing sessions.
iot-swarm sessions [OPTIONS] COMMAND [ARGS]...
test-mqtt
Tests that a basic message can be sent via mqtt.
iot-swarm test-mqtt [OPTIONS] CLIENT_ID
Options
- --mqtt-suffix <mqtt_suffix>
Suffixes the MQTT topic with a string. Can augment the calculated MQTT topic returned by each site.
- --mqtt-prefix <mqtt_prefix>
Prefixes the MQTT topic with a string. Can augment the calculated MQTT topic returned by each site.
- --ca-cert-path <ca_cert_path>
Required Path to the root Certificate Authority (CA) for the MQTT host.
- --key-path <key_path>
Required Path to the private key that pairs with the –cert-path.
- --cert-path <cert_path>
Required Path to public key certificate for the device. Must match key assigned to the –client-id in the cloud provider.
- --endpoint <endpoint>
Required Endpoint of the MQTT receiving host.
Arguments
- CLIENT_ID
Required argument
Environment variables
- IOT_SWARM_MQTT_CA_CERT_PATH
Provide a default for
--ca-cert-path
- IOT_SWARM_MQTT_KEY_PATH
Provide a default for
--key-path
- IOT_SWARM_MQTT_CERT_PATH
Provide a default for
--cert-path
- IOT_SWARM_MQTT_ENDPOINT
Provide a default for
--endpoint