<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Jaunius,<br>
    <br>
    I've added scheduled (delayed) events & the native OvmsEvents
    API:<br>
    <a
href="https://docs.openvehicles.com/en/latest/userguide/scripting.html#internal-objects-and-functions-methods">https://docs.openvehicles.com/en/latest/userguide/scripting.html#internal-objects-and-functions-methods</a><br>
    <br>
    So you can now also implement millisecond resolution timeouts and
    intervals in scripts.<br>
    <br>
    Regards,<br>
    Michael<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 11.10.19 um 10:36 schrieb Jaunius
      Kapkan:<br>
    </div>
    <blockquote type="cite"
cite="mid:trinity-499cbe53-c3ba-4b33-a8a6-7c9e529d2835-1570782986047@3c-app-mailcom-bs15">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div style="font-family: Verdana;font-size: 12.0px;">
        <div>
          <div>Thanks Michael,</div>
          <div> </div>
          <div>1 second will do just fine as this is for climate control
            timer plugin I'm doing. Will try to use that event listener.
            Of course some standartized way would be better.</div>
          <div> </div>
          <div>Regards,</div>
          <div>Jaunius</div>
          <div> 
            <div name="quote" style="margin:10px 5px 5px 10px; padding:
              10px 0 10px 10px; border-left:2px solid #C3D9E5;
              word-wrap: break-word; -webkit-nbsp-mode: space;
              -webkit-line-break: after-white-space;">
              <div style="margin:0 0 10px 0;"><b>Sent:</b> Friday,
                October 11, 2019 at 8:48 AM<br>
                <b>From:</b> "Michael Balzer" <a class="moz-txt-link-rfc2396E" href="mailto:dexter@expeedo.de"><dexter@expeedo.de></a><br>
                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:ovmsdev@lists.openvehicles.com">ovmsdev@lists.openvehicles.com</a><br>
                <b>Subject:</b> Re: [Ovmsdev] WifiConsole V1.0</div>
              <div name="quoted-content">Jaunius,<br>
                <br>
                setTimeout() is not a standard Javascript function, it's
                a method of the browser window object.<br>
                <br>
                <a
href="https://developer.mozilla.org/de/docs/Web/API/WindowTimers/setTimeout"
                  target="_blank" moz-do-not-send="true">https://developer.mozilla.org/de/docs/Web/API/WindowTimers/setTimeout</a><br>
                <br>
                As a workaround, subscribe to the "ticker.1" event as
                shown in the foglight example:<br>
                <br>
                <a
href="http://docs.openvehicles.com/en/latest/components/ovms_script/docs/foglight.html#listen-to-events"
                  target="_blank" moz-do-not-send="true">http://docs.openvehicles.com/en/latest/components/ovms_script/docs/foglight.html#listen-to-events</a><br>
                <br>
                Resolution is limited to 1 second though. I thought
                about scheduled events some time ago, i.e. being able to
                tell the event system to trigger an event after a
                specific delay. That would also offer a clean &
                simple solution for this. Another option would be a
                script API for the timer service.<br>
                <br>
                I'll have a look at scheduled events.<br>
                <br>
                Regards,<br>
                Michael<br>
                <br>
                 
                <div class="moz-cite-prefix">Am 11.10.19 um 08:29
                  schrieb Jaunius Kapkan:</div>
                <blockquote>
                  <div style="font-family: Verdana;font-size: 12.0px;">
                    <div>Thanks Mark,</div>
                    <div> </div>
                    <div>One other thing I stumbled upon is that
                      standard setTimeout() does not seem to work. Is
                      there any workaround for this? Sample Code:</div>
                    <div>
                      <pre><code>function intervalFunc() {
  print('Next try in 1.5s')
}

setInterval(intervalFunc, 1500)</code></pre>
                      <div>
                        <div> </div>
                        <div>Basically I need the script to check
                          certain conditions each n seconds.</div>
                        <div> </div>
                        <div>Regards,</div>
                        <div>Jaunius</div>
                      </div>
                    </div>
                    <div>
                      <div style="margin: 10.0px 5.0px 5.0px
                        10.0px;padding: 10.0px 0 10.0px
                        10.0px;border-left: 2.0px solid
                        rgb(195,217,229);">
                        <div style="margin: 0 0 10.0px 0;"><b>Sent:</b> Thursday,
                          October 10, 2019 at 3:35 AM<br>
                          <b>From:</b> "Mark Webb-Johnson" <a
                            class="moz-txt-link-rfc2396E"
                            href="mailto:mark@webb-johnson.net"
                            onclick="parent.window.location.href='mailto:mark@webb-johnson.net';
                            return false;" target="_blank"
                            moz-do-not-send="true"><mark@webb-johnson.net></a><br>
                          <b>To:</b> "OVMS Developers" <a
                            class="moz-txt-link-rfc2396E"
                            href="mailto:ovmsdev@lists.openvehicles.com"
