Axa remote 2 and wemos d1

Everything about esp8266 and more.
Post Reply
remko2000
Posts: 49
Joined: Thursday 28 December 2017 15:38
Target OS: Raspberry Pi
Domoticz version:
Location: Broek op Langedijk
Contact:

Axa remote 2 and wemos d1

Post by remko2000 » Saturday 08 December 2018 17:49

Finally I make progress with my axa remote 2.0 which I want to control with domoticz. I bought a linbus converter on superhouse:
https://www.google.nl/url?sa=t&rct=j&q= ... h8hKy-Rx39

I connected it with a wemos d1 and use the arduinoscript from:
https://www.letscontrolit.com/forum/vie ... php?t=2245

I'm almost there but I have noticed that I have to repeat every command. I have no knowledge of arduino coding.
How do I adjust this scripts so that every command repeat one time (of two)?

Code: Select all

/*
* This sketch reads a command through a http connection
* depending on the text received it will send open, stop or close
* commands to the Esp8266. the ESP8266 is connected to the Axa Remote 2.0 electric window opener
*/


#include <ESP8266WiFi.h>

const char* ssid = "your SSID here";
const char* password = "";

// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);

void setup() {
Serial.begin(19200,SERIAL_8N1);
delay(10); 
// Connect to WiFi network 
WiFi.begin(ssid, password); 
while (WiFi.status() != WL_CONNECTED) {
delay(500);
} 
// Start the server
server.begin();
}

void loop() {

// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}

// Wait until the client sends some data
while(!client.available()){
delay(1);
}

// Read the first line of the request
String req = client.readStringUntil('\r');
client.flush();

// Match the request
int val;
if (req.indexOf("/open") != -1)
open_axa();
else 
if (req.indexOf("/close") != -1)
close_axa();
else if (req.indexOf("/stop") != -1)
stop_axa(); 

else {
Serial.println("invalid request");
client.stop();
return;
}
} 

void open_axa() {
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.print("E");
delay(20);
Serial.print("N");
delay(20);
Serial.println("\r");
delay(2000);
}

void close_axa() {
Serial.print("C");
delay(20);
Serial.print("L");
delay(20);
Serial.print("O");
delay(20);
Serial.print("S");
delay(20);
Serial.print("E");
delay(20);
Serial.println("\r");
delay(2000);
}

void stop_axa() {
Serial.print("S");
delay(20);
Serial.print("T");
delay(20);
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.println("\r");
}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest