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