onclick="parent.window.location.href='mailto:ovmsdev@lists.openvehicles.com';
                            return false;" target="_blank"
                            moz-do-not-send="true"><ovmsdev@lists.openvehicles.com></a><br>
                          <b>Subject:</b> Re: [Ovmsdev] WifiConsole V1.0</div>
                        <div>I think in v2 that could have been the case
                          (as we didn’t have any standardised functions
                          for things like climate control). But in the
                          v3 architecture we now have these and the
                          vehicle modules should support the standard
                          functions to the best of their abilities.<br>
                          <br>
                          If we still need mappings like Homelink 1
                          -> Climate On, then that should be done
                          either by scripts or by some centralised
                          mapping framework.<br>
                          <br>
                          Regards, Mark.<br>
                          <br>
                          > On 9 Oct 2019, at 2:19 PM, Jaunius Kapkan
                          <a class="moz-txt-link-rfc2396E"
                            href="mailto:jaunius@gmx.com"
                            onclick="parent.window.location.href='mailto:jaunius@gmx.com';
                            return false;" target="_blank"
                            moz-do-not-send="true"><jaunius@gmx.com></a>
                          wrote:<br>
                          ><br>
                          > I am making a couple of plugins
                          (initially for leaf) and the JS functions are
                          great for that. However I assume the functions
                          are not unifed accross different vehicles. For
                          example for leaf to turn on pre-heat you need
                          to issue Homelink 1 instead of ClimateControl.
                          What would be the best way to change this? Or
                          is this something that need to be changed on
                          the lower level?<br>
                          ><br>
                          > Greetings,<br>
                          > Jaunius<br>
                          ><br>
                          >> Sent: Tuesday, October 08, 2019 at
                          9:05 AM<br>
                          >> From: "Michael Balzer" <a
                            class="moz-txt-link-rfc2396E"
                            href="mailto:dexter@expeedo.de"
                            onclick="parent.window.location.href='mailto:dexter@expeedo.de';
                            return false;" target="_blank"
                            moz-do-not-send="true"><dexter@expeedo.de></a><br>
                          >> To: <a
                            class="moz-txt-link-abbreviated"
                            href="mailto:ovmsdev@lists.openvehicles.com"
onclick="parent.window.location.href='mailto:ovmsdev@lists.openvehicles.com';
                            return false;" target="_blank"
                            moz-do-not-send="true">ovmsdev@lists.openvehicles.com</a><br>
                          >> Subject: Re: [Ovmsdev] WifiConsole
                          V1.0<br>
                          >><br>
                          >> Mark,<br>
                          >><br>
                          >> yes, the OLEDs are perfect for these
                          things, bright enough for daylight use with
                          very little energy usage.<br>
                          >><br>
                          >> Thanks for the link to that combined
                          ESP32 module, that's a real beauty, even
                          includes a LiPo supply / charger. I need to
                          check that one out.<br>
                          >><br>
                          >> Regarding our Javascript support, I
                          already had stunned some users with the
                          foglight plugin, they thought stuff like this
                          would need builtin<br>
                          >> support. That brought me back to my
                          point about how little users know about our
                          capabilities, so I added an explanation to our
                          docs:<br>
                          >><br>
                          >> <a
