/// <summary> /// Initializes the ModuleClient and sets up the callback to receive /// messages containing temperature information /// </summary> static async Task Init() { MqttTransportSettings mqttSetting = new MqttTransportSettings(TransportType.Mqtt_Tcp_Only); ITransportSettings[] settings = { mqttSetting }; // Open a connection to the Edge runtime IoTHubModuleClient = await ModuleClient.CreateFromEnvironmentAsync(settings); await IoTHubModuleClient.OpenAsync(); Console.WriteLine("IoT Hub module client initialized."); // Register callback to be called when a message is received by the module //await ioTHubModuleClient.SetInputMessageHandlerAsync("input1", PipeMessage, ioTHubModuleClient); //initialize Raspberry _raspberryPins = new Pins(); _raspberryPins.ConnectGpio(); _raspberryPins.LoopGpioPins(); _paradox1738 = new Paradox1738(); _paradox1738.ParadoxSecurity(); _paradox1738.IRSensorsReading(); //Receive Netatmo data _receiveNetatmoData = new ReceiveNetatmoData(); _receiveNetatmoData.ReceiveData(); //read from ome temperature sensors _homeTemperature = new HomeTemperature(); _homeTemperature.ReadTemperature(); //Starting schedulers _co2Scheduler = new Co2(); _co2Scheduler.CheckCo2Async(); _saunaHeating = new SaunaHeating(); _saunaHeating.CheckHeatingTime(); _heatingScheduler = new Heating(); _heatingScheduler.ReduceHeatingSchedulerAsync(); //Receive IoTHub commands _receiveData = new ReceiveData(); _receiveData.ReceiveCommandsAsync(); //query WiFiProbes _wiFiProbes = new WiFiProbes(); _wiFiProbes.QueryWiFiProbes(); //shelly's TelemetryDataClass.isOutsideLightsOn = await Shelly.GetShellyState(Shelly.OutsideLight); SomeoneAtHome.CheckLightStatuses(); //Send data to IoTHub _sendData = new SendTelemetryData(); _sendData.SendTelemetryEventsAsync(); }