diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e3260d9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +Images/image.png diff --git a/README.md b/README.md index 861ce98..1df19e9 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,12 @@ This is a repository for **GoWired**, RS485 & MySensors based, open source home ## Wiki To learn more, have a look at our [wiki](https://github.com/feanor-anglin/GetWired-Project/wiki). -## 2021-07 Changelog -- Reorganized folders, add descriptions +## 2022-04 Changelog +- Reorganize folders, add descriptions +- Change the way software handles IOs +- Add software for 8RelayDin Shield +- Relocate Multiprotocol Gateway to separate [repository](https://github.com/GoWired/Multiprotocol-Gateway) +- Improvements to dimmer operation (new function for simultaneous change of brightness and colours) ## The code in master branch should always be tested & working. Dev branch may not be tested, use on your own responsibility. diff --git a/Software/8RelayDin Shield/Arduino/main/Configuration.h b/Software/8RelayDin Shield/Arduino/main/Configuration.h new file mode 100644 index 0000000..917a0ba --- /dev/null +++ b/Software/8RelayDin Shield/Arduino/main/Configuration.h @@ -0,0 +1,114 @@ +/* + * + * All definitions in one file + * + */ + + +#ifndef Configuration_h +#define Configuration_h + +/* ******************************************************************************************* + * MySensors Definitions + * *******************************************************************************************/ +// Identification +#define MY_NODE_ID 1 +#define SN "RS485 8RelayDin 1" +#define SV "1.0" + +// Selecting transmission settings +#define MY_RS485 // Enable RS485 transport layer +#define MY_RS485_DE_PIN 7 // DE Pin definition +#define MY_RS485_BAUD_RATE 57600 // Set RS485 baud rate to use +#define MY_RS485_HWSERIAL Serial // Enable for Hardware Serial +#define MY_RS485_SOH_COUNT 3 // Collision avoidance + +// FOTA Feature +#define MY_OTA_FIRMWARE_FEATURE + +// Other +#define MY_TRANSPORT_WAIT_READY_MS 60000 // Time to wait for gateway to respond at startup + +/* ******************************************************************************************* + * General Definitions + * *******************************************************************************************/ +// Relay states +#define RELAY_ON LOW +#define RELAY_OFF HIGH + +#define INTERVAL 300000 // Interval value (ms) for reporting readings of the sensors: temperature, power usage (default 300000) +#define INIT_DELAY 200 // A value (ms) to be multiplied by node ID value to obtain the time to wait during the initialization process +#define PRESENTATION_DELAY 10 // Time (ms) to wait between subsequent presentation messages (default 10) +#define LOOP_TIME 100 // Main loop wait time (ms); (default 100) + +/* ******************************************************************************************* + * IO Config + * *******************************************************************************************/ +#define FIRST_OUTPUT_ID 0 // default 0; should not be altered (expander pins for outputs: 0-7) +#define TOTAL_NUMBER_OF_OUTPUTS 8 // Total number of outputs; value from 0-8 (default 8) + +// Inputs not bound to any outputs (expander pins for inputs: 8-15) +#define INDEPENDENT_IO 0 // Number of independent inputs and outputs; value from 0 to 8 (default 0) +#define INPUT_TYPE 0 // Define input type: 0 - INPUT_PULLUP, 1 - INPUT, 3 - Button + +#define NUMBER_OF_OUTPUTS TOTAL_NUMBER_OF_OUTPUTS-INDEPENDENT_IO + +#define SPECIAL_BUTTON // Enables long press functionality for all buttons + +/* ******************************************************************************************* + * MCU Pin Definitions + * *******************************************************************************************/ +// OUTPUT [RELAY / RGBW] +#define OUTPUT_PIN_1 5 +#define OUTPUT_PIN_2 9 +#define OUTPUT_PIN_3 6 +#define OUTPUT_PIN_4 10 + +// INPUT [BUTTON / SENSOR] +// General input +#define INPUT_PIN_1 2 +#define INPUT_PIN_2 3 +#define INPUT_PIN_3 4 +#define INPUT_PIN_4 A3 + +// Analog input +#define INPUT_PIN_5 A1 +#define INPUT_PIN_6 A2 +#define INPUT_PIN_7 A6 +#define INPUT_PIN_8 A7 + +// Protocols +// 1-wire +#define ONE_WIRE_PIN A0 + +// I2C +#define I2C_PIN_1 A4 +#define I2C_PIN_2 A5 + +/* ******************************************************************************************* + * ERROR REPORTING + * *******************************************************************************************/ +//#define ERROR_REPORTING +#ifdef ERROR_REPORTING + #ifdef POWER_SENSOR + #define ES_ID HYSTERESIS_ID+1 + #endif + #ifdef INTERNAL_TEMP + #define TS_ID ES_ID+1 + #endif + #ifdef EXTERNAL_TEMP + #define ETS_ID TS_ID+1 + #endif +#endif + +//#define RS485_DEBUG +#ifdef RS485_DEBUG + #define DEBUG_ID ETS_ID+1 +#endif + +#endif +/* + * + * EOF + * + */ diff --git a/Software/8RelayDin Shield/Arduino/main/ExpanderIO.cpp b/Software/8RelayDin Shield/Arduino/main/ExpanderIO.cpp new file mode 100644 index 0000000..47025e2 --- /dev/null +++ b/Software/8RelayDin Shield/Arduino/main/ExpanderIO.cpp @@ -0,0 +1,166 @@ +/* + * PinShift - variable corresponding to arythmetical difference + * between a sensor and its pin + */ + +#include "ExpanderIO.h" + +PCF8575 Expander; + +/* ******************************************************************************************* + * Constructor + * *******************************************************************************************/ +ExpanderIO::ExpanderIO() { + + NewState = 0; + State = 0; +} + +/* ******************************************************************************************* + * Expander Initialization + * *******************************************************************************************/ +void ExpanderIO::ExpanderInit(uint8_t Address) { + + Expander.begin(Address); +} + +/* ******************************************************************************************* + * Set Values + * *******************************************************************************************/ +void ExpanderIO::SetValues(bool RelayOFF, uint8_t Type, uint8_t Pin1, uint8_t Pin2) { + + _RelayOFF = RelayOFF; + + SensorType = Type; + switch(SensorType) { + // Door/window sensor + case 0: + _SensorPin = Pin1; + Expander.pinMode(_SensorPin, INPUT_PULLUP); + break; + // Motion sensor // not used + case 1: + _SensorPin = Pin1; + Expander.pinMode(_SensorPin, INPUT); + break; + // Relay output + case 2: + _RelayPin = Pin1; + Expander.pinMode(_RelayPin, OUTPUT); + Expander.digitalWrite(_RelayPin, _RelayOFF); + break; + // Button input + case 3: + _SensorPin = Pin1; + Expander.pinMode(_SensorPin, INPUT_PULLUP); + break; + // Button + Relay + case 4: + _SensorPin = Pin1; + _RelayPin = Pin2; + Expander.pinMode(_SensorPin, INPUT_PULLUP); + Expander.pinMode(_RelayPin, OUTPUT); + Expander.digitalWrite(_RelayPin, _RelayOFF); + break; + default: + break; + } +} + +/* ******************************************************************************************* + * Input Check + * *******************************************************************************************/ +void ExpanderIO::CheckInput() { + + bool Reading; + bool Shortpress = false; + uint32_t StartTime = millis(); + + do { + if(SensorType == 0 || SensorType == 3 || SensorType == 4) { + // Hardcoded DebounceValue = 50 + Reading = ReadDigital(50, false); + } + else { + Reading = ReadDigital(50, true); + } + + switch(SensorType) { + case 0: + case 1: + if(Reading == true) { + NewState = 1; + } + else { + NewState = 0; + } + break; + case 3: + case 4: + if(!Shortpress && Reading) { + NewState = !State; + Shortpress = true; + } + + // Hardcoded LongpressDuration = 1000 + if(millis() - StartTime > 1000) { + NewState = 2; + break; + } + + if(millis() < StartTime) { + StartTime = millis(); + } + break; + default: + break; + } + } while(Reading); +} + +// Read digital input +bool ExpanderIO::ReadDigital(uint8_t DebounceValue, bool Invert) { + + bool DigitalReading; + bool PreviousReading = false; + bool InputState = false; + uint32_t Timeout = millis(); + uint32_t StartTime = Timeout; + + do { + DigitalReading = (Invert ? Expander.digitalRead(_SensorPin) : !Expander.digitalRead(_SensorPin)); + + if(DigitalReading && !PreviousReading) { + StartTime = millis(); + } + + if(millis() - StartTime > DebounceValue) { + if(DigitalReading) { + InputState = true; + } + } + + if(millis() - Timeout > 255 || millis() < StartTime) { + break; + } + + PreviousReading = DigitalReading; + } while(DigitalReading); + + return InputState; +} + +/* ******************************************************************************************* + * Set Relay + * *******************************************************************************************/ +void ExpanderIO::SetRelay() { + + bool RelayValue = NewState == 1 ? !_RelayOFF : _RelayOFF; + Expander.digitalWrite(_RelayPin, RelayValue); + State = NewState; +} +/* + * + * EOF + * + */ diff --git a/Software/8RelayDin Shield/Arduino/main/ExpanderIO.h b/Software/8RelayDin Shield/Arduino/main/ExpanderIO.h new file mode 100644 index 0000000..16ca27f --- /dev/null +++ b/Software/8RelayDin Shield/Arduino/main/ExpanderIO.h @@ -0,0 +1,48 @@ +/* + * This is a code written for easy management of digital input/output sensors such as door/window/pir security sensors, + * buttons and relays. It menages easy sensor initialization, holds sensor states, changes relays states and provides a quite smart + * function for reading inputs (including special button functionality which change its state after one second of holding a button). + * + * + * SensorType: + * 0 - INPUT_PULLUP sensor + * 1 - INPUT sensor + * 2 - Relay output + * 3 - Button input + * 4 - Button input + Relay output + * + */ + +#ifndef ExpanderIO_h +#define ExpanderIO_h + +#include "Arduino.h" +#include +#include + +class ExpanderIO +{ + public: + ExpanderIO(); + + uint8_t SensorType; + uint8_t NewState; + uint8_t State; + + void ExpanderInit(uint8_t Address=0x20); + void SetValues(bool RelayOFF, uint8_t Type, uint8_t Pin1, uint8_t Pin2=0); + void CheckInput(); + void SetRelay(); + bool ReadDigital(uint8_t DebounceValue, bool Invert); + + private: + uint8_t _RelayPin; + uint8_t _SensorPin; + bool _LowStateDetection; + bool _HighStateDetection; + bool _Condition; + bool _RelayOFF; + +}; + +#endif diff --git a/Software/8RelayDin Shield/Arduino/main/main.ino b/Software/8RelayDin Shield/Arduino/main/main.ino new file mode 100644 index 0000000..922e38a --- /dev/null +++ b/Software/8RelayDin Shield/Arduino/main/main.ino @@ -0,0 +1,248 @@ +/* + * GetWired is an open source project for WIRED home automation. It aims at making wired + * home automation easy and affordable for every home automation enthusiast. GetWired provides: + * - hardware (https://www.crowdsupply.com/domatic/getwired), + * - software (https://github.com/feanor-anglin/GetWired-Project), + * - 3D printable enclosures (https://github.com/feanor-anglin/GetWired-Project/tree/master/Enclosures), + * - instructions (both campaign page / campaign updates and our GitHub wiki). + * + * GetWired is based on RS485 industrial communication standard. The software is an implementation + * of MySensors communication protocol (http://www.mysensors.org). + * + * Created by feanor-anglin + * Copyright (C) 2018-2022 feanor-anglin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 3 as published by the Free Software Foundation. + * + ******************************* + * + * DESCRIPTION + * This software is designed for GoWired MCU working with GoWired 8RelayDin board with 8 relays + * and 8 digital inputs. + * + * To define some important variables, look at Configuration.h + * + */ + +/* ******************************************************************************************* + * Includes + * *******************************************************************************************/ +#include "Configuration.h" +#include "ExpanderIO.h" +#include + + +/* ******************************************************************************************* + * Globals + * *******************************************************************************************/ +// Additional presentation status required by Home Assistant +bool InitConfirm = false; + +// Module Safety Indicators +bool THERMAL_ERROR = false; // Thermal error status + +/* ******************************************************************************************* + * Constructors + * *******************************************************************************************/ +// Expander Input constructor +ExpanderIO EIO[TOTAL_NUMBER_OF_OUTPUTS+INDEPENDENT_IO]; +MyMessage msgEIO(0, V_STATUS); + +// Module Safety Indicators +MyMessage msgSI(0, V_STATUS); + +/* ******************************************************************************************* + Before + * *******************************************************************************************/ +void before() { + + uint32_t InitDelay = MY_NODE_ID * INIT_DELAY; + + wait(InitDelay); +} + +/* ******************************************************************************************* + * Setup + * *******************************************************************************************/ +void setup() { + + // This function calls Expander.begin(0x20); + EIO[0].ExpanderInit(); + + for(int i=FIRST_OUTPUT_ID; i 0) { + IOUpdate(8, INDEPENDENT_IO); + } + +/* + #ifdef INTERNAL_TEMP + // Safety check + THERMAL_ERROR = IT.ThermalStatus(IT.MeasureT()); + + // Handling safety procedures + if(THERMAL_ERROR == true && InformControllerTS == false) { + // Board temperature to hot + // Turn off relays/triacs + HeatingStatus = false; + for(int i=FIRST_SECTION_ID; i LastUpdate + INTERVAL) { + ITUpdate(); + LastUpdate = millis(); + } + #endif*/ + + wait(LOOP_TIME); + +} diff --git a/Software/Ethernet Gateway/Gateway-MQTT/Gateway-MQTT.ino b/Software/Ethernet Gateway/Arduino/Gateway-MQTT/Gateway-MQTT.ino similarity index 97% rename from Software/Ethernet Gateway/Gateway-MQTT/Gateway-MQTT.ino rename to Software/Ethernet Gateway/Arduino/Gateway-MQTT/Gateway-MQTT.ino index d02904c..799ceaa 100644 --- a/Software/Ethernet Gateway/Gateway-MQTT/Gateway-MQTT.ino +++ b/Software/Ethernet Gateway/Arduino/Gateway-MQTT/Gateway-MQTT.ino @@ -1,149 +1,149 @@ -/** - * GetWired is an open source project for WIRED home automation. It aims at making wired - * home automation easy and affordable for every home automation enthusiast. GetWired provides: - * - hardware (https://www.crowdsupply.com/domatic/getwired), - * - software (https://github.com/feanor-anglin/GetWired-Project), - * - 3D printable enclosures (https://github.com/feanor-anglin/GetWired-Project/tree/master/Enclosures), - * - instructions (both campaign page / campaign updates and our GitHub wiki). - * - * GetWired is based on RS485 industrial communication standard. The software is an implementation - * of MySensors communication protocol (http://www.mysensors.org). - * - * Created by feanor-anglin - * Copyright (C) 2018-2020 feanor-anglin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 3 as published by the Free Software Foundation. * - * - * DESCRIPTION - * The Ethernet Gateway sends data received from sensors to the ethernet link. - * The gateway also accepts input on ethernet interface, which is then sent out to the RS485 network. - * Hardware serial is used with baud rate of 57600 by default. - * - * The code is designed for GetWired Ethernet Gateway - * - * LED purposes: - * - RX - blink fast on radio message received - * - TX - blink fast on radio message transmitted - * - ERR - fast blink on error during transmission error or receive crc error - * - CONF - turns on after pressing CONF button - * - * Buttons: - * - CONF - turns of bus power supply, cuts the power to any modules connected to the gateway. - * - */ - - -#define MY_RS485 // Enable RS485 transport layer -#define MY_RS485_DE_PIN 7 // Define this to enables DE-pin management on defined pin -#define MY_RS485_BAUD_RATE 57600 // Set RS485 baud rate to use -#define MY_RS485_HWSERIAL Serial // Enable for Hardware Serial -#define MY_RS485_SOH_COUNT 3 // Use this in case of collisions on the bus - -#define MY_GATEWAY_ENC28J60 // Enable gateway ethernet module type -#define MY_IP_ADDRESS 192,168,8,7 // Gateway IP address -#define MY_PORT 1883 // The port to keep open on node server mode / or port to contact in client mode -#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEB // Gateway MAC address - -#define MY_GATEWAY_MQTT_CLIENT -#define MY_MQTT_PUBLISH_TOPIC_PREFIX "gwo" -#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "gwi" -#define MY_MQTT_CLIENT_ID "G1" - -// Controller ip address. Enables client mode (default is "server" mode). -// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. -//#define MY_CONTROLLER_URL_ADDRESS "your-controller-url" -#define MY_CONTROLLER_IP_ADDRESS 192,168,8,8 - -#define MY_WITH_LEDS_BLINKING_INVERSE // Define to inverse LED behaviour -#define MY_DEFAULT_LED_BLINK_PERIOD 10 // Set blinking period -#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin -#define MY_DEFAULT_RX_LED_PIN 5 // Receive led pin -#define MY_DEFAULT_TX_LED_PIN 6 // Transmit led pin - -//#define MY_DEBUG // Enable debug prints to serial monitor - -// Includes -#include -#include - -// Definitions -#define CONF_BUTTON A0 -#define CONF_LED 9 -#define BUS_RELAY 8 - -// Globals -bool ButtonState = false; -bool ButtonHigh = false; -unsigned long TIME_1; - -void before() { - - pinMode(CONF_BUTTON, INPUT_PULLUP); - pinMode(BUS_RELAY, OUTPUT); - pinMode(CONF_LED, OUTPUT); - - pinMode(4, OUTPUT); - pinMode(5, OUTPUT); - pinMode(6, OUTPUT); - - digitalWrite(BUS_RELAY, 0); - digitalWrite(CONF_LED, 0); - ButtonState = 0; - - digitalWrite(4, 1); - digitalWrite(5, 1); - digitalWrite(6, 1); - digitalWrite(CONF_LED, 1); - delay(500); - digitalWrite(4, 0); - delay(500); - digitalWrite(5, 0); - delay(500); - digitalWrite(6, 0); - delay(500); - digitalWrite(CONF_LED, 0); - delay(500); - digitalWrite(4, 1); - digitalWrite(5, 1); - digitalWrite(6, 1); - digitalWrite(CONF_LED, 1); - delay(500); - digitalWrite(4, 0); - digitalWrite(5, 0); - digitalWrite(6, 0); - digitalWrite(CONF_LED, 0); -} - -void setup() { - -} - -void loop() { - - if(!ButtonHigh) { - if(digitalRead(CONF_BUTTON)) { - ButtonHigh = true; - } - } - - if(!digitalRead(CONF_BUTTON) && ButtonHigh) { - TIME_1 = millis(); - ButtonHigh = false; - while(!digitalRead(CONF_BUTTON)) { - wait(251); - if(millis() - TIME_1 > 500) { - ButtonState = !ButtonState; - digitalWrite(BUS_RELAY, ButtonState); - digitalWrite(CONF_LED, ButtonState); - break; - } - } - } - - wait(100); -} -/* - * End of file - */ +/** + * GetWired is an open source project for WIRED home automation. It aims at making wired + * home automation easy and affordable for every home automation enthusiast. GetWired provides: + * - hardware (https://www.crowdsupply.com/domatic/getwired), + * - software (https://github.com/feanor-anglin/GetWired-Project), + * - 3D printable enclosures (https://github.com/feanor-anglin/GetWired-Project/tree/master/Enclosures), + * - instructions (both campaign page / campaign updates and our GitHub wiki). + * + * GetWired is based on RS485 industrial communication standard. The software is an implementation + * of MySensors communication protocol (http://www.mysensors.org). + * + * Created by feanor-anglin + * Copyright (C) 2018-2020 feanor-anglin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 3 as published by the Free Software Foundation. * + * + * DESCRIPTION + * The Ethernet Gateway sends data received from sensors to the ethernet link. + * The gateway also accepts input on ethernet interface, which is then sent out to the RS485 network. + * Hardware serial is used with baud rate of 57600 by default. + * + * The code is designed for GetWired Ethernet Gateway + * + * LED purposes: + * - RX - blink fast on radio message received + * - TX - blink fast on radio message transmitted + * - ERR - fast blink on error during transmission error or receive crc error + * - CONF - turns on after pressing CONF button + * + * Buttons: + * - CONF - turns of bus power supply, cuts the power to any modules connected to the gateway. + * + */ + + +#define MY_RS485 // Enable RS485 transport layer +#define MY_RS485_DE_PIN 7 // Define this to enables DE-pin management on defined pin +#define MY_RS485_BAUD_RATE 57600 // Set RS485 baud rate to use +#define MY_RS485_HWSERIAL Serial // Enable for Hardware Serial +#define MY_RS485_SOH_COUNT 3 // Use this in case of collisions on the bus + +#define MY_GATEWAY_ENC28J60 // Enable gateway ethernet module type +#define MY_IP_ADDRESS 192,168,8,7 // Gateway IP address +#define MY_PORT 1883 // The port to keep open on node server mode / or port to contact in client mode +#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEB // Gateway MAC address + +#define MY_GATEWAY_MQTT_CLIENT +#define MY_MQTT_PUBLISH_TOPIC_PREFIX "gwo" +#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "gwi" +#define MY_MQTT_CLIENT_ID "G1" + +// Controller ip address. Enables client mode (default is "server" mode). +// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. +//#define MY_CONTROLLER_URL_ADDRESS "your-controller-url" +#define MY_CONTROLLER_IP_ADDRESS 192,168,8,8 + +#define MY_WITH_LEDS_BLINKING_INVERSE // Define to inverse LED behaviour +#define MY_DEFAULT_LED_BLINK_PERIOD 10 // Set blinking period +#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin +#define MY_DEFAULT_RX_LED_PIN 5 // Receive led pin +#define MY_DEFAULT_TX_LED_PIN 6 // Transmit led pin + +//#define MY_DEBUG // Enable debug prints to serial monitor + +// Includes +#include +#include + +// Definitions +#define CONF_BUTTON A0 +#define CONF_LED 9 +#define BUS_RELAY 8 + +// Globals +bool ButtonState = false; +bool ButtonHigh = false; +unsigned long TIME_1; + +void before() { + + pinMode(CONF_BUTTON, INPUT_PULLUP); + pinMode(BUS_RELAY, OUTPUT); + pinMode(CONF_LED, OUTPUT); + + pinMode(4, OUTPUT); + pinMode(5, OUTPUT); + pinMode(6, OUTPUT); + + digitalWrite(BUS_RELAY, 0); + digitalWrite(CONF_LED, 0); + ButtonState = 0; + + digitalWrite(4, 1); + digitalWrite(5, 1); + digitalWrite(6, 1); + digitalWrite(CONF_LED, 1); + delay(500); + digitalWrite(4, 0); + delay(500); + digitalWrite(5, 0); + delay(500); + digitalWrite(6, 0); + delay(500); + digitalWrite(CONF_LED, 0); + delay(500); + digitalWrite(4, 1); + digitalWrite(5, 1); + digitalWrite(6, 1); + digitalWrite(CONF_LED, 1); + delay(500); + digitalWrite(4, 0); + digitalWrite(5, 0); + digitalWrite(6, 0); + digitalWrite(CONF_LED, 0); +} + +void setup() { + +} + +void loop() { + + if(!ButtonHigh) { + if(digitalRead(CONF_BUTTON)) { + ButtonHigh = true; + } + } + + if(!digitalRead(CONF_BUTTON) && ButtonHigh) { + TIME_1 = millis(); + ButtonHigh = false; + while(!digitalRead(CONF_BUTTON)) { + wait(251); + if(millis() - TIME_1 > 500) { + ButtonState = !ButtonState; + digitalWrite(BUS_RELAY, ButtonState); + digitalWrite(CONF_LED, ButtonState); + break; + } + } + } + + wait(100); +} +/* + * End of file + */ diff --git a/Software/Ethernet Gateway/Gateway/Gateway.ino b/Software/Ethernet Gateway/Arduino/Gateway/Gateway.ino similarity index 100% rename from Software/Ethernet Gateway/Gateway/Gateway.ino rename to Software/Ethernet Gateway/Arduino/Gateway/Gateway.ino diff --git a/Software/Heating Controller/main/Configuration.h b/Software/Heating Controller/Arduino/main/Configuration.h similarity index 100% rename from Software/Heating Controller/main/Configuration.h rename to Software/Heating Controller/Arduino/main/Configuration.h diff --git a/Software/Heating Controller/main/Heating.cpp b/Software/Heating Controller/Arduino/main/Heating.cpp similarity index 100% rename from Software/Heating Controller/main/Heating.cpp rename to Software/Heating Controller/Arduino/main/Heating.cpp diff --git a/Software/Heating Controller/main/Heating.h b/Software/Heating Controller/Arduino/main/Heating.h similarity index 100% rename from Software/Heating Controller/main/Heating.h rename to Software/Heating Controller/Arduino/main/Heating.h diff --git a/Software/Heating Controller/main/main.ino b/Software/Heating Controller/Arduino/main/main.ino similarity index 100% rename from Software/Heating Controller/main/main.ino rename to Software/Heating Controller/Arduino/main/main.ino diff --git a/Software/Modules/main/Configuration.h b/Software/Modules/Arduino/main/Configuration.h similarity index 99% rename from Software/Modules/main/Configuration.h rename to Software/Modules/Arduino/main/Configuration.h index 69c9f24..f09cbc3 100644 --- a/Software/Modules/main/Configuration.h +++ b/Software/Modules/Arduino/main/Configuration.h @@ -14,7 +14,7 @@ // Identification #define MY_NODE_ID 1 // Set node ID #define SN "GetWired Module" // Set node name to present to a controller -#define SV "1.0" // Set sensor version +#define SV "1.2" // Set sensor version // Selecting transmission settings #define MY_RS485 // Enable RS485 transport layer diff --git a/Software/Modules/main/Dimmer.cpp b/Software/Modules/Arduino/main/Dimmer.cpp similarity index 62% rename from Software/Modules/main/Dimmer.cpp rename to Software/Modules/Arduino/main/Dimmer.cpp index ce488b7..2dd1ab6 100644 --- a/Software/Modules/main/Dimmer.cpp +++ b/Software/Modules/Arduino/main/Dimmer.cpp @@ -9,7 +9,8 @@ * *******************************************************************************************/ Dimmer::Dimmer() { - NewState = 0; + NewDimmingLevel = 20; + CurrentState = false; _DimmingLevel = 20; } @@ -23,20 +24,74 @@ void Dimmer::SetValues(uint8_t NumberOfChannels, uint8_t DimmingStep, uint8_t Di _DimmingStep = DimmingStep; _DimmingInterval = DimmingInterval; - //_DimmerTime = 0; - _DimmerState = false; + uint8_t Channels[4] = {Pin1, Pin2, Pin3, Pin4}; + + for(int i=0; i<_NumberOfChannels; i++) { + _Channels[i] = Channels[i]; + } +} + +// Update Dimmer: New, experimental function which adjust colors and dimming level at the same time +void Dimmer::UpdateDimmer() { + + bool AdjustDimming = true; + bool AdjustColors = true; + bool ColorStates[4] = {false, false, false, false}; + uint8_t DeltaDimming = 0; + uint8_t DeltaColors = 0; + uint32_t Time = millis() - _DimmingInterval; + + if(CurrentState) { + do { + if(millis() > Time + _DimmingInterval) { + if(_DimmingLevel != NewDimmingLevel) { + AdjustDimming = true; + DeltaDimming = (NewDimmingLevel - _DimmingLevel) < 0 ? -_DimmingStep : _DimmingStep; + _DimmingLevel += DeltaDimming; + } + else { + AdjustDimming = false; + } - if(_NumberOfChannels == 3) { - _Channels[0] = Pin1; - _Channels[1] = Pin2; - _Channels[2] = Pin3; - } - else if(_NumberOfChannels == 4) { - _Channels[0] = Pin1; - _Channels[1] = Pin2; - _Channels[2] = Pin3; - _Channels[3] = Pin4; - } + for(int i=0; i<_NumberOfChannels; i++) { + if(_Values[i] != NewValues[i]) { + ColorStates[i] = true; + DeltaColors = (_Values[i] - NewValues[i]) > 0 ? -_DimmingStep : _DimmingStep; + _Values[i] += DeltaColors; + } + else { + ColorStates[i] = false; + } + } + + for(int i=0; i<_NumberOfChannels; i++) { + if(ColorStates[i] == true) { + AdjustColors = true; + break; + } + else { + AdjustColors = false; + } + } + + for(int i=0; i<_NumberOfChannels; i++) { + analogWrite(_Channels[i], (int)(_DimmingLevel / 100.0 * _Values[i])); + } + + Time = millis(); + } + else if(millis() < Time) { + Time = millis(); + } + } while(AdjustColors || AdjustDimming); + } +} + +void Dimmer::ChangeValuesOffline() { + + for(int i=0; i<_NumberOfChannels; i++) { + _Values[i] = NewValues[i]; + } } /* ******************************************************************************************* @@ -55,7 +110,7 @@ void Dimmer::ChangeLevel() { analogWrite(_Channels[i], (int)(_DimmingLevel / 100.0 * _Values[i])); } } - if(millis() < Time) { + else if(millis() < Time) { Time = millis(); } } @@ -73,11 +128,11 @@ void Dimmer::ChangeColors() { Delta = (_Values[i] - NewValues[i]) > 0 ? -_DimmingStep : _DimmingStep; while(_Values[i] != NewValues[i]) { if(millis() > Time + _DimmingInterval) { + Time = millis(); _Values[i] += Delta; analogWrite(_Channels[i], (int)(_DimmingLevel / 100.0 * _Values[i])); - Time = millis(); } - if(millis() < Time) { + else if(millis() < Time) { Time = millis(); } } @@ -87,26 +142,29 @@ void Dimmer::ChangeColors() { /* ******************************************************************************************* * Change Status * *******************************************************************************************/ -void Dimmer::ChangeState() { +void Dimmer::ChangeState(bool NewState) { - //uint8_t NewLevel; + uint8_t TempDimmingLevel = NewDimmingLevel; - _DimmerState = NewState; + if(NewState != CurrentState) { + CurrentState = NewState; - if(!NewState) { - uint8_t TempLevel = _DimmingLevel; - NewDimmingLevel = 0; + if(!NewState) { + uint8_t TempLevel = _DimmingLevel; + NewDimmingLevel = 0; - ChangeLevel(); + ChangeLevel(); - _DimmingLevel = TempLevel; - } - else { - NewDimmingLevel = _DimmingLevel; - _DimmingLevel = 0; + _DimmingLevel = TempLevel; + } + else { + //NewDimmingLevel = _DimmingLevel; + _DimmingLevel = 0; - ChangeLevel(); + ChangeLevel(); + } } + NewDimmingLevel = TempDimmingLevel; } /* ******************************************************************************************* diff --git a/Software/Modules/main/Dimmer.h b/Software/Modules/Arduino/main/Dimmer.h similarity index 78% rename from Software/Modules/main/Dimmer.h rename to Software/Modules/Arduino/main/Dimmer.h index 90e8d15..2e5caa8 100644 --- a/Software/Modules/main/Dimmer.h +++ b/Software/Modules/Arduino/main/Dimmer.h @@ -13,22 +13,23 @@ class Dimmer Dimmer(); void SetValues(uint8_t NumberOfChannels, uint8_t DimmingStep, uint8_t DimmingInterval, uint8_t Pin1, uint8_t Pin2, uint8_t Pin3, uint8_t Pin4=0); + void UpdateDimmer(); + void ChangeValuesOffline(); void ChangeLevel(); void ChangeColors(); - void ChangeState(); + void ChangeState(bool NewState); void NewColorValues(const char *input); - bool NewState = 0; - uint8_t NewDimmingLevel = 0; + bool CurrentState; + uint8_t NewDimmingLevel; uint8_t NewValues[4] = {255, 255, 255, 255}; private: - bool _DimmerState; uint8_t _NumberOfChannels; uint8_t _DimmingStep; uint8_t _DimmingInterval; uint8_t _Channels[4]; - uint8_t _Values[4] = {255, 255, 255, 255}; + uint8_t _Values[4] = {0, 0, 0, 0}; uint8_t _DimmingLevel; //uint32_t _DimmerTime; diff --git a/Software/Modules/main/IODigital.cpp b/Software/Modules/Arduino/main/IODigital.cpp similarity index 58% rename from Software/Modules/main/IODigital.cpp rename to Software/Modules/Arduino/main/IODigital.cpp index 1b92ec8..0d3a4a8 100644 --- a/Software/Modules/main/IODigital.cpp +++ b/Software/Modules/Arduino/main/IODigital.cpp @@ -1,116 +1,154 @@ -/* - * IODigital.cpp - */ - -#include "IODigital.h" - -/* ******************************************************************************************* - * Constructor - * *******************************************************************************************/ -IODigital::IODigital() { - - NewState = 0; - OldState = 0; -} - -/* ******************************************************************************************* - * Set Values - * *******************************************************************************************/ -void IODigital::SetValues(bool RelayOFF, uint8_t Type, uint8_t Pin1, uint8_t Pin2) { - - _RelayOFF = RelayOFF; - - SensorType = Type; - switch(SensorType) { - // Door/window sensor - case 0: - _SensorPin = Pin1; - pinMode(_SensorPin, INPUT_PULLUP); - break; - // Motion sensor - case 1: - _SensorPin = Pin1; - pinMode(_SensorPin, INPUT); - break; - // Relay output - case 2: - _RelayPin = Pin1; - pinMode(_RelayPin, OUTPUT); - digitalWrite(_RelayPin, _RelayOFF); - break; - // Button input - case 3: - _SensorPin = Pin1; - pinMode(_SensorPin, INPUT_PULLUP); - break; - // Button + Relay - case 4: - _SensorPin = Pin1; - _RelayPin = Pin2; - pinMode(_SensorPin, INPUT_PULLUP); - pinMode(_RelayPin, OUTPUT); - digitalWrite(_RelayPin, _RelayOFF); - break; - default: - break; - } -} - -/* ******************************************************************************************* - * Input Check - * *******************************************************************************************/ -void IODigital::CheckInput() { - - if(SensorType == 0 || SensorType == 1) { - if(digitalRead(_SensorPin) == LOW) { - NewState = 0; - } - else if(digitalRead(_SensorPin) != LOW) { - NewState = 1; - } - } - else if(SensorType == 3 || SensorType == 4) { - - if(digitalRead(_SensorPin) != LOW) { - _HighStateDetection = true; - _LowStateDetection = false; - _Condition = false; - } - if(_HighStateDetection == true) { - unsigned long StartTime = millis(); - while(digitalRead(_SensorPin) == LOW) { - _LowStateDetection = true; - _HighStateDetection = false; - if(millis() - StartTime > 1000) { - _Condition = true; - break; - } - } - if(_Condition == false && _LowStateDetection == true) { - if(OldState == 0) { - NewState = 1; - } - else if(OldState == 1) { - NewState = 0; - } - } - else if(_Condition == true) { - NewState = 2; - } - } - } -} - -/* ******************************************************************************************* - * Set Relay - * *******************************************************************************************/ -void IODigital::SetRelay() { - - digitalWrite(_RelayPin, NewState); - OldState = NewState; -} -/* - * - * EOF - * - */ +/* + * IODigital.cpp + */ + +#include "IODigital.h" + +/* ******************************************************************************************* + * Constructor + * *******************************************************************************************/ +IODigital::IODigital() { + + NewState = 0; + OldState = 0; +} + +/* ******************************************************************************************* + * Set Values + * *******************************************************************************************/ +void IODigital::SetValues(bool RelayOFF, uint8_t Type, uint8_t Pin1, uint8_t Pin2) { + + _RelayOFF = RelayOFF; + + SensorType = Type; + switch(SensorType) { + // Door/window sensor + case 0: + _SensorPin = Pin1; + pinMode(_SensorPin, INPUT_PULLUP); + break; + // Motion sensor + case 1: + _SensorPin = Pin1; + pinMode(_SensorPin, INPUT); + break; + // Relay output + case 2: + _RelayPin = Pin1; + pinMode(_RelayPin, OUTPUT); + digitalWrite(_RelayPin, _RelayOFF); + break; + // Button input + case 3: + _SensorPin = Pin1; + pinMode(_SensorPin, INPUT_PULLUP); + break; + // Button + Relay + case 4: + _SensorPin = Pin1; + _RelayPin = Pin2; + pinMode(_SensorPin, INPUT_PULLUP); + pinMode(_RelayPin, OUTPUT); + digitalWrite(_RelayPin, _RelayOFF); + break; + default: + break; + } +} + +/* ******************************************************************************************* + * Input Check + * *******************************************************************************************/ +void IODigital::CheckInput() { + + bool Reading; + bool Shortpress = false; + uint32_t StartTime = millis(); + + do { + if(SensorType == 0 || SensorType == 3 || SensorType == 4) { + // Hardcoded DebounceValue = 50 + Reading = ReadDigital(50, false); + } + else { + Reading = ReadDigital(50, true); + } + + switch(SensorType) { + case 0: + case 1: + if(Reading == true) { + NewState = 1; + } + else { + NewState = 0; + } + break; + case 3: + case 4: + if(!Shortpress && Reading) { + NewState = !OldState; + Shortpress = true; + } + + // Hardcoded LongpressDuration = 1000 + if(millis() - StartTime > 1000) { + NewState = 2; + break; + } + + if(millis() < StartTime) { + StartTime = millis(); + } + break; + default: + break; + } + } while(Reading); +} + +// Read digital input +bool IODigital::ReadDigital(uint8_t DebounceValue, bool Invert) { + + bool DigitalReading; + bool PreviousReading = false; + bool InputState = false; + uint32_t Timeout = millis(); + uint32_t StartTime = Timeout; + + do { + DigitalReading = (Invert ? digitalRead(_SensorPin) : !digitalRead(_SensorPin)); + + if(DigitalReading && !PreviousReading) { + StartTime = millis(); + } + + if(millis() - StartTime > DebounceValue) { + if(DigitalReading) { + InputState = true; + } + } + + if(millis() - Timeout > 255 || millis() < StartTime) { + break; + } + + PreviousReading = DigitalReading; + } while(DigitalReading); + + return InputState; +} + +/* ******************************************************************************************* + * Set Relay + * *******************************************************************************************/ +void IODigital::SetRelay() { + + digitalWrite(_RelayPin, NewState); + OldState = NewState; +} +/* + * + * EOF + * + */ diff --git a/Software/Modules/main/IODigital.h b/Software/Modules/Arduino/main/IODigital.h similarity index 86% rename from Software/Modules/main/IODigital.h rename to Software/Modules/Arduino/main/IODigital.h index a5799dc..7198a4d 100644 --- a/Software/Modules/main/IODigital.h +++ b/Software/Modules/Arduino/main/IODigital.h @@ -1,42 +1,43 @@ -/* - * IODigital.h - * - * SensorType: - * 0 - INPUT_PULLUP sensor - * 1 - INPUT sensor - * 2 - Relay output - * 3 - Button input - * 4 - Button input + Relay output - * - */ - -#ifndef IODigital_h -#define IODigital_h - -#include "Arduino.h" - - -class IODigital -{ - public: - IODigital(); - - uint8_t SensorType; - uint8_t NewState; - uint8_t OldState; - - void SetValues(bool RelayOFF, uint8_t Type, uint8_t Pin1, uint8_t Pin2=0); - void CheckInput(); - void SetRelay(); - - private: - uint8_t _RelayPin; - uint8_t _SensorPin; - bool _LowStateDetection; - bool _HighStateDetection; - bool _Condition; - bool _RelayOFF; - -}; - -#endif +/* + * IODigital.h + * + * SensorType: + * 0 - INPUT_PULLUP sensor + * 1 - INPUT sensor + * 2 - Relay output + * 3 - Button input + * 4 - Button input + Relay output + * + */ + +#ifndef IODigital_h +#define IODigital_h + +#include "Arduino.h" + + +class IODigital +{ + public: + IODigital(); + + uint8_t SensorType; + uint8_t NewState; + uint8_t OldState; + + void SetValues(bool RelayOFF, uint8_t Type, uint8_t Pin1, uint8_t Pin2=0); + void CheckInput(); + void SetRelay(); + bool ReadDigital(uint8_t DebounceValue, bool Invert); + + private: + uint8_t _RelayPin; + uint8_t _SensorPin; + bool _LowStateDetection; + bool _HighStateDetection; + bool _Condition; + bool _RelayOFF; + +}; + +#endif diff --git a/Software/Modules/main/InternalTemp.cpp b/Software/Modules/Arduino/main/InternalTemp.cpp similarity index 100% rename from Software/Modules/main/InternalTemp.cpp rename to Software/Modules/Arduino/main/InternalTemp.cpp diff --git a/Software/Modules/main/InternalTemp.h b/Software/Modules/Arduino/main/InternalTemp.h similarity index 100% rename from Software/Modules/main/InternalTemp.h rename to Software/Modules/Arduino/main/InternalTemp.h diff --git a/Software/Modules/main/PowerSensor.cpp b/Software/Modules/Arduino/main/PowerSensor.cpp similarity index 100% rename from Software/Modules/main/PowerSensor.cpp rename to Software/Modules/Arduino/main/PowerSensor.cpp diff --git a/Software/Modules/main/PowerSensor.h b/Software/Modules/Arduino/main/PowerSensor.h similarity index 100% rename from Software/Modules/main/PowerSensor.h rename to Software/Modules/Arduino/main/PowerSensor.h diff --git a/Software/Modules/main/RShutterControl.cpp b/Software/Modules/Arduino/main/RShutterControl.cpp similarity index 100% rename from Software/Modules/main/RShutterControl.cpp rename to Software/Modules/Arduino/main/RShutterControl.cpp diff --git a/Software/Modules/main/RShutterControl.h b/Software/Modules/Arduino/main/RShutterControl.h similarity index 100% rename from Software/Modules/main/RShutterControl.h rename to Software/Modules/Arduino/main/RShutterControl.h diff --git a/Software/Modules/main/main.ino b/Software/Modules/Arduino/main/main.ino similarity index 96% rename from Software/Modules/main/main.ino rename to Software/Modules/Arduino/main/main.ino index b90e129..1d5d5d0 100644 --- a/Software/Modules/main/main.ino +++ b/Software/Modules/Arduino/main/main.ino @@ -155,7 +155,7 @@ void before() { void setup() { #ifdef ENABLE_WATCHDOG - wdt_enable(WDTO_2S); + wdt_enable(WDTO_8S); #endif float Vcc = ReadVcc(); // mV @@ -420,7 +420,7 @@ void InitConfirmation() { request(DIMMER_ID, V_STATUS); wait(2000, C_SET, V_STATUS); - send(msgDIM.set(0)); + send(msgDIM.set(Dimmer.NewDimmingLevel)); request(DIMMER_ID, V_PERCENTAGE); wait(2000, C_SET, V_PERCENTAGE); @@ -431,11 +431,11 @@ void InitConfirmation() { request(DIMMER_ID, V_STATUS); wait(2000, C_SET, V_STATUS); - send(msgDIM.set(0)); + send(msgDIM.set(Dimmer.NewDimmingLevel)); request(DIMMER_ID, V_PERCENTAGE); wait(2000, C_SET, V_PERCENTAGE); - send(msgDIM2.set("000000")); + send(msgDIM2.set("ffffff")); request(DIMMER_ID, V_RGB); wait(2000, C_SET, V_RGB); @@ -446,11 +446,11 @@ void InitConfirmation() { request(DIMMER_ID, V_STATUS); wait(2000, C_SET, V_STATUS); - send(msgDIM.set(0)); + send(msgDIM.set(Dimmer.NewDimmingLevel)); request(DIMMER_ID, V_PERCENTAGE); wait(2000, C_SET, V_PERCENTAGE); - send(msgDIM3.set("00000000")); + send(msgDIM3.set("ffffffff")); request(DIMMER_ID, V_RGBW); wait(2000, C_SET, V_RGBW); @@ -558,8 +558,8 @@ void receive(const MyMessage &message) { #endif*/ #if defined(DIMMER) || defined(RGB) || defined(RGBW) if (message.sensor == DIMMER_ID) { - Dimmer.NewState = message.getBool(); - Dimmer.ChangeState(); + //Dimmer.NewState = message.getBool(); + Dimmer.ChangeState(message.getBool()); } #endif #if defined(DOUBLE_RELAY) @@ -599,9 +599,6 @@ void receive(const MyMessage &message) { Dimmer.NewDimmingLevel = atoi(message.data); Dimmer.NewDimmingLevel = Dimmer.NewDimmingLevel > 100 ? 100 : Dimmer.NewDimmingLevel; Dimmer.NewDimmingLevel = Dimmer.NewDimmingLevel < 0 ? 0 : Dimmer.NewDimmingLevel; - - Dimmer.NewState = true; - Dimmer.ChangeLevel(); } #endif } @@ -610,9 +607,7 @@ void receive(const MyMessage &message) { if(message.sensor == DIMMER_ID) { const char *rgbvalues = message.getString(); - Dimmer.NewState = true; Dimmer.NewColorValues(rgbvalues); - Dimmer.ChangeColors(); } #endif } @@ -727,10 +722,9 @@ void IODUpdate() { #ifdef DIMMER_ID if(i == 0) { if(IOD[i].NewState != 2) { - // Change dimmer status - Dimmer.NewState = !Dimmer.NewState; - send(msgIOD.setSensor(DIMMER_ID).set(Dimmer.NewState)); - Dimmer.ChangeState(); + // Change dimmer state + Dimmer.ChangeState(!Dimmer.CurrentState); + send(msgIOD.setSensor(DIMMER_ID).set(Dimmer.CurrentState)); IOD[i].OldState = IOD[i].NewState; } #ifdef SPECIAL_BUTTON @@ -742,15 +736,13 @@ void IODUpdate() { } else if(i == 1) { if(IOD[i].NewState != 2) { - if(Dimmer.NewState) { + if(Dimmer.CurrentState) { // Toggle dimming level by DIMMING_TOGGLE_STEP Dimmer.NewDimmingLevel += DIMMING_TOGGLE_STEP; - Dimmer.NewDimmingLevel = Dimmer.NewDimmingLevel > 100 ? DIMMING_TOGGLE_STEP : Dimmer.NewDimmingLevel; send(msgDIM.set(Dimmer.NewDimmingLevel)); - Dimmer.ChangeLevel(); - IOD[i].OldState = IOD[i].NewState; } + IOD[i].NewState = IOD[i].OldState; } } #endif @@ -810,7 +802,7 @@ void RSCalibration(float Vcc) { RS.Movement(); do { - delay(100); + delay(250); wdt_reset(); Current = PS.MeasureAC(Vcc); } while(Current > PS_OFFSET); @@ -828,7 +820,7 @@ void RSCalibration(float Vcc) { StartTime = millis(); do { - delay(100); + delay(250); Current = PS.MeasureAC(Vcc); StopTime = millis(); wdt_reset(); @@ -982,6 +974,10 @@ void loop() { RSUpdate(); #endif + #if defined(DIMMER) || defined(RGB) || defined(RGBW) + Dimmer.UpdateDimmer(); + #endif + // Reading power sensor(s) #if defined(POWER_SENSOR) && !defined(FOUR_RELAY) #if defined(DOUBLE_RELAY) || defined(ROLLER_SHUTTER) @@ -989,7 +985,7 @@ void loop() { Current = PS.MeasureAC(Vcc); } #elif defined(DIMMER) || defined(RGB) || defined(RGBW) - if (Dimmer.NewState) { + if (Dimmer.CurrentState) { Current = PS.MeasureDC(Vcc); } #endif @@ -1069,9 +1065,9 @@ void loop() { RS.NewState = 2; RSUpdate(); #elif defined(DIMMER) || defined(RGB) || defined(RGBW) - Dimmer.NewState = false; - Dimmer.ChangeState(); - send(msgIOD.setSensor(DIMMER_ID).set(Dimmer.NewState)); + //Dimmer.NewState = false; + Dimmer.ChangeState(false); + send(msgIOD.setSensor(DIMMER_ID).set(Dimmer.CurrentState)); #endif send(msgSI.setSensor(ES_ID).set(OVERCURRENT_ERROR[0])); @@ -1104,9 +1100,9 @@ void loop() { RS.NewState = 2; RSUpdate(); #elif defined(DIMMER) || defined(RGB) || defined(RGBW) - Dimmer.NewState = false; - Dimmer.ChangeState(); - send(msgIOD.setSensor(DIMMER_ID).set(Dimmer.NewState)); + //Dimmer.NewState = false; + Dimmer.ChangeState(false); + send(msgIOD.setSensor(DIMMER_ID).set(Dimmer.CurrentState)); #endif send(msgSI.setSensor(TS_ID).set(THERMAL_ERROR)); InformControllerTS = true; diff --git a/Software/Multiprotocol Gateway/Readme.md b/Software/Multiprotocol Gateway/Readme.md index e69de29..67f9e57 100644 --- a/Software/Multiprotocol Gateway/Readme.md +++ b/Software/Multiprotocol Gateway/Readme.md @@ -0,0 +1 @@ +**GoWired Multiprotocol Gateway** has its own repository [here](https://github.com/GoWired/Multiprotocol-Gateway). \ No newline at end of file