CREATE TABLE IF NOT EXISTS events (
    id BIGSERIAL PRIMARY KEY,
    mac char(17) not null,
	dateutc timestamp not null,
	winddir integer,
	windspeedmph float,
	windgustmph float,
	windgustdir integer,
	maxdailygust float,
    windspdmph_avg2m float,
	winddir_avg2m integer,
	windspdmph_avg10m float,
	winddir_avg10m integer,
	windgustmph_interval integer,
    humidity integer,
	humidity1 integer,
	humidity2 integer,
	humidity3 integer,
	humidity4 integer,
	humidity5 integer,
	humidity6 integer,
	humidity7 integer,
    humidity8 integer,
	humidity9 integer,
	humidity10 integer,
	humidityin integer,
	tempf float,
	temp1f float,
	temp2f float,
	temp3f float,
	temp4f float,
	temp5f float,
    temp6f float,
	temp7f float,
	temp8f float,
	temp9f float,
	temp10f float,
	tempinf float,
	hourlyrainin float,
	dailyrainin float,
	last24hourrainin float,
    weeklyrainin float,
	monthlyrainin float,
	yearlyrainin float,
	eventrainin float,
	totalrainin float,
	baromrelin float,
	baromabsin float,
    uv integer,
	solarradiation float,
	co2 integer,
	pm25 integer,
	pm25_24h float,
	pm25_in integer,
	pm25_in_24h float,
	pm10_in integer,
	pm10_in_24h float,
	co2_in integer,
    co2_in_24h float,
	pm_in_temp float,
	pm_in_humidity integer,
	relay1 boolean,
	relay2 boolean,
	relay3 boolean,
	relay4 boolean,
	relay5 boolean,
	relay6 boolean,
    relay7 boolean,
	relay8 boolean,
	relay9 boolean,
	relay10 boolean,
	soiltemp1 float,
	soiltemp2 float,
	soiltemp3 float,
	soiltemp4 float,
	soiltemp5 float,
    soiltemp6 float,
	soiltemp7 float,
	soiltemp8 float,
	soiltemp9 float,
	soiltemp10 float,
	soilhum1 integer,
	soilhum2 integer,
	soilhum3 integer,
	soilhum4 integer,
    soilhum5 integer,
	soilhum6 integer,
	soilhum7 integer,
	soilhum8 integer,
	soilhum9 integer,
	soilhum10 integer,
	leak1 boolean,
	leak2 boolean,
	leak3 boolean,
	leak4 boolean,
    lightning_time timestamp,
	lightning_day integer,
	lightning_distance float,
	battout boolean,
	battin boolean,
	batt1 boolean,
	batt2 boolean,
	batt3 boolean,
	batt4 boolean,
    batt5 boolean,
	batt6 boolean,
	batt7 boolean,
	batt8 boolean,
	batt9 boolean,
	batt10 boolean,
	battr1 boolean,
	battr2 boolean,
	battr3 boolean,
	battr4 boolean,
	battr5 boolean,
	battr6 boolean,
    battr7 boolean,
	battr8 boolean,
	battr9 boolean,
	battr10 boolean,
	batt_25 boolean,
	batt_25in boolean,
	batleak1 boolean,
	batleak2 boolean,
	batleak3 boolean,
	batleak4 boolean,
    batt_lightning boolean,
	battsm1 boolean,
	battsm2 boolean,
	battsm3 boolean,
	battsm4 boolean,
	battrain boolean,
	batt_co2 boolean,
	stationtype varchar(30),
	passkey char(17)
);