void updateStreamMessage(void) { // Initialize Stream Message String stream_message = "\"GTYP\":\"Stream\","; // Get Stream Message stream_message += sensor_water_ph_temperature_ec_default.get(); stream_message += sensor_tsl2561_light_intensity_default.get(); stream_message += sensor_dht22_air_temperature_humidity_default.get(); // does not work on 1.0 stream_message += sensor_gc0011_air_co2_temperature_humidity_default.get(); stream_message += actuator_relay_air_heater_default.get(); stream_message += actuator_relay_air_humidifier_default.get(); stream_message += actuator_relay_air_vent_default.get(); stream_message += actuator_relay_air_circulation_default.get(); stream_message += chamber_illumination_default.get(); stream_message += dose_pump1_default.get(); stream_message += dose_pump2_default.get(); stream_message += dose_pump3_default.get(); stream_message += dose_pump4_default.get(); stream_message += actuator_relay_airpump_default.get(); stream_message += actuator_relay_co2_default.get(); stream_message += actuator_relay_watercir_default.get(); stream_message += actuator_relay_coolvalve_default.get(); // Return Stream Message stream_message += "\"GEND\":0"; // Send Stream Message communication.send(stream_message); }
String handleIncomingMessage(void) { // Parse Message into: Instruction Code - ID - Parameter String return_message = ""; String incoming_message = communication.receive(); Instruction instruction = parseIncomingMessage(incoming_message); // Pass Parsed Message To All Objects and Update Return Message if Applicable if (instruction.valid) { return_message += sensor_water_ph_temperature_ec_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_tsl2561_light_intensity_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_dht22_air_temperature_humidity_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_gc0011_air_co2_temperature_humidity_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_air_heater_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_air_humidifier_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_air_vent_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_air_circulation_default.set(instruction.code, instruction.id, instruction.parameter); return_message += chamber_illumination_default.set(instruction.code, instruction.id, instruction.parameter); return_message += dose_pump1_default.set(instruction.code, instruction.id, instruction.parameter); return_message += dose_pump2_default.set(instruction.code, instruction.id, instruction.parameter); return_message += dose_pump3_default.set(instruction.code, instruction.id, instruction.parameter); return_message += dose_pump4_default.set(instruction.code, instruction.id, instruction.parameter); } return return_message; }
void updateStreamMessage(void) { // Initialize Stream Message String stream_message = "\"GTYP\":\"Stream\","; // Get Stream Message //stream_message += sensor_dfr01610300_water_ph_temperature_ec_default.get(); stream_message += sensor_venier_ph_default.get(); stream_message += sensor_vernier_ec_default.get(); stream_message += sensor_ds18b20_water_temperature.get(); stream_message += sensor_tsl2561_light_intensity_default.get(); stream_message += sensor_dht22_air_temperature_humidity_default.get(); // does not work on 1.0 stream_message += sensor_gc0011_air_co2_temperature_humidity_default.get(); stream_message += sensor_contact_switch_general_shell_open_default.get(); stream_message += sensor_contact_switch_general_window_open_default.get(); stream_message += actuator_relay_air_heater_default.get(); stream_message += actuator_relay_air_humidifier_default.get(); stream_message += actuator_relay_air_vent_default.get(); stream_message += actuator_relay_air_circulation_default.get(); stream_message += actuator_relay_light_panel_default.get(); stream_message += actuator_relay_light_chamber_illumination_default.get(); stream_message += actuator_relay_light_motherboard_illumination_default.get(); // Return Stream Message stream_message += "\"GEND\":0"; // Send Stream Message communication.send(stream_message); }
String handleIncomingMessage(void) { // Parse Message into: Instruction Code - ID - Parameter String return_message = ""; String incoming_message = communication.receive(); Instruction instruction = parseIncomingMessage(incoming_message); // Pass Parsed Message To All Objects and Update Return Message if Applicable if (instruction.valid) { //return_message += sensor_dfr01610300_water_ph_temperature_ec_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_venier_ph_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_vernier_ec_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_ds18b20_water_temperature.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_tsl2561_light_intensity_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_dht22_air_temperature_humidity_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_gc0011_air_co2_temperature_humidity_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_contact_switch_general_shell_open_default.set(instruction.code, instruction.id, instruction.parameter); return_message += sensor_contact_switch_general_window_open_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_air_heater_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_air_humidifier_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_air_vent_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_air_circulation_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_light_panel_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_light_chamber_illumination_default.set(instruction.code, instruction.id, instruction.parameter); return_message += actuator_relay_light_motherboard_illumination_default.set(instruction.code, instruction.id, instruction.parameter); } return return_message; }
void initializeModules(void) { EE_Address = 0; communication.begin(); sensor_water_ph_temperature_ec_default.begin(); sensor_tsl2561_light_intensity_default.begin(); sensor_dht22_air_temperature_humidity_default.begin(); sensor_gc0011_air_co2_temperature_humidity_default.begin(); actuator_relay_air_heater_default.begin(); chamber_illumination_default.begin(); actuator_relay_air_humidifier_default.begin(); actuator_relay_air_vent_default.begin(); actuator_relay_air_circulation_default.begin(); dose_pump1_default.begin(); dose_pump2_default.begin(); dose_pump3_default.begin(); dose_pump4_default.begin(); actuator_relay_airpump_default.begin(); actuator_relay_co2_default.begin(); actuator_relay_watercir_default.begin(); actuator_relay_coolvalve_default.begin(); // Set Default States actuator_relay_air_circulation_default.set("AACR", 1, "1"); actuator_relay_air_vent_default.set("AAVE", 1, "1"); chamber_illumination_default.set("AWHI", 1, "0"); chamber_illumination_default.set("AUVI", 1, "0"); chamber_illumination_default.set("ARGB", 1, "0,0,0"); dose_pump1_default.set("ADSP", 1, "0"); dose_pump2_default.set("ADSP", 2, "0"); dose_pump3_default.set("ADSP", 3, "0"); dose_pump4_default.set("ADSP", 4, "0"); actuator_relay_airpump_default.set("AAPR", 1, "0"); actuator_relay_co2_default.set("ACOR", 1, "0"); actuator_relay_watercir_default.set("AWCR", 1, "1"); actuator_relay_coolvalve_default.set("AAPR", 1, "1"); }
void initializeModules(void) { communication.begin(); //sensor_dfr01610300_water_ph_temperature_ec_default.begin(); sensor_venier_ph_default.begin(); sensor_vernier_ec_default.begin(); sensor_ds18b20_water_temperature.begin(); sensor_tsl2561_light_intensity_default.begin(); sensor_dht22_air_temperature_humidity_default.begin(); sensor_gc0011_air_co2_temperature_humidity_default.begin(); sensor_contact_switch_general_shell_open_default.begin(); sensor_contact_switch_general_window_open_default.begin(); actuator_relay_air_heater_default.begin(); actuator_relay_air_humidifier_default.begin(); actuator_relay_air_vent_default.begin(); actuator_relay_air_circulation_default.begin(); actuator_relay_light_panel_default.begin(); actuator_relay_light_chamber_illumination_default.begin(); actuator_relay_light_motherboard_illumination_default.begin(); // Set Default States actuator_relay_air_circulation_default.set("AACR", 1, "1"); actuator_relay_light_motherboard_illumination_default.set("ALMI", 1, "1"); actuator_relay_air_vent_default.set("AAVE", 1, "1"); }