- add code for sensor import inside folder 'insert_sensor'

- add code for exporting firebird data to postgis db
This commit is contained in:
Arno Kaimbacher 2021-07-26 12:29:08 +02:00
parent 765322c52b
commit 54b210c07d
13 changed files with 1063 additions and 0 deletions

View file

@ -0,0 +1,93 @@
<sml:PhysicalSystem gml:id={off_name} xmlns:swes=\"http://www.opengis.net/swes/2.0\"
xmlns:sos=\"http://www.opengis.net/sos/2.0\"
xmlns:swe=\"http://www.opengis.net/swe/2.0\"
xmlns:sml=\"http://www.opengis.net/sensorml/2.0\"
xmlns:gml=\"http://www.opengis.net/gml/3.2\"
xmlns:xlink=\"http://www.w3.org/1999/xlink\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:gco=\"http://www.isotc211.org/2005/gco\"
xmlns:gmd=\"http://www.isotc211.org/2005/gmd\">
<gml:identifier codeSpace=\"uniqueID\">{procedure_identifier}</gml:identifier>
<sml:identification>
<sml:IdentifierList>
<sml:identifier>
<sml:Term definition=\"urn:ogc:def:identifier:OGC:1.0:shortName\">
<sml:label>shortName</sml:label>
<sml:value>{procedure_name}</sml:value>
</sml:Term>
</sml:identifier>
</sml:IdentifierList>
</sml:identification>
<sml:capabilities name=\"offerings\">
<sml:CapabilityList>
<sml:capability name=\"offeringID\">
<swe:Text definition=\"urn:ogc:def:identifier:OGC:offeringID\">
<swe:label>{offering_label}</swe:label>
<swe:value>{offering_name}</swe:value>
</swe:Text>
</sml:capability>
</sml:CapabilityList>
</sml:capabilities>
<sml:featuresOfInterest>
<sml:FeatureList definition=\"http://www.opengis.net/def/featureOfInterest/identifier\">
<swe:label>featuresOfInterest</swe:label>
<sml:feature>
<sams:SF_SpatialSamplingFeature xmlns:sams=\"http://www.opengis.net/samplingSpatial/2.0\" gml:id=\"ssf_b3a826dd44012201b01323232323041f7a92e0cc47260eb9888f6a4e9f747\">
<gml:identifier codeSpace=\"http://www.opengis.net/def/nil/OGC/0/unknown\">{feature_id}</gml:identifier>
<gml:name codeSpace=\"http://www.opengis.net/def/nil/OGC/0/unknown\">{feature_name}</gml:name>
<sf:type xmlns:sf=\"http://www.opengis.net/sampling/2.0\" xlink:href=\"http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint\"/>
<sf:sampledFeature xmlns:sf=\"http://www.opengis.net/sampling/2.0\" xlink:href=\"http://www.opengis.net/def/nil/OGC/0/unknown\"/>
<sams:shape>
<ns:Point xmlns:ns=\"http://www.opengis.net/gml/3.2\" ns:id=\"Point_ssf_b3a826dd44012201b013c90c51da28c041f7a92e0cc47260eb9888f6a4e9f747\">
<ns:pos srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">{coordinates}</ns:pos>
</ns:Point>
</sams:shape>
</sams:SF_SpatialSamplingFeature>
</sml:feature>
</sml:FeatureList>
</sml:featuresOfInterest>
<sml:outputs>
<sml:OutputList>
<sml:output name=\"Slope\">
<swe:Quantity definition=\"Slope\">
<swe:label>Slope</swe:label>
<swe:uom code=\"deg\"/>
</swe:Quantity>
</sml:output>
<sml:output name=\"Roll\">
<swe:Quantity definition=\"Roll\">
<swe:label>Roll</swe:label>
<swe:uom code=\"deg\"/>
</swe:Quantity>
</sml:output>
<sml:output name=\"InSystemTemperature\">
<swe:Quantity definition=\"InSystemTemperature\">
<swe:label>InSystemTemperature</swe:label>
<swe:uom code=\"degC\"/>
</swe:Quantity>
</sml:output>
</sml:OutputList>
</sml:outputs>
<sml:position>
<swe:Vector referenceFrame=\"urn:ogc:def:crs:EPSG::4326\">
<swe:coordinate name=\"easting\">
<swe:Quantity axisID=\"x\">
<swe:uom code=\"degree\" />
<swe:value>{cordX}</swe:value>
</swe:Quantity>
</swe:coordinate>
<swe:coordinate name=\"northing\">
<swe:Quantity axisID=\"y\">
<swe:uom code=\"degree\" />
<swe:value>{cordY}</swe:value>
</swe:Quantity>
</swe:coordinate>
<swe:coordinate name=\"altitude\">
<swe:Quantity axisID=\"z\">
<swe:uom code=\"m\" />
<swe:value>{height}</swe:value>
</swe:Quantity>
</swe:coordinate>
</swe:Vector>
</sml:position>
</sml:PhysicalSystem>

