Wie verhinderst du, dass jemand das Türmchen mit nimmt?
Beiträge von platin
-
-
Auf der Spitze oben kommt die Solarzelle in Stahl gefasst. Der Turm selber bekommt noch 45° Bandeisen (Eifelturm). Die Platte unten kommt weg. Weiter oben noch ein Raum für den Akku. Das rote Licht soll nach unten blinken, oder mir fällt noch etwas anderes ein. Farbe bekommt der Turm keine, der soll rosten. Wenns fertig ist, mache ich ein Video.
-
Hat beim ersten Versuch funktioniert. Habe es abgeändert bezüglich Morsekode
C
Alles anzeigen/* Basic ESP8266 MQTT example This sketch demonstrates the capabilities of the pubsub library in combination with the ESP8266 board/library. It connects to an MQTT server then: - publishes "hello world" to the topic "outTopic" every two seconds - subscribes to the topic "inTopic", printing out any messages it receives. NB - it assumes the received payloads are strings not binary - If the first character of the topic "inTopic" is an 1, switch ON the ESP Led, else switch it off It will reconnect to the server if the connection is lost using a blocking reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to achieve the same result without blocking the main loop. To install the ESP8266 board, (using Arduino 1.6.4+): - Add the following 3rd party board manager under "File -> Preferences -> Additional Boards Manager URLs": http://arduino.esp8266.com/stable/package_esp8266com_index.json - Open the "Tools -> Board -> Board Manager" and click install for the ESP8266" - Select your ESP8266 in "Tools -> Board" */ #include <ESP8266WiFi.h> #include <PubSubClient.h> // Update these with values suitable for your network. //int ledPin = 0; Versuch const char* ssid = "Wlanname"; const char* password = "Passwort"; const char* mqtt_server = "IP MQTT Server"; WiFiClient espClient; PubSubClient client(espClient); long lastMsg = 0; char msg[50]; int value = 0; int blinken; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<< //unsigned long blinkStartZeit; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<< //unsigned long blinkZeit = 500; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<< blinken im 500mSek Takt void setup() { pinMode(BUILTIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output Serial.begin(115200); setup_wifi(); client.setServer(mqtt_server, 1884); client.setCallback(callback); } void setup_wifi() { delay(10); // We start by connecting to a WiFi network Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); } void callback(char* topic, byte* payload, unsigned int length) { Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i = 0; i < length; i++) { Serial.print((char)payload[i]); } Serial.println(); // Switch on the LED if an 1 was received as first character if ((char)payload[0] == '1') { blinken = 1; //<<<<<<<<<<<<<<<<<<<<<<<< //blinkStartZeit = millis(); //<<<<<<<<<<<<<<<<<<<<<<<< // but actually the LED is on; this is because // it is acive low on the ESP-01) } else { blinken = 0; } } void reconnect() { // Loop until we're reconnected while (!client.connected()) { Serial.print("Attempting MQTT connection..."); // Attempt to connect if (client.connect("ESP8266Client")) { Serial.println("connected"); // Once connected, publish an announcement... client.publish("outTopic", "hello world"); // ... and resubscribe client.subscribe("inTopic"); } else { Serial.print("failed, rc="); Serial.print(client.state()); Serial.println(" try again in 5 seconds"); // Wait 5 seconds before retrying delay(5000); } } } void loop() { if (!client.connected()) { reconnect(); } client.loop(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< if(blinken == 1) { //if(millis() - blinkStartZeit > blinkZeit) //{ //digitalWrite(BUILTIN_LED, not digitalRead(BUILTIN_LED)); //blinkStartZeit = millis(); //} //>>>>>>>>>>>>> Ab hier den gewünschten Morsekode eintragen<<<<<<<<<< digitalWrite(BUILTIN_LED, HIGH); delay(500); digitalWrite(BUILTIN_LED, LOW); delay(500); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< long now = millis(); if (now - lastMsg > 2000) { lastMsg = now; ++value; snprintf (msg, 75, "hello world #%ld", value); Serial.print("Publish message: "); Serial.println(msg); client.publish("outTopic", msg); } }
-
Vielen Dank!
Meine Tel. kannst du gerne haben.
Ich denke aber, wenn es hier niedergeschrieben ist, ist es archiviert und jeder hat etwas davon.
Wenn ich es richtig verstanden habe: Es gibt eine Abfolge mit Namen blinken. Sagt der MQTT EIN, dann gehe im Programm nach unten zur Loopschleife und mach die Abfolge BLINKEN. Solange bis MQTT sagt AUS.
Wenn ich jetzt
unsigned long blinkStartZeit;
unsigned long blinkZeit = 500;
wegnehme und unten die Blinkreihenfolge eingebe, sollte es so laufen.
Werde ich gleich mal versuchen.
Ach ja, ich vergesse imer den Hintergrund dazu zu schreiben.
Hatte zu hause etliche Eisenreste herumliegen und wollte etwas daraus machen. Die erste Idee war ein Windlicht. Hatte aber keine Glasgefässe für die Kerzen. OK, dann LEDs. Strom wollte ich aber auch keinen verlegen. Habe noch ein altes 5?Wp Solarmodul und 7Ah Bleibatterie. Um Strom zu sparen, schaltet der IObroker das Licht nach Sonnenuntergang ein und um Mitternacht wieder aus. Über MQTT auf später einen ESP-01. Das normale Leuchten ist halt auch fad. Daher soll es jetzt kurze Morsezeichenbotschaften senden. Ob es jemand versteht, oder nicht? Egal!
Das Eisenkonstrukt sieht wie ein Turm aus und ist etwa 1.6m hoch.
Sinnhaftigkeit = KEINE
Spaß = JA
-
Hallo
Neues Projekt, neue Probleme
Habe einen Wemos D1 ESP via Arduino IDE programmiert. Der bekommt vom IObroker über MQTT den Befehl Ausgang X ein und wieder aus zu schalten.
Soweit funktioniert das.
Aber, wenn der Ausgang ein ist, soll diese nicht nur ein bleiben, sondern verschiedene "Blinkzeichen" geben.
EIN
Delay
AUS
Delay
und wiederholen.
Das wollte ich mit einem void loop machen. Aber egal wo ich das hin setzte, mekert die IDE
Danke
Hannes
C
Alles anzeigen/* Basic ESP8266 MQTT example This sketch demonstrates the capabilities of the pubsub library in combination with the ESP8266 board/library. It connects to an MQTT server then: - publishes "hello world" to the topic "outTopic" every two seconds - subscribes to the topic "inTopic", printing out any messages it receives. NB - it assumes the received payloads are strings not binary - If the first character of the topic "inTopic" is an 1, switch ON the ESP Led, else switch it off It will reconnect to the server if the connection is lost using a blocking reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to achieve the same result without blocking the main loop. To install the ESP8266 board, (using Arduino 1.6.4+): - Add the following 3rd party board manager under "File -> Preferences -> Additional Boards Manager URLs": http://arduino.esp8266.com/stable/package_esp8266com_index.json - Open the "Tools -> Board -> Board Manager" and click install for the ESP8266" - Select your ESP8266 in "Tools -> Board" */ #include <ESP8266WiFi.h> #include <PubSubClient.h> // Update these with values suitable for your network. //int ledPin = 0; Versuch const char* ssid = "meinwifi"; const char* password = "meinpasswort"; const char* mqtt_server = "IP IObroker"; WiFiClient espClient; PubSubClient client(espClient); long lastMsg = 0; char msg[50]; int value = 0; void setup() { //pinMode(ledPin,OUTPUT); //Versuch pinMode(BUILTIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output Serial.begin(115200); setup_wifi(); client.setServer(mqtt_server, 1884); client.setCallback(callback); } void setup_wifi() { delay(10); // We start by connecting to a WiFi network Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); } void callback(char* topic, byte* payload, unsigned int length) { Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i = 0; i < length; i++) { Serial.print((char)payload[i]); } Serial.println(); //void loop() { Versuch // Switch on the LED if an 1 was received as first character if ((char)payload[0] == '1') { digitalWrite(BUILTIN_LED, LOW); // Turn the LED on (Note that LOW is the voltage level // Hier das Lichblinkspiel // digitalWrite(BUILTIN_LED, HIGH); USW.....delay BlaBla // but actually the LED is on; this is because // it is acive low on the ESP-01) } else { digitalWrite(BUILTIN_LED, HIGH); // Turn the LED off by making the voltage HIGH } } void reconnect() { // Loop until we're reconnected while (!client.connected()) { Serial.print("Attempting MQTT connection..."); // Attempt to connect if (client.connect("ESP8266Client")) { Serial.println("connected"); // Once connected, publish an announcement... client.publish("outTopic", "hello world"); // ... and resubscribe client.subscribe("inTopic"); } else { Serial.print("failed, rc="); Serial.print(client.state()); Serial.println(" try again in 5 seconds"); // Wait 5 seconds before retrying delay(5000); } } } void loop() { if (!client.connected()) { reconnect(); } client.loop(); long now = millis(); if (now - lastMsg > 2000) { lastMsg = now; ++value; snprintf (msg, 75, "hello world #%ld", value); Serial.print("Publish message: "); Serial.println(msg); client.publish("outTopic", msg); } }
-
In Blockly mußt du aber bei Telegram Instanzen NICHT "Alle" auswählen, sondern z.B. Telegram.0
-
Danke dir.
Habe mich früher mit dem Arduino beschäftigt. Aber weniger programmiert und mehr Vorhandenes geändert. Dann auf Raspberry gebaut, da Linux schon eher meines ist. Mit Tasmota bin ich sehr zufrieden. Zum selber programmieren habe ich wahrscheinlich nicht die Geduld.
Auch die kleinen Scheißerln von Shelly sind Top
Am Anfang habe ich alles mit Siemens SPS gemacht. Die sind zuverlässig, aber auch teuer und unflexibel. Die Eaton easy SPS ist auch nicht schlecht, aber derzeit starke Lieferprobleme und wie schon geschrieben, die Ansteuerung vom IObroker mit Bits.
-
Tests abgeschlossen, funktioniert wunderbar!
Getestet Wemos D1 und ESP32 Dev Kit
Ist jetzt quasi eine IObroker SPS. Einziger Nachteil, bei IObroker Ausfall ist Schicht im Schacht
Falls es interessiert, was ich jetzt damit mache:
Wemos d1 kommt in den Einfahrtbereich und steuert 2 Einfahrttore und Gehtüre mit RFID
ESP32 wird Poolsteuerung
Und ein Weiterer vielleicht Heizungssteuerung
Die Poolsteuerung habe ich schon gebaut, mit einer Eaton Easy SPS. Funktioniert auch mit IObroker. Die Schaltbefehle sind aber nur mit Bits möglich. Daher kommt jetzt der ESP rein.
Schöne Grüße aus Österreich
Hannes
-
Amazon, Google und Co sind das Eine. Da gehts um Werbung usw.
Wer hält die Staaten auf?
-
switchmode(x) 1
Dann erkennt er Signal, kein Signal
-
Hallo Gerd
Liken kann man nicht genug!
Für was der Arni alles gut ist, oder die Werbepause
Danke für deine Mühe, werde ich gleich testen
Hannes
-
Sehr gute Idee mit der IDE!
Das schöne bei Tasmota sind halt die einfache Einbindungen der Sensoren
Danke
Hannes
-
-
Grias eich
Ich komme aus Österreich und würde euch gerne um Hilfestellung bitten.
Ich habe schon einige Wemos und ESP im Einsatz mit IObroker (Tasmota und sonoff Adapter)
Eines habe ich noch nicht herausgefunden:
Wie kann ich Eingänge (Switch) in Tasmota anlegen, ohne damit einen Ausgang zu schalten?
Ich lege in Tasmota z.B. einen Switch 2 an GPIO 14 an und ein Relais 1 an GPIO 4 an (ESP32).
Drücke ich den Taster, zieht das Relais an, warum? Bei Switch1 und Relais 1 wäre mir das klar.
Ich würde gerne z.B. 4 Taster nur zur Auswertung in den IObroker bringen. Und Relais vom IObroker steuern lassen.
Danke für eure Hilfe
Hannes