-- --------------------------------------------------------
-- Host:                         192.168.2.214
-- Server versie:                10.1.48-MariaDB-0+deb9u1 - Raspbian 9.11
-- Server OS:                    debian-linux-gnueabihf
-- HeidiSQL Versie:              11.2.0.6213
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


-- Databasestructuur van p1 wordt geschreven
CREATE DATABASE IF NOT EXISTS `p1` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `p1`;

-- Structuur van  tabel p1.maandretour_laag wordt geschreven
CREATE TABLE IF NOT EXISTS `maandretour_laag` (
  `maand_id` int(11) NOT NULL AUTO_INCREMENT,
  `datum` datetime NOT NULL,
  `Jaar_2018` decimal(10,3) DEFAULT NULL,
  `Jaar_2019` decimal(10,3) DEFAULT NULL,
  `Jaar_2020` decimal(10,3) DEFAULT NULL,
  `Jaar_2021` decimal(10,3) DEFAULT NULL,
  `Jaar_2022` decimal(10,3) DEFAULT NULL,
  PRIMARY KEY (`maand_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.maandretour_normaal wordt geschreven
CREATE TABLE IF NOT EXISTS `maandretour_normaal` (
  `maand_id` int(11) NOT NULL AUTO_INCREMENT,
  `datum` datetime NOT NULL,
  `Jaar_2018` decimal(10,3) DEFAULT NULL,
  `Jaar_2019` decimal(10,3) DEFAULT NULL,
  `Jaar_2020` decimal(10,3) DEFAULT NULL,
  `Jaar_2021` decimal(10,3) DEFAULT NULL,
  `Jaar_2022` decimal(10,3) DEFAULT NULL,
  PRIMARY KEY (`maand_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.maandverbruik_gas wordt geschreven
CREATE TABLE IF NOT EXISTS `maandverbruik_gas` (
  `maand_id` int(11) NOT NULL AUTO_INCREMENT,
  `datum` datetime NOT NULL,
  `Jaar_2018` decimal(10,3) DEFAULT NULL,
  `Jaar_2019` decimal(10,3) DEFAULT NULL,
  `Jaar_2020` decimal(10,3) DEFAULT NULL,
  `Jaar_2021` decimal(10,3) DEFAULT NULL,
  `Jaar_2022` decimal(10,3) DEFAULT NULL,
  PRIMARY KEY (`maand_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.maandverbruik_laag wordt geschreven
CREATE TABLE IF NOT EXISTS `maandverbruik_laag` (
  `maand_id` int(11) NOT NULL AUTO_INCREMENT,
  `datum` datetime NOT NULL,
  `Jaar_2018` decimal(10,3) DEFAULT NULL,
  `Jaar_2019` decimal(10,3) DEFAULT NULL,
  `Jaar_2020` decimal(10,3) DEFAULT NULL,
  `Jaar_2021` decimal(10,3) DEFAULT NULL,
  `Jaar_2022` decimal(10,3) DEFAULT NULL,
  PRIMARY KEY (`maand_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.maandverbruik_normaal wordt geschreven
CREATE TABLE IF NOT EXISTS `maandverbruik_normaal` (
  `maand_id` int(11) NOT NULL AUTO_INCREMENT,
  `datum` datetime NOT NULL,
  `Jaar_2018` decimal(10,3) DEFAULT NULL,
  `Jaar_2019` decimal(10,3) DEFAULT NULL,
  `Jaar_2020` decimal(10,3) DEFAULT NULL,
  `Jaar_2021` decimal(10,3) DEFAULT NULL,
  `Jaar_2022` decimal(10,3) DEFAULT NULL,
  PRIMARY KEY (`maand_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_elecverbruik wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_elecverbruik` (
  `p1_timestamp` datetime DEFAULT NULL,
  `p1_laagverbruik` decimal(20,3) DEFAULT NULL,
  `p1_normaalverbruik` decimal(20,3) DEFAULT NULL,
  `p1_laagretour` decimal(20,3) DEFAULT NULL,
  `p1_normaalretour` decimal(20,3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Electricteits verbruik per dag';

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_gasperdag wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_gasperdag` (
  `p1_timestamp` datetime DEFAULT NULL,
  `p1_gasverbruik` decimal(20,3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Gasverbruik per dag';

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_log wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_log` (
  `p1_timestamp` datetime NOT NULL,
  `p1_meter_supplier` char(4) DEFAULT NULL,
  `p1_header` char(80) DEFAULT NULL,
  `p1_dsmr_version` char(2) DEFAULT NULL,
  `p1_equipment_id` char(50) DEFAULT NULL,
  `p1_meterreading_in_1` decimal(10,3) DEFAULT NULL,
  `p1_unitmeterreading_in_1` char(3) DEFAULT NULL,
  `p1_meterreading_in_2` decimal(10,3) DEFAULT NULL,
  `p1_unitmeterreading_in_2` char(3) DEFAULT NULL,
  `p1_meterreading_out_1` decimal(10,3) DEFAULT NULL,
  `p1_unitmeterreading_out_1` char(3) DEFAULT NULL,
  `p1_meterreading_out_2` decimal(10,3) DEFAULT NULL,
  `p1_unitmeterreading_out_2` char(3) DEFAULT NULL,
  `p1_meterreading_prd` decimal(10,3) DEFAULT NULL,
  `p1_unitmeterreading_prd` char(3) DEFAULT NULL,
  `p1_current_tariff` int(11) DEFAULT NULL,
  `p1_current_power_in` decimal(10,3) DEFAULT NULL,
  `p1_unit_current_power_in` char(3) DEFAULT NULL,
  `p1_current_power_out` decimal(10,3) DEFAULT NULL,
  `p1_unit_current_power_out` char(3) DEFAULT NULL,
  `p1_current_power_prd` decimal(10,3) DEFAULT NULL,
  `p1_unit_current_power_prd` char(3) DEFAULT NULL,
  `p1_current_threshold` decimal(10,3) DEFAULT NULL,
  `p1_unit_current_threshold` char(3) DEFAULT NULL,
  `p1_current_switch_position` int(11) DEFAULT NULL,
  `p1_powerfailures` int(11) DEFAULT NULL,
  `p1_long_powerfailures` int(11) DEFAULT NULL,
  `p1_long_powerfailures_log` text,
  `p1_voltage_sags_l1` int(11) DEFAULT NULL,
  `p1_voltage_sags_l2` int(11) DEFAULT NULL,
  `p1_voltage_sags_l3` int(11) DEFAULT NULL,
  `p1_voltage_swells_l1` int(11) DEFAULT NULL,
  `p1_voltage_swells_l2` int(11) DEFAULT NULL,
  `p1_voltage_swells_l3` int(11) DEFAULT NULL,
  `p1_instantaneous_current_l1` decimal(10,3) DEFAULT NULL,
  `p1_unit_instantaneous_current_l1` char(3) DEFAULT NULL,
  `p1_instantaneous_current_l2` decimal(10,3) DEFAULT NULL,
  `p1_unit_instantaneous_current_l2` char(3) DEFAULT NULL,
  `p1_instantaneous_current_l3` decimal(10,3) DEFAULT NULL,
  `p1_unit_instantaneous_current_l3` char(3) DEFAULT NULL,
  `p1_voltage_l1` decimal(10,3) DEFAULT NULL,
  `p1_unit_voltage_l1` char(3) DEFAULT NULL,
  `p1_voltage_l2` decimal(10,3) DEFAULT NULL,
  `p1_unit_voltage_l2` char(3) DEFAULT NULL,
  `p1_voltage_l3` decimal(10,3) DEFAULT NULL,
  `p1_unit_voltage_l3` char(3) DEFAULT NULL,
  `p1_instantaneous_active_power_in_l1` decimal(10,3) DEFAULT NULL,
  `p1_unit_instantaneous_active_power_in_l1` char(3) DEFAULT NULL,
  `p1_instantaneous_active_power_in_l2` decimal(10,3) DEFAULT NULL,
  `p1_unit_instantaneous_active_power_in_l2` char(3) DEFAULT NULL,
  `p1_instantaneous_active_power_in_l3` decimal(10,3) DEFAULT NULL,
  `p1_unit_instantaneous_active_power_in_l3` char(3) DEFAULT NULL,
  `p1_instantaneous_active_power_out_l1` decimal(10,3) DEFAULT NULL,
  `p1_unit_instantaneous_active_power_out_l1` char(3) DEFAULT NULL,
  `p1_instantaneous_active_power_out_l2` decimal(10,3) DEFAULT NULL,
  `p1_unit_instantaneous_active_power_out_l2` char(3) DEFAULT NULL,
  `p1_instantaneous_active_power_out_l3` decimal(10,3) DEFAULT NULL,
  `p1_unit_instantaneous_active_power_out_l3` char(3) DEFAULT NULL,
  `p1_message_code` char(8) DEFAULT NULL,
  `p1_message_text` text,
  `p1_channel_1_id` int(11) DEFAULT NULL,
  `p1_channel_1_type_id` int(11) DEFAULT NULL,
  `p1_channel_1_type_desc` char(20) DEFAULT NULL,
  `p1_channel_1_equipment_id` char(50) DEFAULT NULL,
  `p1_channel_1_timestamp` datetime DEFAULT NULL,
  `p1_channel_1_meterreading` decimal(10,3) DEFAULT NULL,
  `p1_channel_1_unit` char(3) DEFAULT NULL,
  `p1_channel_1_valveposition` int(11) DEFAULT NULL,
  `p1_channel_2_id` int(11) DEFAULT NULL,
  `p1_channel_2_type_id` int(11) DEFAULT NULL,
  `p1_channel_2_type_desc` char(20) DEFAULT NULL,
  `p1_channel_2_equipment_id` char(50) DEFAULT NULL,
  `p1_channel_2_timestamp` datetime DEFAULT NULL,
  `p1_channel_2_meterreading` decimal(10,3) DEFAULT NULL,
  `p1_channel_2_unit` char(3) DEFAULT NULL,
  `p1_channel_2_valveposition` int(11) DEFAULT NULL,
  `p1_channel_3_id` int(11) DEFAULT NULL,
  `p1_channel_3_type_id` int(11) DEFAULT NULL,
  `p1_channel_3_type_desc` char(20) DEFAULT NULL,
  `p1_channel_3_equipment_id` char(50) DEFAULT NULL,
  `p1_channel_3_timestamp` datetime DEFAULT NULL,
  `p1_channel_3_meterreading` decimal(10,3) DEFAULT NULL,
  `p1_channel_3_unit` char(3) DEFAULT NULL,
  `p1_channel_3_valveposition` int(11) DEFAULT NULL,
  `p1_channel_4_id` int(11) DEFAULT NULL,
  `p1_channel_4_type_id` int(11) DEFAULT NULL,
  `p1_channel_4_type_desc` char(20) DEFAULT NULL,
  `p1_channel_4_equipment_id` char(50) DEFAULT NULL,
  `p1_channel_4_timestamp` datetime DEFAULT NULL,
  `p1_channel_4_meterreading` decimal(10,3) DEFAULT NULL,
  `p1_channel_4_unit` char(3) DEFAULT NULL,
  `p1_channel_4_valveposition` int(11) DEFAULT NULL,
  PRIMARY KEY (`p1_timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_maandverbruik wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_maandverbruik` (
  `Tijd` datetime DEFAULT NULL,
  `Min_Laag` decimal(10,3) DEFAULT NULL,
  `Max_laag` decimal(10,3) DEFAULT NULL,
  `Verbruik_Laag` decimal(10,3) DEFAULT NULL,
  `Min_Normaal` decimal(10,3) DEFAULT NULL,
  `Max_Normaal` decimal(10,3) DEFAULT NULL,
  `Verbruik_Normaal` decimal(10,3) DEFAULT NULL,
  `Min_ElecLaagOut` decimal(10,3) DEFAULT NULL,
  `Max_ELecLaagOut` decimal(10,3) DEFAULT NULL,
  `Retour_Laag` decimal(10,3) DEFAULT NULL,
  `Min_ElecNormaalOut` decimal(10,3) DEFAULT NULL,
  `Max_ElecNormaalOut` decimal(10,3) DEFAULT NULL,
  `Retour_Normaal` decimal(10,3) DEFAULT NULL,
  `Min_Gas` decimal(10,3) DEFAULT NULL,
  `Max_Gas` decimal(10,3) DEFAULT NULL,
  `Verbruik_Gas` decimal(10,3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Verbuik Energie per maand';

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_solaredge15m wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_solaredge15m` (
  `Tijd` datetime DEFAULT NULL,
  `Power` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT COMMENT='Opbrengst per kwartier zonnepanelen';

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_solaredgeday wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_solaredgeday` (
  `Tijd` datetime DEFAULT NULL,
  `Power` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Opbrengst zonnepanelen per dag';

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_solaredgeinverter wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_solaredgeinverter` (
  `Tijd` datetime DEFAULT NULL,
  `TotalActivePower` decimal(10,3) DEFAULT NULL,
  `DC_Voltage` decimal(10,3) DEFAULT NULL,
  `Temperature` decimal(10,4) DEFAULT NULL,
  `AC_Current` decimal(10,3) DEFAULT NULL,
  `AC_Voltage` decimal(10,3) DEFAULT NULL,
  `AC_Frequency` decimal(10,4) DEFAULT NULL,
  `ApparentPower` decimal(10,3) DEFAULT NULL,
  `ActivePower` decimal(10,3) DEFAULT NULL,
  `ReactivePower` decimal(10,3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Info over inverter zonnepanelen';

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_solaredgemonth wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_solaredgemonth` (
  `Tijd` datetime DEFAULT NULL,
  `Power` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT COMMENT='Opbrengst zonnepanelen per dag';

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_solaredgenow wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_solaredgenow` (
  `Tijd` datetime DEFAULT NULL,
  `Power` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Opbrengst per kwartier zonnepanelen';

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.p1_temp wordt geschreven
CREATE TABLE IF NOT EXISTS `p1_temp` (
  `Tijd` datetime DEFAULT NULL,
  `Temperatuur` float DEFAULT NULL,
  `Vochtigheid` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Tabel voor temperatuur en vochtigheid';

-- Data exporteren was gedeselecteerd

-- Structuur van  tabel p1.solar_power wordt geschreven
CREATE TABLE IF NOT EXISTS `solar_power` (
  `maand_id` int(11) NOT NULL AUTO_INCREMENT,
  `datum` datetime NOT NULL,
  `Jaar_2017` decimal(10,3) DEFAULT NULL,
  `Jaar_2018` decimal(10,3) DEFAULT NULL,
  `Jaar_2019` decimal(10,3) DEFAULT NULL,
  `Jaar_2020` decimal(10,3) DEFAULT NULL,
  `Jaar_2021` decimal(10,3) DEFAULT NULL,
  `Jaar_2022` decimal(10,3) DEFAULT NULL,
  PRIMARY KEY (`maand_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

-- Data exporteren was gedeselecteerd

/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