View file

@ -0,0 +1,108 @@
<sml:PhysicalSystem gml:id={off_name} xmlns:swes=\"http://www.opengis.net/swes/2.0\"
xmlns:sos=\"http://www.opengis.net/sos/2.0\"
xmlns:swe=\"http://www.opengis.net/swe/2.0\"
xmlns:sml=\"http://www.opengis.net/sensorml/2.0\"
xmlns:gml=\"http://www.opengis.net/gml/3.2\"
xmlns:xlink=\"http://www.w3.org/1999/xlink\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:gco=\"http://www.isotc211.org/2005/gco\"
xmlns:gmd=\"http://www.isotc211.org/2005/gmd\">
<gml:identifier codeSpace=\"uniqueID\">{procedure_identifier}</gml:identifier>
<sml:identification>
<sml:IdentifierList>
<sml:identifier>
<sml:Term definition=\"urn:ogc:def:identifier:OGC:1.0:shortName\">
<sml:label>shortName</sml:label>
<sml:value>{procedure_name}</sml:value>
</sml:Term>
</sml:identifier>
</sml:IdentifierList>
</sml:identification>
<sml:capabilities name=\"offerings\">
<sml:CapabilityList>
<sml:capability name=\"offeringID\">
<swe:Text definition=\"urn:ogc:def:identifier:OGC:offeringID\">
<swe:label>{offering_label}</swe:label>
<swe:value>{offering_name}</swe:value>
</swe:Text>
</sml:capability>
</sml:CapabilityList>
</sml:capabilities>
<sml:featuresOfInterest>
<sml:FeatureList definition=\"http://www.opengis.net/def/featureOfInterest/identifier\">
<swe:label>featuresOfInterest</swe:label>
<sml:feature>
<sams:SF_SpatialSamplingFeature xmlns:sams=\"http://www.opengis.net/samplingSpatial/2.0\" gml:id=\"ssf_b3a826dd44012201b01323232323041f7a92e0cc47260eb9888f6a4e9f747\">
<gml:identifier codeSpace=\"http://www.opengis.net/def/nil/OGC/0/unknown\">{feature_id}</gml:identifier>
<gml:name codeSpace=\"http://www.opengis.net/def/nil/OGC/0/unknown\">{feature_name}</gml:name>
<sf:type xmlns:sf=\"http://www.opengis.net/sampling/2.0\" xlink:href=\"http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint\"/>
<sf:sampledFeature xmlns:sf=\"http://www.opengis.net/sampling/2.0\" xlink:href=\"http://www.opengis.net/def/nil/OGC/0/unknown\"/>
<sams:shape>
<ns:Point xmlns:ns=\"http://www.opengis.net/gml/3.2\" ns:id=\"Point_ssf_b3a826dd44012201b013c90c51da28c041f7a92e0cc47260eb9888f6a4e9f747\">
<ns:pos srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">{coordinates}</ns:pos>
</ns:Point>
</sams:shape>
</sams:SF_SpatialSamplingFeature>
</sml:feature>
</sml:FeatureList>
</sml:featuresOfInterest>
<sml:outputs>
<sml:OutputList>
<sml:output name=\"Slope\">
<swe:Quantity definition=\"Slope\">
<swe:label>Slope</swe:label>
<swe:uom code=\"deg\"/>
</swe:Quantity>
</sml:output>
<sml:output name=\"Roll\">
<swe:Quantity definition=\"Roll\">
<swe:label>Roll</swe:label>
<swe:uom code=\"deg\"/>
</swe:Quantity>
</sml:output>
<sml:output name=\"InSystemTemperature\">
<swe:Quantity definition=\"InSystemTemperature\">
<swe:label>InSystemTemperature</swe:label>
<swe:uom code=\"degC\"/>
</swe:Quantity>
</sml:output>
</sml:OutputList>
</sml:outputs>
<sml:parameters>
<sml:ParameterList>
<sml:parameter name=\"settings\">
<swe:Quantity definition=\"http://www.52north.org/test/parameter\" updatable=\"false\">
<swe:label>Test parmeter</swe:label>
<swe:uom code=\"test\" />
<swe:constraint>
<swe:AllowedValues>
<swe:interval>0.01 10.0</swe:interval>
</swe:AllowedValues>
</swe:constraint>
</swe:Quantity>
</sml:parameter>
</sml:ParameterList>
</sml:parameters>
<sml:position>
<swe:Vector referenceFrame=\"urn:ogc:def:crs:EPSG::4326\">
<swe:coordinate name=\"easting\">
<swe:Quantity axisID=\"x\">
<swe:uom code=\"degree\" />
<swe:value>{cordX}</swe:value>
</swe:Quantity>
</swe:coordinate>
<swe:coordinate name=\"northing\">
<swe:Quantity axisID=\"y\">
<swe:uom code=\"degree\" />
<swe:value>{cordY}</swe:value>
</swe:Quantity>
</swe:coordinate>
<swe:coordinate name=\"altitude\">
<swe:Quantity axisID=\"z\">
<swe:uom code=\"m\" />
<swe:value>{height}</swe:value>
</swe:Quantity>
</swe:coordinate>
</swe:Vector>
</sml:position>
</sml:PhysicalSystem>