href="http://docs.openvehicles.com/en/latest/components/ovms_script/docs/foglight.html"
                            target="_blank" moz-do-not-send="true">http://docs.openvehicles.com/en/latest/components/ovms_script/docs/foglight.html</a><br>
                          >><br>
                          >> But we really need something like an
                          OVMS cheat sheet as an overview of what is
                          possible.<br>
                          >><br>
                          >> Regards,<br>
                          >> Michael<br>
                          >><br>
                          >><br>
                          >> Am 08.10.19 um 05:40 schrieb Mark
                          Webb-Johnson:<br>
                          >>> Michael,<br>
                          >>><br>
                          >>> I really like those little OLED
                          SSD1306 based displays. I use them on my
                          esphome+hassio projects like this little water
                          tank level (using an<br>
                          >>> ESP32, a BME280
                          pressure/humidity/temperature sensor,
                          waterproof ultrasonic distance sensor, and
                          SSID1306 OLED yellow/blue display):<br>
                          >>><br>
                          >>><br>
                          >>> Adding a display to a project
                          makes it so much more useful and easy to
                          diagnose problems.<br>
                          >>><br>
                          >>> AliExpress has them very cheap:<br>
                          >>><br>
                          >>> * <a
                            href="https://www.aliexpress.com/item/32844104782.html"
                            target="_blank" moz-do-not-send="true">https://www.aliexpress.com/item/32844104782.html</a><br>
                          >>> US$2 for the 0.96” yellow/blue
                          128x32<br>
                          >>> US$3 for the 1.3” white 128x64<br>
                          >>><br>
                          >>><br>
                          >>> There is also a 4MB ESP32 with a
                          0.96” OLED display on-board:<br>
                          >>><br>
                          >>> * <a
                            href="https://www.aliexpress.com/item/32822105291.html"
                            target="_blank" moz-do-not-send="true">https://www.aliexpress.com/item/32822105291.html</a><br>
                          >>> US$9 plus shipping<br>
                          >>><br>
                          >>><br>
                          >>> Glad that you are finding a use
                          for our JavaScript support. I really think
                          that has so many possibilities.<br>
                          >>><br>
                          >>> Regards, Mark<br>
                          >>><br>
                          >>>> On 6 Oct 2019, at 10:43 PM,
                          Michael Balzer <<a
                            class="moz-txt-link-abbreviated"
                            href="mailto:dexter@expeedo.de"
                            onclick="parent.window.location.href='mailto:dexter@expeedo.de';
                            return false;" target="_blank"
                            moz-do-not-send="true">dexter@expeedo.de</a>
                          <a class="moz-txt-link-rfc2396E"
                            href="mailto:dexter@expeedo.de"
                            onclick="parent.window.location.href='mailto:dexter@expeedo.de';
                            return false;" target="_blank"
                            moz-do-not-send="true"><mailto:dexter@expeedo.de></a>>
                          wrote:<br>
                          >>>><br>
                          >>>> FYI: I've just implemented an
                          OVMS v3 style replacement for the
                          SimpleConsole:<br>
                          >>>><br>
                          >>>> <a
                            href="https://github.com/dexterbg/WifiConsole"
                            target="_blank" moz-do-not-send="true">https://github.com/dexterbg/WifiConsole</a><br>
                          >>>><br>
                          >>>> V3 makes it pretty easy now
                          to add stuff like this. It's using a script
                          plugin to provide custom functions via the web
                          API.<br>
                          >>>><br>
                          >>>> Regards,<br>
                          >>>> Michael<br>
                          >><br>
                          >> --<br>
                          >> Michael Balzer * Helkenberger Weg 9 *
                          D-58256 Ennepetal<br>
                          >> Fon 02333 / 833 5735 * Handy 0176 /
                          206 989 26<br>
                          >><br>
                          >>
                          _______________________________________________<br>
                          >> OvmsDev mailing list<br>
                          >> <a class="moz-txt-link-abbreviated"
                            href="mailto:OvmsDev@lists.openvehicles.com"
onclick="parent.window.location.href='mailto:OvmsDev@lists.openvehicles.com';
                            return false;" target="_blank"
                            moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a><br>
                          >> <a
                            href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
                            target="_blank" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br>
                          >><br>
                          >
                          _______________________________________________<br>
                          > OvmsDev mailing list<br>
                          > <a class="moz-txt-link-abbreviated"
                            href="mailto:OvmsDev@lists.openvehicles.com"
onclick="parent.window.location.href='mailto:OvmsDev@lists.openvehicles.com';
                            return false;" target="_blank"
                            moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a><br>
                          > <a
                            href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
                            target="_blank" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br>
                          <br>
_______________________________________________<br>
                          OvmsDev mailing list<br>
                          <a class="moz-txt-link-abbreviated"
                            href="mailto:OvmsDev@lists.openvehicles.com"
onclick="parent.window.location.href='mailto:OvmsDev@lists.openvehicles.com';
                            return false;" target="_blank"
                            moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a><br>
                          <a
                            href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
                            target="_blank" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></div>
                      </div>
                    </div>
                  </div>
                   
                  <fieldset class="mimeAttachmentHeader"> </fieldset>
                  <pre class="moz-quote-pre">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com" onclick="parent.window.location.href='mailto:OvmsDev@lists.openvehicles.com'; return false;" target="_blank" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" target="_blank" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
                </blockquote>
                 
                <pre class="moz-signature">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
                _______________________________________________ OvmsDev
                mailing list <a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a> <a
                  href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev"
                  target="_blank" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="160">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
  </body>
</html>