diff --git a/python/davis_etl.py b/python/davis_etl.py index 59ac989..dd7b7ce 100755 --- a/python/davis_etl.py +++ b/python/davis_etl.py @@ -388,7 +388,7 @@ if '__main__': decoded_header = davis_decoder.davis_id(raw_header) davis_unit_id = decoded_header['davis_id'] davis_packet_id = decoded_header['packet_id'] - + # Wind, mothafucka! raw_windspeed = davis_data['b0'] raw_winddir = davis_data['b1'] @@ -396,14 +396,17 @@ if '__main__': "winddir": raw_winddir}) # Get data external to the ISS, from local PCB / internal # sensors and create base values for influx writing + ''' + This shit ain't working without external sensors + davis_decoder.load_external_data() influx_weather_write = davis_writer.base_construct( { "speed": float(wind['speed']), "direction": float(wind['direction']), "temperature": float(davis_decoder.inside_temp), "humidity": float(davis_decoder.inside_hum)} - ) - + )''' + # Wind gusts calculation if davis_packet_id == '0x9': raw_gusts = davis_data['b2'] @@ -414,7 +417,7 @@ if '__main__': {"value": float(wind['windgust'])}, {"type": "windgust"} ) - + # 0x8 -> temperature if davis_packet_id == '0x8': raw_temp = (davis_data['b2'] << 8) + davis_data['b3'] @@ -433,14 +436,14 @@ if '__main__': {"pressure": float(davis_decoder.pressure)}, {"type" : "raw"} ) - + influx_weather_write = davis_writer.construct( influx_weather_write, "temphumi", {"temperature": float(temp)}, {"type": "external"} ) - + # 0xa -> Humidity if davis_packet_id == '0xa': raw_humidity = (((davis_data['b3'] >> 4) & 0b0011) << 8)\ @@ -452,7 +455,7 @@ if '__main__': {"humidity": float(humidity)}, {"type": "external"} ) - + # 0x2 -> SuperCap charge if davis_packet_id == '0x2': supercap = davis_decoder.supercap_decode( @@ -464,7 +467,7 @@ if '__main__': {"voltage": float(supercap)}, {"type": "capcaitor"} ) - + # 0x7 -> SolarPanel Voltage if davis_packet_id == '0x7': solarvolt = davis_decoder.solarvolt_decode( @@ -476,7 +479,7 @@ if '__main__': {"voltage": float(solarvolt)}, {"type": "solar"} ) - + # 0xe -> Rain bucket tips -> https://www.carluccio.de/ if davis_packet_id == '0xe': #raw_rain = (davis_data['b2'] << 8) + (davis_data['b3'] >> 7) @@ -488,7 +491,7 @@ if '__main__': {"value": float(rain)}, {"type": "rain_bucket_tips"} ) - + # 0x5 -> Rain rate -> https://www.carluccio.de/ if davis_packet_id == '0x5': rainrate_dict = davis_decoder.rainrate_decode( @@ -509,9 +512,9 @@ if '__main__': {"value": float(rainrate_dict['rate'])}, {"type": "rainrate"} ) - - - + + + out_id = decoded_header out1 = "temp: {}, wind: {}, humidity: {} ".format( temp, @@ -528,9 +531,9 @@ if '__main__': rain, supercap, solarvolt) - + print("\n{} \n{} \n{} \n{}\n".format(out_id, out1, out2, out3)) - + # Write the whole blob into Influx DB influx_weather_client.write_points(influx_weather_write) influx_status_client.write_points(influx_status_write) @@ -540,4 +543,3 @@ if '__main__': print("No data here, mate.") except serial.serialutil.SerialException as e: print("Serial Error {}".format(e)) - \ No newline at end of file