This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
homeyduino
Homeyduino programming esp8266
dennisvanderhave
Member
Hello everyone,
I have not the best programming experience but can someone please help me fix this ?
I want to have a magnetic read contact connect to a esp8266 that is connected with homey and notify when the front door is open or close. And with that notification i want to make a flow to make my light go on.
This is the code that i got so far.
For the most part it's working. That means that the esp8266 is connected to my wifi and is talking with homey. But making a flow with it is not working.
Can someone please help me with this code ?
Thank you are
I have not the best programming experience but can someone please help me fix this ?
I want to have a magnetic read contact connect to a esp8266 that is connected with homey and notify when the front door is open or close. And with that notification i want to make a flow to make my light go on.
This is the code that i got so far.
[code]
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <Homey.h>
const int switchReed = D5;
unsigned long previousMillis = 0;
const unsigned long interval = 1000; //Interval in milliseconds
IPAddress ip;
//Arduino functions
void setup()
{
Serial.begin(115200);
Serial.print("Connected to WiFi! (");
//Connect to network
WiFi.begin("-", "-");
while (WiFi.status() != WL_CONNECTED) {
delay(200);
Serial.print(".");
}
if (WiFi.status() == WL_CONNECTED) {
//Print IP address
ip = WiFi.localIP();
Serial.print("IP address: ");
Serial.println(ip.toString());
}
//Start Homey library
Homey.begin("Voordeur beveiliging");
Homey.setClass("other");
Homey.addCapability("alarm_contact");
//define relais pin
pinMode(switchReed, INPUT_PULLUP);
Homey.setCapabilityValue("alarm_contact", false); //Set initial value
}
void loop()
{
Homey.loop();
}
[/code]
For the most part it's working. That means that the esp8266 is connected to my wifi and is talking with homey. But making a flow with it is not working.
Can someone please help me with this code ?
Thank you are
Tagged:
Comments