Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Park-Ampel

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Park-Ampel

    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      TH16 @liv-in-sky last edited by

      @liv-in-sky
      Also das nenne ich mal schnell!
      Ich denke mal, dass dies schon ausreichend sein sollte.
      Und das Ganze ist mit ESPHome gemacht worden?
      Also bräuchte ich "nur" den Wemos mit ESPHome zu flashen und mit ioBroker zu verbinden und MQTT auswerten?
      Da ich mit ESPHome überhaupt noch nie was zu tun hatte, muss ich mich da erstmal einarbeiten.
      Aber wenn ich das so sehe, wie schnell der updatet, lohnt sich der Aufwand auf jeden fall. 👍
      So eine 10s-Sperre für MQTT-Übertragungen wie in Tasmota gibt es wohl bei ESPHome nicht?

      Wal liv-in-sky 3 Replies Last reply Reply Quote 0
      • Wal
        Wal Developer @TH16 last edited by Wal

        @th16 sagte in Park-Ampel:

        So eine 10s-Sperre für MQTT-Übertragungen wie in Tasmota gibt es wohl bei ESPHome nicht?

        Im Normalfall werden die Sensordaten in Echtzeit bei Änderungen übertragen, in der Teleperiode habe ich jetzt nur den SR04 gesehen.

        Edit: Du hast Recht laut Doku sind es 10s, ich nutze bei meinen Geräten nur Script, da gebe ich den Intervall vor.
        Du bekommst mit dem SR04 intern schon keine Echtzeitdaten, deshalb kann man keinen eigenen Intervall vorgeben.

        1 Reply Last reply Reply Quote 0
        • liv-in-sky
          liv-in-sky @TH16 last edited by

          @th16 hab mal nochmal drüber nachgedacht

          dieses senden alle 1sek an iobroker finde ich nicht gut - zumindest sollte man dann die sende-update zeit anpassen, wenn das auto parkt oder nicht da ist - für esp-home habe ich da nicht alzuviel gefunden - https://community.home-assistant.io/t/dynamically-change-update-interval/108074/9

          um das umzusetzen muss man schon irgendwie ahnung von esphome haben

          wenn man aber die logic nicht an iob sendet, sondern intern hat (sowie das im tasmota script von @Wal war), macht das ganze mehr sinn - habe aber auch nur eins gefunden, was ich einigermaßen nachvollziehen kann https://gist.github.com/cadavre/1c4fe17e9f7d831080c5b6dd73b47930
          leider ist da keinerlei anleitung dabei und er nutzt einen esp32 und ich weiß nicht mal, ob das wirklich funktioniert - aber irgendwie finde ich das am besten

          1 Reply Last reply Reply Quote 0
          • w00dst0ck
            w00dst0ck last edited by

            Im Vergleich zum guten alten Tennisball, der an einer Schnur von der Decke hängt und die Windschutzscheibe berührt, wenn man an der richtigen Stelle steht, wäre mir diese zwar technisch faszinierende aber fehleranfällige Lösung zu heikel.

            Wenn einmal die Kommunikation ausfällt, hat man ggf. ne Macke im Auto.

            liv-in-sky 1 Reply Last reply Reply Quote 0
            • liv-in-sky
              liv-in-sky @w00dst0ck last edited by liv-in-sky

              @w00dst0ck

              dann siehst du ja, das keine leds leuchten bzw. dass sich die led's nicht ändern

              aber: wir sind smarthomler - wir wollen, dass strom fliest und kein ball von der decke hängt 🙂

              so wie hier
              script-vis33.gif

              https://www.youtube.com/watch?v=HqqlY4_3kQ8

              1 Reply Last reply Reply Quote 2
              • liv-in-sky
                liv-in-sky @TH16 last edited by

                @th16 weil ich gerade zeit hatte - hier ein versuch mit chatgpt mit folgender aufgabe:

                Image 044.png
                Image 045.png

                esphome:
                 name: sr04_leds
                 platform: ESP8266
                 board: nodemcuv2
                
                wifi:
                 ssid: "SSID"
                 password: "PASSWORD"
                
                # enable logging
                logger:
                 
                # enable Home Assistant API
                api:
                
                # enable OTA updates
                ota:
                
                sensor:
                 - platform: ultrasonic
                   trigger_pin: D1
                   echo_pin: D2
                   name: "SR04 Sensor"
                   update_interval: 1s
                
                output:
                 - platform: gpio
                   pin: D3
                   id: red_led
                 - platform: gpio
                   pin: D4
                   id: green_led
                 - platform: gpio
                   pin: D5
                   id: blue_led
                
                # automation to turn on/off leds based on sensor reading
                automation:
                 - alias: "SR04 Distance LED Control"
                   trigger:
                     platform: numeric_state
                     entity_id: sensor.sr04_sensor
                     above: 50
                   action:
                     - output.turn_on: blue_led
                     - output.turn_off: green_led
                     - output.turn_off: red_led
                 - alias: "SR04 Distance LED Control"
                   trigger:
                     platform: numeric_state
                     entity_id: sensor.sr04_sensor
                     above: 20
                     below: 50
                   action:
                     - output.turn_off: blue_led
                     - output.turn_on: green_led
                     - output.turn_off: red_led
                 - alias: "SR04 Distance LED Control"
                   trigger:
                     platform: numeric_state
                     entity_id: sensor.sr04_sensor
                     below: 20
                   action:
                     - output.turn_off: blue_led
                     - output.turn_off: green_led
                     - output.turn_on: red_led
                
                

                T 1 Reply Last reply Reply Quote 2
                • T
                  TH16 @liv-in-sky last edited by

                  @liv-in-sky
                  Vielen Dank!
                  Da hab ich diese Woche erstmal was zu tun. 😀
                  Ich melde mich...

                  liv-in-sky 2 Replies Last reply Reply Quote 0
                  • liv-in-sky
                    liv-in-sky @TH16 last edited by liv-in-sky

                    @th16

                    kuck mal da 🙂 - ganz unten dp leds zeigt farbe an, die auch mit den leds zusammengehören

                    script-vis34.gif

                    bitte nicht über die schaltung lachen - habe 2 linke hände für sowas 😞

                    script-vis35.gif

                    mußte das mit dem vl53lx sensor machen - der sr04 "spinnt" irgendwie

                    esphome:
                     name: entfernungwemos
                     platform: ESP8266
                     board: d1_mini
                    
                    wifi:
                     ssid: "Dragonyyyyyyy1"
                     password: "xxxxxxxxxxxxx"
                     use_address: 192.168.178.64
                    
                    # enable logging
                    logger:
                     
                    # enable Home Assistant API
                    api:
                    
                    # enable OTA updates
                    ota:
                    
                    mqtt:
                     broker: 192.168.178.59
                     port: 1506
                     topic_prefix: entfernungsampel/chatgpt/distance
                     
                    i2c:
                     sda: D2
                     scl: D1
                     scan: True
                    
                    sensor:
                     - platform: vl53l0x
                       address: '0x29'
                       name: "SR04 Sensor"
                       id: sr04_sensor
                       long_range: true
                       update_interval: 1s
                       unit_of_measurement: "m"
                       on_value:
                         then:
                           
                           - if:
                               condition:
                                 lambda: "return id(sr04_sensor).state > 0.5;"
                               then:
                                 - output.turn_off: yellow_led
                                 - output.turn_on: green_led
                                 - output.turn_off: red_led
                                 - mqtt.publish:
                                     topic: "entfernungsampel/chatgpt/leds"
                                     payload: "green"
                           - if:
                               condition:
                                 lambda: "return (id(sr04_sensor).state > 0.2) && (id(sr04_sensor).state <= 0.5);"
                               then:
                                 - output.turn_on: yellow_led
                                 - output.turn_off: green_led
                                 - output.turn_off: red_led
                                 - mqtt.publish:
                                     topic: "entfernungsampel/chatgpt/leds"
                                     payload: "yellow"
                           - if:
                               condition:
                                 lambda: "return id(sr04_sensor).state <= 0.2;"
                               then:
                                 - output.turn_off: yellow_led
                                 - output.turn_off: green_led
                                 - output.turn_on: red_led
                                 - mqtt.publish:
                                     topic: "entfernungsampel/chatgpt/leds"
                                     payload: "red"
                    
                    output:
                     - platform: gpio
                       pin: D3
                       id: red_led
                     - platform: gpio
                       pin: D4
                       id: green_led
                     - platform: gpio
                       pin: D5
                       id: yellow_led
                    
                    

                    so mache ich das mit dem flashen - über esphome adapter

                    • ein standard esphome yaml für den esp erstellt unter: https://web.esphome.io/ und die wifi angaben machen - der esp wird dazu am usb port des pc's angeschlossen

                    • die ip adresse habe ich dann im yaml eingetragen - unter wifi - use_address

                    • im esphome-dashboard (über esphome adapter) auf edit drücken und das yaml hineinkopieren - sichern - installieren - der esp wird über wifi neu geflasht

                    1 Reply Last reply Reply Quote 2
                    • liv-in-sky
                      liv-in-sky @TH16 last edited by liv-in-sky

                      @th16

                      hab' ne neue version mit ws2812b led-stripe (6 leds) gemacht - gerstern war hier feiertag 🙂

                      die mqtt daten (entfernung und ampelfarbe) werden nur noch bei änderung des bereichs (bzw änderung der ampelfarbe) zu iobroker übermittelt und nicht jede sekunde

                      die einzelled's sind noch im code enthalten und könnten statt ws1812 weiterhin genutzt werden

                      evtl versuche ich noch das abschalten der led's nach einer bestimmten stillstand periode einzufügen

                      wie erwähnt - basteln ist nicht mein ding - die farben kommen in video leider nicht gnz so gut wie in echt 😞

                      script-vis38.gif

                      esphome:
                       name: entfernungwemos
                       platform: ESP8266
                       board: d1_mini
                      
                      wifi:
                       ssid: "Drxxxxxxxxxxxx"
                       password: "fdfdfghjjhgffddddd"
                       use_address: 192.168.178.64
                      
                      # enable logging
                      logger:
                       
                      # enable Home Assistant API
                      api:
                      
                      # enable OTA updates
                      ota:
                      
                      mqtt:
                       broker: 192.168.178.59
                       port: 1506
                       # topic_prefix: entfernungsampel/chatgpt/distance
                       
                      i2c:
                       sda: D2
                       scl: D1
                       scan: True
                      
                      globals:
                       - id: cur_led
                         type: std::string
                         initial_value: '"off"'
                      
                      light:
                       - platform: neopixelbus
                         type: GRB
                         id: voyant_led
                         variant: WS2812X
                         pin: GPIO3
                         num_leds: 6
                         name: "NeoPixel Light"
                         default_transition_length: 0.5s
                         availability:
                           topic: livingroom/status
                           payload_available: online
                           payload_not_available: offline
                         state_topic: entfernungsampel/chatgpt/neo/custom_state_topic
                         command_topic: entfernungsampel/chatgpt/neo/custom_command_topic
                         command_retain: false
                      
                      sensor:
                       - platform: vl53l0x
                         address: '0x29'
                         name: "SR04 Sensor"
                         id: sr04_sensor
                         long_range: true
                         update_interval: 1s
                         unit_of_measurement: "m"
                         on_value:
                           then:
                             - logger.log:
                                 format: "Setting temp bar width to %s. and %d and %d and %d"
                                 args: ['id(cur_led).c_str()','strcmp(id(cur_led).c_str(), "green")','strcmp(id(cur_led).c_str(), "yellow")','strcmp(id(cur_led).c_str(), "red")']
                             - if:
                                 condition:
                                   and:
                                   - lambda: "return id(sr04_sensor).state > 0.8;"
                                   - lambda: 'return (strcmp(id(cur_led).c_str(), "green")<0 || strcmp(id(cur_led).c_str(), "green")>0 );'
                                 then:
                                   - lambda: |- 
                                             id(cur_led) = "green";    
                                   - output.turn_off: yellow_led
                                   - output.turn_on: green_led
                                   - output.turn_off: red_led
                              #     - light.addressable_set:
                              #        id: voyant_led
                              #        range_from: 0
                              #        range_to: 5
                              #        red: 100%
                              #        green: 0%
                              #        blue: 0%
                              #        color_brightness: 30%
                      
                                   - mqtt.publish:
                                        topic: "entfernungsampel/chatgpt/color/leds"
                                        payload: "green"
                                   - mqtt.publish:
                                        topic: "entfernungsampel/chatgpt/color/dist"
                                        payload: !lambda |-
                                                   return str_snprintf("%f", 32, id(sr04_sensor).state);
                                   - light.turn_on:
                                       id: voyant_led
                                       brightness: 40%
                                       red: 0%
                                       green: 100%
                                       blue: 0%
                             - if:
                                 condition:
                                   and:
                                     - lambda: "return (id(sr04_sensor).state > 0.5) && (id(sr04_sensor).state <= 0.8);"
                                     - lambda: 'return (strcmp(id(cur_led).c_str(), "yellow")<0 || strcmp(id(cur_led).c_str(), "yellow")>0 );'
                                 then:
                                   - globals.set:
                                       id: cur_led
                                       value: '"yellow"'
                                   - output.turn_on: yellow_led
                                   - output.turn_off: green_led
                                   - output.turn_off: red_led
                            #       - light.addressable_set:
                            #          id: voyant_led
                            #          range_from: 0
                            #          range_to: 5
                            #          red: 100%
                            #          green: 100%
                            #          blue: 0%
                            #          color_brightness: 30%
                      
                                   - mqtt.publish:
                                       topic: "entfernungsampel/chatgpt/color/leds"
                                       payload: "yellow"
                                   - mqtt.publish:
                                        topic: "entfernungsampel/chatgpt/color/dist"
                                        payload: !lambda |-
                                                   return str_snprintf("%f", 32, id(sr04_sensor).state);
                                   - light.turn_on:
                                       id: voyant_led
                                       brightness: 40%
                                       red: 100%
                                       green: 100%
                                       blue: 0%
                             - if:
                                 condition:
                                    and:
                                     - lambda: "return id(sr04_sensor).state <= 0.5;"
                                     - lambda: 'return strcmp(id(cur_led).c_str(), "red")<0 || strcmp(id(cur_led).c_str(), "red")>0 ;'
                                 then:
                                   - globals.set:
                                       id: cur_led
                                       value: '"red"'
                                   - output.turn_off: yellow_led
                                   - output.turn_off: green_led
                                   - output.turn_on: red_led
                             #      - light.addressable_set:
                             #         id: voyant_led
                            #          range_from: 0
                             #         range_to: 5
                             #         red: 100%
                             #         green: 0%
                             #         blue: 0%
                             #         color_brightness: 30%
                      
                                   - mqtt.publish:
                                       topic: "entfernungsampel/chatgpt/color/leds"
                                       payload: "red"
                                   - mqtt.publish:
                                        topic: "entfernungsampel/chatgpt/color/dist"
                                        payload: !lambda |-
                                                   return str_snprintf("%f", 32, id(sr04_sensor).state);
                                   - light.turn_on:
                                       id: voyant_led
                                       brightness: 40%
                                       red: 100%
                                       green: 0%
                                       blue: 0%
                      
                      output:
                       - platform: gpio
                         pin: D3
                         id: red_led
                       - platform: gpio
                         pin: D4
                         id: green_led
                       - platform: gpio
                         pin: D5
                         id: yellow_led
                      
                      

                      1 Reply Last reply Reply Quote 1
                      • liv-in-sky
                        liv-in-sky last edited by liv-in-sky

                        habe nun ein script - mit dem ausschalten nach einer bestimmten zeit, wenn keine bewegung stattfindet

                        script auf github:
                        https://github.com/liv-in-sky/esphome-park-ampel-wemos_d-lx53l0x/blob/main/README.md
                        im einsatz:
                        https://www.youtube.com/shorts/nFh81V3uW6I

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate
                        FAQ Cloud / IOT
                        HowTo: Node.js-Update
                        HowTo: Backup/Restore
                        Downloads
                        BLOG

                        611
                        Online

                        31.6k
                        Users

                        79.6k
                        Topics

                        1.3m
                        Posts

                        6
                        55
                        2715
                        Loading More Posts
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes
                        Reply
                        • Reply as topic
                        Log in to reply
                        Community
                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                        The ioBroker Community 2014-2023
                        logo