You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I added your home bridge plugin on my raspberry pi, and I have some trouble with dimmer,
first - in console I get next error:
[sconce] undefined
[sconce] { Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:171:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }
second problem it's when I turn off my dimmer, and wan't turn on - as I understand home kit make a call in my esp - get brightness - esp return 0 (because it turn off) and next call it's turn off, so why it's going? what I should change for normal working?
Hi, I added your home bridge plugin on my raspberry pi, and I have some trouble with dimmer,
first - in console I get next error:
[sconce] undefined
[sconce] { Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:171:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }
second problem it's when I turn off my dimmer, and wan't turn on - as I understand home kit make a call in my esp - get brightness - esp return 0 (because it turn off) and next call it's turn off, so why it's going? what I should change for normal working?
#include <WiFi.h>
#include <ESP32WebServer.h>
#include <RBDdimmer.h>
const char* ssid = "";
const char password = "*";
ESP32WebServer server(80);
#define outPin 32 // pin for dimming
#define ZCPin 4 // Zero-Cross
dimmerLamp dimmer(outPin, ZCPin); //initialase port for dimmer
void setup(void)
{
Serial.begin(115200); // Serial connection from ESP-01 via 3.3v console cable
// Connect to WiFi network
WiFi.begin(ssid, password);
IPAddress ip(192, 168, 1, 199);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
WiFi.config(ip, gateway, subnet);
Serial.print("\n\r \n\rWorking to connect");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("DHT data Reading Server");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
server.on("/dimmerOn", {
Serial.println("anybody come to /dimmerOn!");
dimmer.setState(ON);
server.send(200, "text/plain", "1");
});
server.on("/dimmerOff", {
Serial.println("anybody come to /dimmerOff!");
dimmer.setState(OFF);
server.send(200, "text/plain", "1");
});
server.on("/getDimmerState", {
Serial.println("anybody come to /getDimmerState!");
Serial.println(String(dimmer.getState()));
server.send(200, "text/plain", String(dimmer.getState()));
});
server.on("/getBrightness", {
Serial.println("anybody come to /getBrightness!");
Serial.println(String(dimmer.getPower()));
server.send(200, "text/plain", String(dimmer.getPower()));
});
server.on("/setBrightness", handleSetBrightness);
server.begin();
Serial.println("HTTP server started");
dimmer.begin(NORMAL_MODE, OFF); //dimmer initialisation: name.begin(MODE, STATE)
}
void handleSetBrightness() { //Handler
Serial.println(server.arg(0));
int brightness = server.arg(0).toInt();
dimmer.setPower(brightness);
dimmer.setState(ON);
server.send(200, "text/plain", "1"); //Response to the HTTP request
}
void loop(void)
{
server.handleClient();
}
The text was updated successfully, but these errors were encountered: