Skip to content

Commit

Permalink
laat weerstandswaarden voor CO, NO2 O3 door en maak zichtbaar in Smar…
Browse files Browse the repository at this point in the history
…tApp
  • Loading branch information
justb4 committed May 2, 2016
1 parent 2d67fb6 commit ef19724
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
19 changes: 19 additions & 0 deletions etl/options/sunda.args
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Host-specific settings - Just's macbook

raw_device_url=http://whale.citygis.nl/sensors/v1

# postgis docker container IP is mapped by docker via --link option
pg_host=localhost
pg_user=postgres
pg_password=postgres
pg_port=5432
pg_database=sensors
pg_schema=smartem
pg_schema_rt=smartem_rt

sos_host=sensors.geonovum.nl
sos_port=80
sos_user=SOSUSER
sos_password=SOSPASSWORD
sos_path=/sos/service

18 changes: 18 additions & 0 deletions etl/rawsensorlastinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@ def __init__(self, configdict, section, produces=FORMAT.record_array):
'id': 22,
'label': 'Average Audio/Noise Level 1-5',
'unit': 'int'
},
{
'name': 's_o3resistance',
'id': 23,
'label': 'O3 Resistance',
'unit': 'kOhm'
},
{
'name': 's_no2resistance',
'id': 24,
'label': 'NO2 Resistance',
'unit': 'kOhm'
},
{
'name': 's_coresistance',
'id': 25,
'label': 'CO Resistance',
'unit': 'kOhm'
}
]

Expand Down
14 changes: 14 additions & 0 deletions etl/sensorconverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from datetime import datetime
import re
import math
from stetl.util import Util

log = Util.get_log("SensorConverters")

# According to CityGIS the units are defined as follows. ::
#
Expand Down Expand Up @@ -118,6 +121,10 @@ def ppb_o3_to_ugm3(input, json_obj, name):
return ppb_to_ugm3('o3', input)


def ohm_to_kohm(input, json_obj, name):
return int(round(input/1000))


def convert_temperature(input, json_obj, name):
if input == 0:
return None
Expand Down Expand Up @@ -301,6 +308,9 @@ def convert_audio_avg(value, json_obj, name):
's_co2': ppb_co2_to_ppm,
's_no2': ppb_no2_to_ugm3,
's_o3': ppb_o3_to_ugm3,
's_coresistance': ohm_to_kohm,
's_no2resistance': ohm_to_kohm,
's_o3resistance': ohm_to_kohm,
's_temperatureambient': convert_temperature,
's_barometer': convert_barometer,
's_humidity': convert_humidity,
Expand Down Expand Up @@ -342,4 +352,8 @@ def convert_audio_avg(value, json_obj, name):
}

def convert(json_obj, name):
if name not in CONVERTERS:
log.error('Cannot find converter for %s' % name)
return None

return CONVERTERS[name](json_obj[name], json_obj, name)

0 comments on commit ef19724

Please sign in to comment.