View file

@ -0,0 +1,2 @@
# For relative imports to work in Python 3.6
import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__)))

83
insert_sensor/execute.py Normal file
View file

@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
"""This module does blah blah."""
import requests
from transactional import insert_sensor
from wrapper import (Offering, FoI, Procedure, SensorType)
# import json
class Sos():
"""
A class to represent a sos service.
...
Attributes
----------
sosurl : str
first name of the person
token : str
token to access soso service
"""
def __init__(self, url, token=''):
self.sosurl = str(url) # url to access the SOS
self.token = str(token) # security token, optional
# Test if URL exists
try:
test = requests.get(self.sosurl)
test.raise_for_status()
except requests.HTTPError:
print("The URL is not valid")
def main():
"""
main function
"""
sos_url = 'https://geomon.geologie.ac.at/52n-sos-webapp/service'
######################## Sibratsgfall
offering = Offering(
"https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
"sibratsgfall_3",
"Inklinometer 3, Sibratsgfaell Sensor"
)
procedure = Procedure( "sibratsgfall_3","sibratsgfall-3")
foi = FoI("degree", "m", (47.4279288, 10.0360888, 0.0),
"sibratsgfall", "Sibratsgfall Beobachtung der Bodenbewegungen Test")
######################## Gschliefgraben
# offering = Offering(
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
# "gschliefgraben_2",
# "Inklinometer 2, Gschliefgraben Sensor"
# )
# procedure = Procedure( "gschliefgraben_2","gschliefgraben-2")
# foi = FoI("degree", "m", (47.8845629, 13.8199351, 0.0),
# "GSA01A-033-0909", "Geophysikalische Untersuchungen am Gschliefgraben (Gmunden)")
######################## Laakirchen
# offering = Offering(
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
# "laakirchen_10",
# "Inklinometer 10, Laakirchen Sensor"
# )
# procedure = Procedure( "laakirchen_10","laakirchen-10")
# foi = FoI("degree", "m", (47.9789118, 13.8141457, 0.0),
# "GSA02B-007-0911", "Massenbewegung Laakirchen")
sensor_type = SensorType("inclinometer")
post_data = insert_sensor(offering, procedure, foi, sensor_type)
print(post_data)
headers = {'Accept': 'application/json'}
request = requests.post(sos_url, headers=headers, json=post_data)
print(request.text)
if __name__ == '__main__':
main()

View file

