File size: 1,046 Bytes
6a62ce9
 
 
 
b49aec3
6a62ce9
 
 
 
 
 
 
 
 
b49aec3
6a62ce9
b49aec3
 
 
6a62ce9
 
 
 
 
 
 
 
 
 
 
b49aec3
6a62ce9
b49aec3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from energy_prediction.EnergyPredictionNorth import EnergyPredictionNorth
from energy_prediction.EnergyPredictionSouth import EnergyPredictionSouth
from energy_prediction.EnergyPredictionPipeline import EnergyPredictionPipeline


def main():
    # Energy Prediction North wing
    EnergyPredictionNorth = EnergyPredictionNorth(
        model_path="src/energy_prediction/models/lstm_energy_north_01.keras"
    )
    # Energy Prediction South wing

    def on_message(client, userdata, message):
        df = EnergyPredictionPipeline.fit(message)

        if not df is None:
            out_vav = EnergyPredictionNorth.pipeline(
                df, EnergyPredictionPipeline.scaler
            )

    broker_address = "localhost"
    broker_port = 1883
    topic = "sensor_data"
    client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1)
    print("Connecting to broker")
    client.on_message = on_message
    client.connect(broker_address, broker_port)
    client.subscribe(topic)
    client.loop_forever()


if __name__ == "__main__":
    main()