Closed sbritto0228 closed 3 days ago
Sorry this is a newbie error. For any newbie out there: 1) Unzip the folder 2) copy the unzipped folder to C:\Users\yourID\Documents\Arduino 2) rename config.h.sample to config.h 3) Open the .ino file inside the repository (hampton-bay-fan-mqtt.ino) 4) Sketch Verify and compile 5) Upload
Hello,
I am a newbie at this so maybe I am doing something wrong. I used the OwenBay sketch and it worked (I can turn the fan on and off however the max speed is not max). I wanted to try your sketch.
In Github I went to code download zip, extracted it and copied it into Arduino/libraries. Then in Ardiuino
File --> Open --> rf-fans rf-fans.ino Sketch Verify/Compile and I get the error below. I should alos mention that in notepad I open "config.h.sample" and update my WiFi & MQTT settings. Any help will be appreciated.
`Arduino: 1.8.7 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Invalid library found in C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master: no headers files (.h) found in C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master sketch\fanimation.cpp: In function 'void postStateUpdate(int)':
fanimation.cpp:4:20: error: expected ')' before 'FANIMATION_BASE_TOPIC'
define BASE_TOPIC FANIMATION_BASE_TOPIC
sketch\fanimation.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\fanimation.cpp:31:40: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/direction", STAT_BASE_TOPIC, idStrings[id]);
fanimation.cpp:4:20: error: expected ')' before 'FANIMATION_BASE_TOPIC'
define BASE_TOPIC FANIMATION_BASE_TOPIC
sketch\fanimation.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\fanimation.cpp:33:34: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/fan", STAT_BASE_TOPIC, idStrings[id]);
fanimation.cpp:4:20: error: expected ')' before 'FANIMATION_BASE_TOPIC'
define BASE_TOPIC FANIMATION_BASE_TOPIC
sketch\fanimation.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\fanimation.cpp:35:36: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/speed", STAT_BASE_TOPIC, idStrings[id]);
fanimation.cpp:4:20: error: expected ')' before 'FANIMATION_BASE_TOPIC'
define BASE_TOPIC FANIMATION_BASE_TOPIC
sketch\fanimation.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\fanimation.cpp:41:36: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/light", STAT_BASE_TOPIC, idStrings[id]);
fanimation.cpp:4:20: error: expected ')' before 'FANIMATION_BASE_TOPIC'
define BASE_TOPIC FANIMATION_BASE_TOPIC
sketch\fanimation.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\fanimation.cpp:43:37: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/light2", STAT_BASE_TOPIC, idStrings[id]);
fanimation.cpp:4:20: error: expected ')' before 'FANIMATION_BASE_TOPIC'
define BASE_TOPIC FANIMATION_BASE_TOPIC
sketch\fanimation.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\fanimation.cpp:46:38: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/percent", STAT_BASE_TOPIC, idStrings[id]);
sketch\fanimation.cpp: In function 'void fanimationMQTT(char, char, unsigned int)':
fanimation.cpp:4:20: error: expected ')' before 'FANIMATION_BASE_TOPIC'
define BASE_TOPIC FANIMATION_BASE_TOPIC
sketch\fanimation.cpp:6:36: note: in expansion of macro 'BASE_TOPIC'
define CMND_BASE_TOPIC CMND_TOPIC BASE_TOPIC
sketch\fanimation.cpp:122:21: note: in expansion of macro 'CMND_BASE_TOPIC'
if(strncmp(topic, CMND_BASE_TOPIC, sizeof(CMND_BASE_TOPIC)-1) == 0) {
fanimation.cpp:4:20: error: expected ')' before 'FANIMATION_BASE_TOPIC'
define BASE_TOPIC FANIMATION_BASE_TOPIC
sketch\fanimation.cpp:6:36: note: in expansion of macro 'BASE_TOPIC'
define CMND_BASE_TOPIC CMND_TOPIC BASE_TOPIC
sketch\fanimation.cpp:122:45: note: in expansion of macro 'CMND_BASE_TOPIC'
if(strncmp(topic, CMND_BASE_TOPIC, sizeof(CMND_BASE_TOPIC)-1) == 0) {
fanimation.cpp:495:1: error: expected ')' at end of input
}
^
fanimation.cpp:495:1: error: expected ')' at end of input
fanimation.cpp:495:1: error: expected statement at end of input
fanimation.cpp:495:1: error: expected '}' at end of input
sketch\hamptonbay.cpp: In function 'void postStateUpdate(int)':
hamptonbay.cpp:4:20: error: expected ')' before 'HAMPTONBAY_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY_BASE_TOPIC
sketch\hamptonbay.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay.cpp:27:34: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/fan", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay.cpp:4:20: error: expected ')' before 'HAMPTONBAY_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY_BASE_TOPIC
sketch\hamptonbay.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay.cpp:29:36: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/speed", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay.cpp:4:20: error: expected ')' before 'HAMPTONBAY_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY_BASE_TOPIC
sketch\hamptonbay.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay.cpp:31:36: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/light", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay.cpp:4:20: error: expected ')' before 'HAMPTONBAY_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY_BASE_TOPIC
sketch\hamptonbay.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay.cpp:34:38: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/percent", STAT_BASE_TOPIC, idStrings[id]);
sketch\hamptonbay.cpp: In function 'void hamptonbayMQTT(char, char, unsigned int)':
hamptonbay.cpp:4:20: error: expected ')' before 'HAMPTONBAY_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY_BASE_TOPIC
sketch\hamptonbay.cpp:6:36: note: in expansion of macro 'BASE_TOPIC'
define CMND_BASE_TOPIC CMND_TOPIC BASE_TOPIC
sketch\hamptonbay.cpp:85:21: note: in expansion of macro 'CMND_BASE_TOPIC'
if(strncmp(topic, CMND_BASE_TOPIC, sizeof(CMND_BASE_TOPIC)-1) == 0) {
hamptonbay.cpp:4:20: error: expected ')' before 'HAMPTONBAY_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY_BASE_TOPIC
sketch\hamptonbay.cpp:6:36: note: in expansion of macro 'BASE_TOPIC'
define CMND_BASE_TOPIC CMND_TOPIC BASE_TOPIC
sketch\hamptonbay.cpp:85:45: note: in expansion of macro 'CMND_BASE_TOPIC'
if(strncmp(topic, CMND_BASE_TOPIC, sizeof(CMND_BASE_TOPIC)-1) == 0) {
hamptonbay.cpp:278:1: error: expected ')' at end of input
}
^
hamptonbay.cpp:278:1: error: expected ')' at end of input
hamptonbay.cpp:278:1: error: expected statement at end of input
hamptonbay.cpp:278:1: error: expected '}' at end of input
sketch\hamptonbay2.cpp: In function 'void postStateUpdate(int)':
hamptonbay2.cpp:4:20: error: expected ')' before 'HAMPTONBAY2_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY2_BASE_TOPIC
sketch\hamptonbay2.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay2.cpp:30:36: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/power", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay2.cpp:4:20: error: expected ')' before 'HAMPTONBAY2_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY2_BASE_TOPIC
sketch\hamptonbay2.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay2.cpp:32:34: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/fan", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay2.cpp:4:20: error: expected ')' before 'HAMPTONBAY2_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY2_BASE_TOPIC
sketch\hamptonbay2.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay2.cpp:34:36: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/speed", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay2.cpp:4:20: error: expected ')' before 'HAMPTONBAY2_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY2_BASE_TOPIC
sketch\hamptonbay2.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay2.cpp:36:36: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/light", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay2.cpp:4:20: error: expected ')' before 'HAMPTONBAY2_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY2_BASE_TOPIC
sketch\hamptonbay2.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay2.cpp:39:38: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/percent", STAT_BASE_TOPIC, idStrings[id]);
sketch\hamptonbay2.cpp: In function 'void hamptonbay2MQTT(char, char, unsigned int)':
hamptonbay2.cpp:4:20: error: expected ')' before 'HAMPTONBAY2_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY2_BASE_TOPIC
sketch\hamptonbay2.cpp:6:36: note: in expansion of macro 'BASE_TOPIC'
define CMND_BASE_TOPIC CMND_TOPIC BASE_TOPIC
sketch\hamptonbay2.cpp:90:21: note: in expansion of macro 'CMND_BASE_TOPIC'
if(strncmp(topic, CMND_BASE_TOPIC, sizeof(CMND_BASE_TOPIC)-1) == 0) {
hamptonbay2.cpp:4:20: error: expected ')' before 'HAMPTONBAY2_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY2_BASE_TOPIC
sketch\hamptonbay2.cpp:6:36: note: in expansion of macro 'BASE_TOPIC'
define CMND_BASE_TOPIC CMND_TOPIC BASE_TOPIC
sketch\hamptonbay2.cpp:90:45: note: in expansion of macro 'CMND_BASE_TOPIC'
if(strncmp(topic, CMND_BASE_TOPIC, sizeof(CMND_BASE_TOPIC)-1) == 0) {
hamptonbay2.cpp:391:1: error: expected ')' at end of input
}
^
hamptonbay2.cpp:391:1: error: expected ')' at end of input
hamptonbay2.cpp:391:1: error: expected statement at end of input
hamptonbay2.cpp:391:1: error: expected '}' at end of input
C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master\rf-fans\rf-fans.ino: In function 'void setup_wifi()':
rf-fans:95:18: error: 'WIFI_SSID' was not declared in this scope
Serial.println(WIFI_SSID);
rf-fans:101:17: error: 'HOSTNAME' was not declared in this scope
WiFi.hostname(HOSTNAME);
rf-fans:102:25: error: 'WIFI_PASS' was not declared in this scope
WiFi.begin(WIFI_SSID, WIFI_PASS);
C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master\rf-fans\rf-fans.ino: In function 'void callback(char, byte, unsigned int)':
rf-fans:135:32: error: expected ')' before 'MQTT_CLIENT_NAME'
if(strncmp(topic, CMND_TOPIC MQTT_CLIENT_NAME "/restart", sizeof(CMND_TOPIC MQTT_CLIENT_NAME "/restart")-1) == 0) {
rf-fans:135:79: error: expected ')' before 'MQTT_CLIENT_NAME'
if(strncmp(topic, CMND_TOPIC MQTT_CLIENT_NAME "/restart", sizeof(CMND_TOPIC MQTT_CLIENT_NAME "/restart")-1) == 0) {
rf-fans:138:5: error: expected ')' before 'else'
} else
rf-fans:221:1: error: expected ')' before '}' token
}
^
rf-fans:221:1: error: expected primary-expression before '}' token
rf-fans:221:1: error: expected ';' before '}' token
C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master\rf-fans\rf-fans.ino: In function 'void reconnectMQTT()':
rf-fans:226:24: error: 'MQTT_CLIENT_NAME' was not declared in this scope
rf-fans:226:42: error: 'MQTT_USER' was not declared in this scope
rf-fans:226:53: error: 'MQTT_PASS' was not declared in this scope
In file included from C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master\rf-fans\rf-fans.ino:1:0:
rf-fans.h:27:33: error: expected ')' before 'MQTT_CLIENT_NAME'
define STATUS_TOPIC TELE_TOPIC MQTT_CLIENT_NAME "/LWT"
C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master\rf-fans\rf-fans.ino:226:64: note: in expansion of macro 'STATUS_TOPIC'
rf-fans.h:27:33: error: expected ')' before 'MQTT_CLIENT_NAME'
define STATUS_TOPIC TELE_TOPIC MQTT_CLIENT_NAME "/LWT"
C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master\rf-fans\rf-fans.ino:229:22: note: in expansion of macro 'STATUS_TOPIC'
rf-fans:231:35: error: expected ')' before 'MQTT_CLIENT_NAME'
C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master\rf-fans\rf-fans.ino: In function 'void setup()':
rf-fans:290:20: error: 'MQTT_HOST' was not declared in this scope
client.setServer(MQTT_HOST, MQTT_PORT);
rf-fans:290:31: error: 'MQTT_PORT' was not declared in this scope
client.setServer(MQTT_HOST, MQTT_PORT);
rf-fans:295:40: error: 'HOSTNAME' was not declared in this scope
ArduinoOTA.setHostname((const char *)HOSTNAME);
rf-fans:296:13: error: 'OTA_PASS' was not declared in this scope
if(sizeof(OTA_PASS)>0)
sketch\hamptonbay3.cpp: In function 'void postStateUpdate(int)':
hamptonbay3.cpp:4:20: error: expected ')' before 'HAMPTONBAY3_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY3_BASE_TOPIC
sketch\hamptonbay3.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay3.cpp:30:40: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/direction", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay3.cpp:4:20: error: expected ')' before 'HAMPTONBAY3_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY3_BASE_TOPIC
sketch\hamptonbay3.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay3.cpp:32:34: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/fan", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay3.cpp:4:20: error: expected ')' before 'HAMPTONBAY3_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY3_BASE_TOPIC
sketch\hamptonbay3.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay3.cpp:34:36: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/speed", STAT_BASE_TOPIC, idStrings[id]);
hamptonbay3.cpp:4:20: error: expected ')' before 'HAMPTONBAY3_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY3_BASE_TOPIC
sketch\hamptonbay3.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay3.cpp:36:36: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/light", STAT_BASE_TOPIC, idStrings[id]);
C:\Users\sbritto\Documents\Arduino\libraries\hampton-bay-fan-mqtt-master\rf-fans\rf-fans.ino: In function 'void loop()':
rf-fans:357:54: error: 'MQTT_CLIENT_NAME' was not declared in this scope
hamptonbay3.cpp:4:20: error: expected ')' before 'HAMPTONBAY3_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY3_BASE_TOPIC
sketch\hamptonbay3.cpp:7:36: note: in expansion of macro 'BASE_TOPIC'
define STAT_BASE_TOPIC STAT_TOPIC BASE_TOPIC
sketch\hamptonbay3.cpp:39:38: note: in expansion of macro 'STAT_BASE_TOPIC'
sprintf(outTopic, "%s/%s/percent", STAT_BASE_TOPIC, idStrings[id]);
rf-fans:419:54: error: 'MQTT_CLIENT_NAME' was not declared in this scope
sketch\hamptonbay3.cpp: In function 'void hamptonbay3MQTT(char, char, unsigned int)':
hamptonbay3.cpp:4:20: error: expected ')' before 'HAMPTONBAY3_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY3_BASE_TOPIC
sketch\hamptonbay3.cpp:6:36: note: in expansion of macro 'BASE_TOPIC'
define CMND_BASE_TOPIC CMND_TOPIC BASE_TOPIC
sketch\hamptonbay3.cpp:96:21: note: in expansion of macro 'CMND_BASE_TOPIC'
if(strncmp(topic, CMND_BASE_TOPIC, sizeof(CMND_BASE_TOPIC)-1) == 0) {
hamptonbay3.cpp:4:20: error: expected ')' before 'HAMPTONBAY3_BASE_TOPIC'
define BASE_TOPIC HAMPTONBAY3_BASE_TOPIC
sketch\hamptonbay3.cpp:6:36: note: in expansion of macro 'BASE_TOPIC'
define CMND_BASE_TOPIC CMND_TOPIC BASE_TOPIC
sketch\hamptonbay3.cpp:96:45: note: in expansion of macro 'CMND_BASE_TOPIC'
if(strncmp(topic, CMND_BASE_TOPIC, sizeof(CMND_BASE_TOPIC)-1) == 0) {
hamptonbay3.cpp:358:1: error: expected ')' at end of input
}
^
hamptonbay3.cpp:358:1: error: expected ')' at end of input
hamptonbay3.cpp:358:1: error: expected statement at end of input
hamptonbay3.cpp:358:1: error: expected '}' at end of input
exit status 1 expected ')' before 'FANIMATION_BASE_TOPIC'
This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. `