Zum Hauptinhalt springenZur Hauptnavigation springen

Empfohlene Produkte

📦 Unsere Smart-Switch-Empfehlungen

Ausgewählte Empfehlungen für dein Smart Home Projekt

Lädt Produkte... (sensor → smartswitch → led → camera)

Das neuste Produkt bei Action von LEDNIFY „Remote Control“ lässt sich wunderbar in HomeAssistant über ESPHome einbinden. Auf der Rückseite unter dem Battariedeckel befinden sich Zwei kleine Schrauben, diese entfernen und mit ein bisschen Gefühl an den Seiten hebeln.
Auf der Platine befindet sich ein ESP-WROOM-02D Chip der sich wunderbar eignet um ESPHome drauf zu flashen.

Am unterem Ende befinden sich 5 Kontakte die zum flashen dienen

Mit einem FTDI-Adapter verbinden und mit dem Beispielcode flashen

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 esphome: name: lednify-remote platform: ESP8266 board: esp_wroom_02 includes: - 74HC165.h logger: api: ota: wifi: ssid: !secret wifi_ssid password: !secret wifi_password ap: ssid: "Lednify-Remote Fallback Hotspot" password: "xEan015klK6E" captive_portal: deep_sleep: run_duration: 60s sleep_duration: 90s sensor: - platform: adc pin: VCC id: "vcc" internal: true - platform: template name: "Batteriezustand" unit_of_measurement: '%' update_interval: 20s lambda: |- return ((id(vcc).state /3.30) * 100.00); binary_sensor: - platform: gpio pin: GPIO14 name: "Mond" filters: - invert: - platform: custom lambda: |- auto X01 = new SN74HC165Component(0); auto X02 = new SN74HC165Component(1); auto X03 = new SN74HC165Component(2); auto X04 = new SN74HC165Component(3); auto X05 = new SN74HC165Component(4); auto X06 = new SN74HC165Component(5); auto X07 = new SN74HC165Component(6); auto X08 = new SN74HC165Component(7); App.register_component(X01); App.register_component(X02); App.register_component(X03); App.register_component(X04); App.register_component(X05); App.register_component(X06); App.register_component(X07); App.register_component(X08); return {X01,X02,X03,X04,X05,X06,X07,X08}; binary_sensors: - name: "Taste -" filters: - invert: - name: "Taste +" filters: - invert: - name: "Taste 3" filters: - invert: - name: "Taste 4" filters: - invert: - name: "Taste 1" filters: - invert: - name: "Taste 2" filters: - invert: - name: "Taste ON" filters: - invert: - name: "Taste OFF" filters: - invert:

Bevor der Chip geflasht werden kann, muss noch eine Datei erstellt werden.
Dateiname: 74HC165.h
Diese Datei muss in den Ordner „esphome“ von HomeAssistant

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 #include "esphome.h" class SN74HC165Component : public PollingComponent, public BinarySensor { byte pinNum; private: const byte LATCH = 13; // ESP pin number that should be connected to pin 1 of 74hc165s const byte DATA = 5; // ESP pin number that should be connected to pin 9 of first 74hc165 const byte CLOCK = 4; // ESP pin number that should be connected to pin 2 of 74hc165s bool getBit(unsigned long x, byte n) { bool value = bitRead(x, n); return value; } unsigned long shiftinput= 1; unsigned long oldshiftinput= 0; public: SN74HC165Component (byte pin) : PollingComponent(100) { pinNum = pin; } // Change the number inside "PollingComponent(100)" to change update interval in miliseconds float get_setup_priority() const override { return esphome::setup_priority::HARDWARE; } void setup() override { pinMode(LATCH, OUTPUT); pinMode(CLOCK, OUTPUT); pinMode(DATA, INPUT); digitalWrite(CLOCK, LOW); digitalWrite(CLOCK, HIGH); digitalWrite(LATCH, HIGH); } void update() override { digitalWrite(CLOCK, LOW); digitalWrite(CLOCK, HIGH); digitalWrite(LATCH, LOW); digitalWrite(LATCH, HIGH); shiftinput = shiftIn(DATA, CLOCK, LSBFIRST); shiftinput |= shiftIn(DATA, CLOCK, LSBFIRST) << 8; shiftinput |= shiftIn(DATA, CLOCK, LSBFIRST) << 16; shiftinput |= shiftIn(DATA, CLOCK, LSBFIRST) << 24; if (shiftinput != oldshiftinput) { publish_state(getBit(shiftinput, pinNum)); oldshiftinput = shiftinput; } } };

Shopping-Empfehlungen

Passende sensor-Produkte

Weitere empfohlene Produkte für dein Smart Home

Lädt Produkte... (sensor → smartswitch → led → camera)

Artikel teilen

Teilen: