aws_topic_publisher - bruno-beloff/scs_dev GitHub Wiki

docs > software repositories > scs_dev > commands > manipulating nodes within JSON documents


DESCRIPTION

The aws_topic_publisher utility is used to prepare data for publication by the aws_mqtt_client script. The aws_topic_publisher acts by taking data from stdin, wrapping it in a JSON document whose only field has the name of the given topic, and presenting the result on stdout.

Messaging topics can be specified either by a project channel name, or by an explicit topic path. If a project channel name is used, the aws_topic_publisher utility requires system ID and AWS project configurations to be set.

SYNOPSIS

aws_topic_publisher.py { -t TOPIC | -c { C | G | P | S | X } } [-p UDS_PUB] [-v]

Options
--version show program's version number and exit
-h, --help show this help message and exit
-t TOPIC, --topic=TOPIC topic path
-c CHANNEL, --channel=CHANNEL publication channel
-p UDS_PUB, --pub=UDS_PUB write publications to UDS instead of stdout
-v, --verbose report narrative to stderr

EXAMPLES

./climate_sampler.py -v -s scs-climate | /home/pi/SCS/scs_dev/src/scs_dev/aws_topic_publisher.py -v -cC -p /home/pi/SCS/pipes/mqtt_publication.uds

DOCUMENT EXAMPLE - INPUT

{"tag": "scs-be2-2", "rec": "2018-04-04T13:05:52.675+00:00", "val": {"NO2": {"weV": 0.316192, "aeV": 0.310317, "weC": 0.002991, "cnc": 22.6}, "CO": {"weV": 0.286567, "aeV": 0.258941, "weC": 0.043378, "cnc": 181.5}, "SO2": {"weV": 0.263879, "aeV": 0.267942, "weC": -0.01022, "cnc": -12.8}, "H2S": {"weV": 0.209753, "aeV": 0.255191, "weC": -0.031478, "cnc": 11.9}, "sht": {"hmd": 57.0, "tmp": 21.3}}}

DOCUMENT EXAMPLE - OUTPUT

{"south-coast-science-dev/production-test/loc/1/gases": {"tag": "scs-be2-2", "rec": "2018-04-04T13:05:52.675+00:00", "val": {"NO2": {"weV": 0.316192, "aeV": 0.310317, "weC": 0.002991, "cnc": 22.6}, "CO": {"weV": 0.286567, "aeV": 0.258941, "weC": 0.043378, "cnc": 181.5}, "SO2": {"weV": 0.263879, "aeV": 0.267942, "weC": -0.01022, "cnc": -12.8}, "H2S": {"weV": 0.209753, "aeV": 0.255191, "weC": -0.031478, "cnc": 11.9}, "sht": {"hmd": 57.0, "tmp": 21.3}}}}

SEE ALSO

scs_dev/aws_mqtt_client

scs_mfr/aws_project
scs_mfr/system_id