czy jest jakiś moduł - napięciowy/beznapięciowy - do sterowania bramą garażową (kontaktron), działający z suplą oczywiście, na 433MHz i do tego dla tego pilota czyli [s]stałokodowy[/s] zmiennokodowy (SPACE S2)?
[EDIT]: za duży wybór
Code: Select all
//Brama_1
//Nadajnik D7 - 13 (data), +3V3 i masa
// 2 x Pu (w cloudzie) - Otwieranie furtki 0,5 sek
#include <srpc.h>
#include <log.h>
#include <eh.h>
#include <IEEE754tools.h>
#define SUPLADEVICE_CPP
#include <SuplaDevice.h>
#include <lck.h>
#include <WiFiClient.h>
#include <ESP8266WiFi.h>
#include <WiFiServer.h>
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
WiFiClient client;
const char* ssid = "xxxx";////nazwa wifi
const char* password = "xxxx";////hasło wifi
//--------------------------------------------------------
void setup() {
Serial.begin(115200);
mySwitch.enableTransmit(13);//nadajnik
// Replace the falowing GUID
char GUID[SUPLA_GUID_SIZE] = {0xE5,0x95,0x61,0x6F,0xA4,0x9A,0x69,0x8B,0x3F,0x06,0xE3,0xF6,0x01,0x43,0x25,0xB6};
//https://www.supla.org/arduino/get-guid
// Ethernet MAC address
uint8_t mac[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
//----------------------------------------------------
SuplaDevice.addRelay(4, true);
SuplaDevice.addRelay(5, true);
SuplaDevice.setName("Brama");
SuplaDevice.begin(GUID, // Global Unique Identifier
mac, // Ethernet MAC address
"svr1Xsupla.org", // SUPLA server address ////Twój serwer supla
xxxx, // Location ID ////Lokalizacja
"xxxx"); // Location Password ////Hasło do lokalizacji
}
//--------------------------------------------------------
void loop() {
SuplaDevice.iterate();
//****************************otw bramy *****
if (digitalRead(4) == LOW){
mySwitch.send(kod_1, 24);
mySwitch.send(kod_1, 24);
delay(100);
}
//*************************** zam bramy *****
if (digitalRead(5) == LOW){
mySwitch.send(kod_2, 24);
mySwitch.send(kod_2, 24);
delay(100);
}
}
//--------------------------------------------------------
// Supla.org ethernet layer
int supla_arduino_tcp_read(void *buf, int count) {
_supla_int_t size = client.available();
if ( size > 0 ) {
if ( size > count ) size = count;
return client.read((uint8_t *)buf, size);
};
return -1;
};
int supla_arduino_tcp_write(void *buf, int count) {
return client.write((const uint8_t *)buf, count);
};
bool supla_arduino_svr_connect(const char *server, int port) {
return client.connect(server, 2015);
}
bool supla_arduino_svr_connected(void) {
return client.connected();
}
void supla_arduino_svr_disconnect(void) {
client.stop();
}
void supla_arduino_eth_setup(uint8_t mac[6], IPAddress *ip) {
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
}
SuplaDeviceCallbacks supla_arduino_get_callbacks(void) {
SuplaDeviceCallbacks cb;
cb.tcp_read = &supla_arduino_tcp_read;
cb.tcp_write = &supla_arduino_tcp_write;
cb.eth_setup = &supla_arduino_eth_setup;
cb.svr_connected = &supla_arduino_svr_connected;
cb.svr_connect = &supla_arduino_svr_connect;
cb.svr_disconnect = &supla_arduino_svr_disconnect;
cb.get_temperature = NULL;
//cb.get_temperature_and_humidity = NULL;
cb.get_rgbw_value = NULL;
cb.set_rgbw_value = NULL;
return cb;
}