Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [gelöst] Mondlicht (ESP8266,PWM Modul, Tasmota

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Mondlicht (ESP8266,PWM Modul, Tasmota

    This topic has been deleted. Only users with topic management privileges can see it.
    • paul53
      paul53 @Aphofis last edited by

      @aphofis sagte in Mondlicht (ESP8266,PWM Modul, Tasmota:

      suncalc!? ist das ein adapter ?

      Nein, suncalc() ist ein NPM-Modul, das bereits im Javascript-Adapter enthalten ist, also nicht mehr installiert werden muss.

      Aphofis 1 Reply Last reply Reply Quote 1
      • Aphofis
        Aphofis @paul53 last edited by Aphofis

        @paul53
        Das ja Cool.
        dh es ist möglich, wenn ich cree leds an einen esp8266 angeschlossen udn von 0-255 gesteuert bekomme kann ich das per blockly steuern, das die steuerung zu und abnehmenden mond per mqtt den ESP steuern kann !? sprich das mein Mondlicht dann wieder funktioniert !?
        Kannst du mir bei der Steuerung unter die arme greifen !?
        Wäre naturlich mega wenn dann Prozebntzahl des momentanen mondlichtes abends per telegram ausgegeben wird.
        geht das dann auch das dann zb abends das mondlicht auf die aktuelle % zahl von 0 auf zb 15% hoch gedimmt wird !? und dann morgends zb gegen 6 wieder runter dimmt auf null !? keine Ahnung vielleicht in einer Zeitspanne von 30 min.

        Aphofis paul53 2 Replies Last reply Reply Quote 0
        • Aphofis
          Aphofis @Aphofis last edited by Aphofis

          Also 4 Cree Leds direkt am ESP8266 funktioniert.
          Die benötigen zwar max 5 volt aber bei 4 Cree Leds die auf 3,3 Volt laufen langt vollkommen für ein Mondlicht.
          Mit Power2 kann man das led ein aus schalten und mit Dimmer kann man die Cree LEDs von 0-100 Steuern.
          Der Dimmer 0-100 langt vollkommen wenn 0% eingestellt ist sind die LEDs aus und auch Power2 wird auf false gesetzt.
          Elektronisch funktioniert das schon!

          @paul53 meinst du du kannst mir bei der Steuerung helfen !? 😀

          IMG_9520.png IMG_9519.png

          paul53 1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @Aphofis last edited by paul53

            @aphofis
            Die folgende Funktion liefert die Mondhelligkeit in % (Vollmond = 100 %):

            Blockly_temp.JPG

            <xml xmlns="https://developers.google.com/blockly/xml">
             <block type="procedures_defcustomreturn" id="3++R7colmk$G3,O_VLwq" x="263" y="37">
               <mutation statements="false"></mutation>
               <field name="NAME">moon</field>
               <field name="SCRIPT">cmV0dXJuIE1hdGgucm91bmQoMTAwICogcmVxdWlyZSgnc3VuY2FsYycpLmdldE1vb25JbGx1bWluYXRpb24obmV3IERhdGUoKSkuZnJhY3Rpb24pOw==</field>
               <comment pinned="false" h="80" w="160">Mondhelligkeit in %</comment>
             </block>
            </xml>
            

            return Math.round(100 * require('suncalc').getMoonIllumination(new Date()).fraction);
            
            Aphofis 1 Reply Last reply Reply Quote 1
            • paul53
              paul53 @Aphofis last edited by

              @aphofis sagte: Prozebntzahl des momentanen mondlichtes abends per telegram ausgegeben wird...

              abends das mondlicht auf die aktuelle % zahl von 0 auf zb 15% hoch gedimmt wird !? und dann morgends zb gegen 6 wieder runter dimmt auf null !? keine Ahnung vielleicht in einer Zeitspanne von 30 min.

              Vorschlag:

              Bild_2021-04-03_234610.png

              1 Reply Last reply Reply Quote 1
              • Aphofis
                Aphofis @paul53 last edited by Aphofis

                @paul53

                Ist es so korrekt???

                <xml xmlns="https://developers.google.com/blockly/xml">
                  <variables>
                    <variable id="t[xyEPrNqT5z:`,BK7`y">faktor</variable>
                    <variable type="interval" id="Intervall">Intervall</variable>
                    <variable type="interval" id="Intervall2">Intervall2</variable>
                  </variables>
                  <block type="schedule" id="@P4.(_q]]$e-3|]lT4)c" x="13" y="38">
                    <field name="SCHEDULE">0 21 * * *</field>
                    <statement name="STATEMENT">
                      <block type="variables_set" id="CsjSaP.0izz3g:f@o^+,">
                        <field name="VAR" id="t[xyEPrNqT5z:`,BK7`y">faktor</field>
                        <value name="VALUE">
                          <block type="math_number" id="vKTs@EV7SWy/Fy)|a!uN">
                            <field name="NUM">0</field>
                          </block>
                        </value>
                        <next>
                          <block type="timeouts_setinterval" id="cAo4};Yb|+2T0P3/k_(R">
                            <field name="NAME">Intervall</field>
                            <field name="INTERVAL">18</field>
                            <field name="UNIT">sec</field>
                            <statement name="STATEMENT">
                              <block type="math_change" id="]wZ$i!H4/feVH%#S}6jk">
                                <field name="VAR" id="t[xyEPrNqT5z:`,BK7`y">faktor</field>
                                <value name="DELTA">
                                  <shadow type="math_number" id="=#9RiN,ala`Vc}:R%rcd">
                                    <field name="NUM">1</field>
                                  </shadow>
                                </value>
                                <next>
                                  <block type="procedures_callnoreturn" id="L6HMQYC#[/}a#;e.:c`Q">
                                    <mutation name="moonlight"></mutation>
                                    <next>
                                      <block type="controls_if" id="xxRadDa6@d8c`r!P64CU">
                                        <value name="IF0">
                                          <block type="logic_compare" id="6`,cSuHC^*c9I:U2{2(X">
                                            <field name="OP">GTE</field>
                                            <value name="A">
                                              <block type="variables_get" id="P~,#P!4-kb+KOUThquLa">
                                                <field name="VAR" id="t[xyEPrNqT5z:`,BK7`y">faktor</field>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="math_number" id="heAA2Hy~3@YIn/_]A%`A">
                                                <field name="NUM">100</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="timeouts_clearinterval" id="Rr:LwG`Q/bW,,61o}d4D">
                                            <field name="NAME">Intervall</field>
                                          </block>
                                        </statement>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </statement>
                            <next>
                              <block type="telegram" id="+7:@G|Xza({]YfkU)5K|">
                                <field name="INSTANCE">.0</field>
                                <field name="LOG"></field>
                                <field name="SILENT">FALSE</field>
                                <field name="PARSEMODE">default</field>
                                <value name="MESSAGE">
                                  <shadow type="text" id="_2un|awHO3b-5`u:sLYq">
                                    <field name="TEXT">text</field>
                                  </shadow>
                                  <block type="text_join" id="dVD6(i9ZsFRf%e[G`qh*" inline="true">
                                    <mutation items="3"></mutation>
                                    <value name="ADD0">
                                      <block type="text" id="*tE)zjn1a[V9Kt=6bk58">
                                        <field name="TEXT">Mondlicht </field>
                                      </block>
                                    </value>
                                    <value name="ADD1">
                                      <block type="procedures_callcustomreturn" id="?$Ehk[2]n}4XvN^f/H5^">
                                        <mutation name="moon"></mutation>
                                      </block>
                                    </value>
                                    <value name="ADD2">
                                      <block type="text" id="?a3mtbwF.L@UF7iL2Tty">
                                        <field name="TEXT"> %</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <next>
                      <block type="schedule" id="Sg^1x-?jsDH|:5D/%@nQ">
                        <field name="SCHEDULE">0 6 * * *</field>
                        <statement name="STATEMENT">
                          <block type="variables_set" id="xU)wW%33o3BXV4{+^[Pb">
                            <field name="VAR" id="t[xyEPrNqT5z:`,BK7`y">faktor</field>
                            <value name="VALUE">
                              <block type="math_number" id="y]UYTo5tZ!*hSZ5?3k8@">
                                <field name="NUM">100</field>
                              </block>
                            </value>
                            <next>
                              <block type="timeouts_setinterval" id="TYhc1=G=a],3.60g%Uf7">
                                <field name="NAME">Intervall2</field>
                                <field name="INTERVAL">18</field>
                                <field name="UNIT">sec</field>
                                <statement name="STATEMENT">
                                  <block type="math_change" id="ydPq:~sYZ=w$hCWr:vO;">
                                    <field name="VAR" id="t[xyEPrNqT5z:`,BK7`y">faktor</field>
                                    <value name="DELTA">
                                      <shadow type="math_number" id="jn$2mK.o@@JIJ,oIrg7Z">
                                        <field name="NUM">-1</field>
                                      </shadow>
                                    </value>
                                    <next>
                                      <block type="procedures_callnoreturn" id="Fm#8}LU]T+0.:-`%.VV1">
                                        <mutation name="moonlight"></mutation>
                                        <next>
                                          <block type="controls_if" id="j:V:V[kQ+xObA#nMy!sk">
                                            <value name="IF0">
                                              <block type="logic_compare" id=";,fhx%aOB^4$3[iC7|66">
                                                <field name="OP">LTE</field>
                                                <value name="A">
                                                  <block type="variables_get" id="#O/%;UwxCh]QH1,tR5s(">
                                                    <field name="VAR" id="t[xyEPrNqT5z:`,BK7`y">faktor</field>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="math_number" id="n?F?~sN4@E)Kix|t/h%#">
                                                    <field name="NUM">0</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="timeouts_clearinterval" id="Of*YenMmS])IC2~H{5Cq">
                                                <field name="NAME">Intervall2</field>
                                              </block>
                                            </statement>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </statement>
                              </block>
                            </next>
                          </block>
                        </statement>
                      </block>
                    </next>
                  </block>
                  <block type="procedures_defnoreturn" id="7qw(LxM`cN6/bH$7$XDa" x="388" y="88">
                    <field name="NAME">moonlight</field>
                    <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                    <statement name="STACK">
                      <block type="control" id="{a_lyWd45mIZ=bPLsRmQ">
                        <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                        <field name="OID">sonoff.0.Aqua_Moonlight.Dimmer</field>
                        <field name="WITH_DELAY">FALSE</field>
                        <value name="VALUE">
                          <block type="math_arithmetic" id="_(8=V}6g*hSK_|QN;SR0">
                            <field name="OP">MULTIPLY</field>
                            <value name="A">
                              <shadow type="math_number" id="i$xM!Hmu,1n]UbAC8GX=">
                                <field name="NUM">1</field>
                              </shadow>
                              <block type="math_arithmetic" id="$s`+kU~JX~3uu4Z(xG@4">
                                <field name="OP">DIVIDE</field>
                                <value name="A">
                                  <shadow type="math_number" id="DlyYC5Y:ZJViXp%njG8-">
                                    <field name="NUM">1</field>
                                  </shadow>
                                  <block type="variables_get" id="T%LV/-1}@cl,X_5w4.l+">
                                    <field name="VAR" id="t[xyEPrNqT5z:`,BK7`y">faktor</field>
                                  </block>
                                </value>
                                <value name="B">
                                  <shadow type="math_number" id="cBy_ZuDZ_{P3L^pqAKn{">
                                    <field name="NUM">100</field>
                                  </shadow>
                                </value>
                              </block>
                            </value>
                            <value name="B">
                              <shadow type="math_number" id=".00_~;OfS`vWF!liS6v^">
                                <field name="NUM">1</field>
                              </shadow>
                              <block type="procedures_callcustomreturn" id="qY~|-{n[9qvBxreww:In">
                                <mutation name="moon"></mutation>
                              </block>
                            </value>
                          </block>
                        </value>
                      </block>
                    </statement>
                  </block>
                  <block type="procedures_defcustomreturn" id="8D$EU-~M~+p{KZlfKA*I" x="313" y="438">
                    <mutation statements="false"></mutation>
                    <field name="NAME">moon</field>
                    <field name="SCRIPT">cmV0dXJuIE1hdGgucm91bmQoMTAwICogcmVxdWlyZSgnc3VuY2FsYycpLmdldE1vb25JbGx1bWluYXRpb24obmV3IERhdGUoKSkuZnJhY3Rpb24pOyA=</field>
                    <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                  </block>
                </xml>
                

                Wenn ich das Script zwischendrin neu starte werden die lampen nicht auf die aktuelle Mondlicht Helligkeit gestellt oder kommt das dann erst in der folge nacht ?

                Ich hab die Startzeit mal auf die aktuelle Zeit gestellt dann wird per Telegramm ausgegeben 56% die LEDs gehen an udn wie es aussieht werden sie langsam heller . Es scheint alles perfekt zu funktionieren.
                Wie kann man bloß sowas wissen.
                Ich kann dir alles mögliche in 3D Zeichnen oder aus irgend einem Material etwas bauen aber programmieren, damit habe ich es nicht leicht. Also Hut ab!!! Wie du solche Steuerungen hinbekommst.

                Basti97 1 Reply Last reply Reply Quote 0
                • Basti97
                  Basti97 Most Active @Aphofis last edited by

                  @aphofis @paul53 Danke für das Script. So etwas habe ich schon immer gesucht bzw. Wusste aber bis jetzt gar nicht wo ich den Mond Datenpunkt her bekomme. 😊 Das Script muss ich morgen mal bei mir auch ausprobieren.
                  In den Timeouts muss ich dann nur noch die Datenpunkte eintragen oder?

                  Aphofis 1 Reply Last reply Reply Quote 0
                  • Aphofis
                    Aphofis @Basti97 last edited by

                    @basti97
                    Du musst nur bei Steuere Objekt ID den Dimmer Datenpunkt der LEDs rein packen das wars.

                    Basti97 2 Replies Last reply Reply Quote 0
                    • Basti97
                      Basti97 Most Active @Aphofis last edited by Basti97

                      @aphofis Ok Danke ich habe das Skript eingefügt und probiere es heute Abend gleich mal aus wenn die Zeit ran ist 🙂 Auch wenn ich noch kein Mondlicht in meinem Aquarium habe, aber virtuell wird es schon zum Testen funktionieren. Nun muss ich nur noch die Herangehensweise des Scripts herausfinden bzw verstehen. 🙂

                      1 Reply Last reply Reply Quote 0
                      • Basti97
                        Basti97 Most Active @Aphofis last edited by

                        @aphofis Ich habe nochmal eine Frage. Hast du bei deiner Aquarium Beleuchtung auch eine Tageslichsimmulation also mit Hochdimmen von Sonnenaufgang bis normale Tageslicht (rot auf weiß).
                        Gruß Basti

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        927
                        Online

                        31.9k
                        Users

                        80.1k
                        Topics

                        1.3m
                        Posts

                        blockly javascript
                        5
                        22
                        1101
                        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