@ -0,0 +1,93 @@
# -*- coding: utf-8 -*-
"""
Function for the SOS Transactional profile.
This set of function format requests to publish and handle data in a SOS using a RESTful API.
Requests need to be passed as the body of a HTTP request to the SOS server.
When more than one syntax is allowed, requests as passed using XML version 2.0
Author: Arno Kaimbacher
Created: 12-07-2021
"""
def insert_sensor(offering, procedure, foi, sensor_type):
"""
Prepares the body of a InsertSensor request for JSON biding.
:param offering: an instance of class Offering.Type object.
:param Procedure: instance of class Procedure. type object.
:param foi: feature of interest. Instance of FoI
:param sensor_type: SensorType object
:return: valid body for an InsertSensor request.
"""
# shortName = offering.name # string
# longName = 'Sibratsgfall test' # string
# Offering values
off_name = '\"' + str(offering.name) + '\"' # Offering name, double quoted
offering_name = offering.name
offering_label = offering.label
# offID = offering.fullId # URL format of full id
# featureName = featureID = cordX = cordY = height = h_unit = z_unit = coordinates = ""
if foi is not None: # check if feature of interest should be declare
# feature_id = 'https://geomon.geologie.ac.at/52n-sos-webapp/api/features/' + \
# str(foi.fid) # URL format
cordX = str(foi.x) # longitude degrees, float
cordY = str(foi.y) # latitude degrees, float
coordinates = cordX + " " + cordY
height = str(foi.z) # altitude in meters, float
# h_unit = foi.Hunit # units for horizontal coordinates
# z_unit = foi.Vunit # units for altitude
feature_id = foi.fid # "feature location"
feature_name = foi.name # "feature location"
else:
pass
procedure_name = procedure.name
procedure_identifier = procedure.id # URL,
obs_types = []
output_list = '' # output list element for describe procedure
properties_list = []
for a in sensor_type.pattern["attributes"]:
ObsPropName = '\"' + a[0] + '\"' # attribute name
# print(ObsPropName)
unit_name = sensor_type.om_types[a[1]] # om type
# magnitud = a # ??
obs_name = ObsPropName.replace('\"', '')
obs_name = "".join(obs_name.split()) # observable property name
output = '<sml:output name=' + ObsPropName + '><swe:Quantity definition=' + \
'\"' + (obs_name) + '\"' + \
'></swe:Quantity></sml:output>'
output_list = output_list + output
# add property identifier to the list.
properties_list.append(obs_name)
# prepare list of measurement types
# A sensor can not registry duplicated sensor types.
this_type = "http://www.opengis.net/def/observationType/OGC-OM/2.0/"+unit_name
if this_type not in obs_types: # when new type appears
obs_types.append(this_type)
else:
continue
# Unit of measurement:
unit_name = '\"' + procedure.name + '\"' # double quoted string
# unit = omType # one of the MO measurement types
body = {
"request": "InsertSensor",
"service": "SOS",
"version": "2.0.0",
"procedureDescriptionFormat": "http://www.opengis.net/sensorml/2.0",
"procedureDescription": f'<sml:PhysicalSystem gml:id={off_name} xmlns:swes=\"http://www.opengis.net/swes/2.0\" xmlns:sos=\"http://www.opengis.net/sos/2.0\" xmlns:swe=\"http://www.opengis.net/swe/2.0\" xmlns:sml=\"http://www.opengis.net/sensorml/2.0\" xmlns:gml=\"http://www.opengis.net/gml/3.2\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:gco=\"http://www.isotc211.org/2005/gco\" xmlns:gmd=\"http://www.isotc211.org/2005/gmd\"><gml:identifier codeSpace=\"uniqueID\">{procedure_identifier}</gml:identifier><sml:identification><sml:IdentifierList><sml:identifier><sml:Term definition=\"urn:ogc:def:identifier:OGC:1.0:shortName\"><sml:label>shortName</sml:label><sml:value>{procedure_name}</sml:value></sml:Term></sml:identifier></sml:IdentifierList></sml:identification><sml:capabilities name=\"offerings\"><sml:CapabilityList><sml:capability name=\"offeringID\"><swe:Text definition=\"urn:ogc:def:identifier:OGC:offeringID\"><swe:label>{offering_label}</swe:label><swe:value>{offering_name}</swe:value></swe:Text></sml:capability></sml:CapabilityList></sml:capabilities><sml:featuresOfInterest><sml:FeatureList definition=\"http://www.opengis.net/def/featureOfInterest/identifier\"><swe:label>featuresOfInterest</swe:label><sml:feature><sams:SF_SpatialSamplingFeature xmlns:sams=\"http://www.opengis.net/samplingSpatial/2.0\" gml:id=\"ssf_b3a826dd44012201b01323232323041f7a92e0cc47260eb9888f6a4e9f747\"><gml:identifier codeSpace=\"http://www.opengis.net/def/nil/OGC/0/unknown\">{feature_id}</gml:identifier><gml:name codeSpace=\"http://www.opengis.net/def/nil/OGC/0/unknown\">{feature_name}</gml:name><sf:type xmlns:sf=\"http://www.opengis.net/sampling/2.0\" xlink:href=\"http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint\"/><sf:sampledFeature xmlns:sf=\"http://www.opengis.net/sampling/2.0\" xlink:href=\"http://www.opengis.net/def/nil/OGC/0/unknown\"/><sams:shape><ns:Point xmlns:ns=\"http://www.opengis.net/gml/3.2\" ns:id=\"Point_ssf_b3a826dd44012201b013c90c51da28c041f7a92e0cc47260eb9888f6a4e9f747\"><ns:pos srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">{coordinates}</ns:pos></ns:Point></sams:shape></sams:SF_SpatialSamplingFeature></sml:feature></sml:FeatureList></sml:featuresOfInterest><sml:outputs><sml:OutputList><sml:output name=\"Slope\"><swe:Quantity definition=\"Slope\"><swe:label>Slope</swe:label><swe:uom code=\"deg\"/></swe:Quantity></sml:output><sml:output name=\"Roll\"><swe:Quantity definition=\"Roll\"><swe:label>Roll</swe:label><swe:uom code=\"deg\"/></swe:Quantity></sml:output><sml:output name=\"InSystemTemperature\"><swe:Quantity definition=\"InSystemTemperature\"><swe:label>InSystemTemperature</swe:label><swe:uom code=\"degC\"/></swe:Quantity></sml:output></sml:OutputList></sml:outputs><sml:position><swe:Vector referenceFrame=\"urn:ogc:def:crs:EPSG::4326\"><swe:coordinate name=\"easting\"><swe:Quantity axisID=\"x\"><swe:uom code=\"degree\" /><swe:value>{cordX}</swe:value></swe:Quantity></swe:coordinate><swe:coordinate name=\"northing\"><swe:Quantity axisID=\"y\"><swe:uom code=\"degree\" /><swe:value>{cordY}</swe:value></swe:Quantity></swe:coordinate><swe:coordinate name=\"altitude\"><swe:Quantity axisID=\"z\"><swe:uom code=\"m\" /><swe:value>{height}</swe:value></swe:Quantity></swe:coordinate></swe:Vector></sml:position></sml:PhysicalSystem>',
"observableProperty": [
"Slope",
"Roll",
"InSystemTemperature"
],
"observationType": [
"http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"
],
"featureOfInterestType": "http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint"
}
return body

97
insert_sensor/wrapper.py Normal file
View file

@ -0,0 +1,97 @@
# -*- coding: utf-8 -*-
"""This module does blah blah."""
class Offering:
""" offering class """
def __init__(self, rooturl, offering_name, offering_label):
self.url = rooturl
# self.identifier = offeringId
self.name = str(offering_name)
self.label = offering_label
#self.fullId = str(rooturl) + str(offeringId)
class Procedure:
""" procedure class """
def __init__(self, procedure_id, procedure_name):
self.id = procedure_id
self.name = procedure_name
# Feature of Interest
class FoI:
""" foi class """
def __init__(self, xy_unit, z_unit, cords, feature_id, feature_name):
'''
:param xy_unit: unit for X,Y coordinates. Eg. degrees, meters, etc.
:param z_unit: unit for z, usually height in meters.
:param cords: a tuple like (X, Y, Z)
:param feature_id: id for the feature of interest
'''
self.x = cords[0]
self.y = cords[1]
self.z = cords[2]
self.Vunit = str(z_unit) # unit of the vertical dimension
self.Hunit = str(xy_unit) # unit of the horizontal dimensions
self.fid = feature_id # ID of the feature
self.name = feature_name
class SensorType:
""" sensor type class """
# In a SOS sensors can be:
# (a) In-situ ('on the spot') or (b) remote (e.g. satellites, airborne)
# (1) stationary (with fixed location) or mobile (in movement).
# Classification used in this class.
# TODO: extend class to consider all types.
om_types = {"m": "OM_Measurement", "co": "OM_CategoryObservation", "cto": "OM_CountObservation",
"to": "OM_TextObservation", "go": "OM_GeometryObservation", "tho": "OM_TruthObservation",
"xo": "OM_ComplexObservation"}
def __init__(self, type_): # type refers to the description of phenomena observed,
# and the mobility of the the sensor.
# TODO: work on an ontology to deal with different phenomena names
if type_ == "light": # LIGHT
self.pattern = {"name": "light", "type": 'fixed', "attributes": [
("Luminosity", "m"), ("Battery level", "m"), ("Temperature", "m")]}
elif type_ == "bus": # BUS
self.pattern = {"name": "BUS", "type": 'mobile', "attributes": [("Speed", "m"), ("Course", "m"), ("Odometer", "m"), ("CO", "m"), (
"Particles", "m"), ("Ozone N02", "m"), ("N02", "m"), ("Temperature", "m"), ("Humidity", "m")]} # ("Location","go")]}
elif type_ == "env_station": # ENV_STATION
self.pattern = {"name": "env_station", "type": 'fixed', "attributes": [("Battery level", "m"), ("Temperature", "m"), ("Relative humidity", "m"), ("Soil Moisture", "m"), (
"Solar Radiation", "m"), ("Rainfall", "m"), ("Wind_Speed", "m"), ("Wind_Direction", "m"), ("Radiation_PAR", "m"), ("Atmospheric Pressure", "m")]}
elif type_ == "irrigation": # IRRIGATION
self.pattern = {"name": "irrigation", "type": 'fixed', "attributes": [("Battery level", "m"), (
"Temperature", "m"), ("Relative humidity", "m"), ("Soil Moisture", "m"), ("Soil Temperature", "m")]}
elif type_ == "agriculture": # AGRICULTURE
self.pattern = {"name": "agriculture", "type": 'fixed', "attributes": [
("Battery level", "m"), ("Temperature", "m"), ("Relative humidity", "m")]}
elif type_ == "inclinometer": # INCLINOMETER
self.pattern = {"name": "inclinometer", "type": 'fixed', "attributes": [
("Slope", "m"), ("Roll", "m")]}
elif type_ == "noise": # NOISE
self.pattern = {"name": "noise", "type": 'fixed', "attributes": [
("Battery level", "m"), ("Noise", "m")]}
elif type_ == "vehicle_counter": # VEHICLE_COUNTER
self.pattern = {"name": "vehicle_counter", "type": 'fixed', "attributes": [
("Occupancy", "m"), (" Count", "cto")]}
elif type_ == "vehicle_speed": # VEHICLE_SPEED
self.pattern = {"name": "vehicle_speed", "type": 'fixed', "attributes": [
("Occupancy", "m"), (" Count", "cto"), (" Average Speed", "m"), (" Median Speed", "m")]}
elif type_ == 'temp': # TEMP
self.pattern = {"name": "temp", "type": 'fixed', "attributes": [
("Battery level", "m"), ("Temperature", "m")]}
elif type_ == 'outdoor': # Low EMF, measuring 'electrosmog'
# EFM-project, http://lexnet-project.eu/
self.pattern = {"name": "outdoor", "type": 'fixed', "attributes": [(" EField (900 Mhz)", "m"), (
" EField (1800 Mhz)", "m"), (" EField (2100 Mhz)", "m"), (" EField (2400 Mhz)", "m")]}
elif type_ == 'waste': # WASTE COLLECTOR (Truck)
self.pattern = {"name": "waste", "type": "fixed", "attributes": [("temperature", "m"), (
"humidity", "m"), ("particles", "m"), ("CO", "m"), ("NO2", "m"), ("O3", "m"), ("Location", "go")]}
elif type_ == 'air': # AIR, Not currently reporting
self.pattern = {"name": "air", "type": "fixed"}
else:
print("Sensor type is not defined")