{"id":952,"date":"2023-10-06T05:25:51","date_gmt":"2023-10-06T05:25:51","guid":{"rendered":"https:\/\/iotmanager.org\/?p=952"},"modified":"2023-10-06T05:25:51","modified_gmt":"2023-10-06T05:25:51","slug":"%d0%ba%d0%b0%d0%ba-%d1%83%d0%bf%d1%80%d0%b0%d0%b2%d0%bb%d1%8f%d1%82%d1%8c-%d1%81%d0%be%d0%b1%d1%8b%d1%82%d0%b8%d1%8f%d0%bc%d0%b8-%d0%bf%d0%be-%d0%b2%d1%80%d0%b5%d0%bc%d0%b5%d0%bd%d0%b8","status":"publish","type":"post","link":"https:\/\/iotmanager.org\/en\/2023\/10\/06\/952\/","title":{"rendered":"How do I manage events by time?"},"content":{"rendered":"<p>One of the ways to manage events by time.<\/p>\n\n\n\n<p>The event starts from 8 am to 23 pm every 10 minutes. BTN12 is turned on and the LED indication is displayed. Starting now&nbsp;<a href=\"https:\/\/old.iotmanager.org\/wiki\/index.php?title=%D0%A0%D0%B0%D0%B1%D0%BE%D1%82%D0%B0_%D1%82%D0%B0%D0%B9%D0%BC%D0%B5%D1%80%D0%BE%D0%B2_%D0%BE%D0%B1%D1%80%D0%B0%D1%82%D0%BD%D0%BE%D0%B3%D0%BE_%D0%BE%D1%82%D1%81%D1%87%D0%B5%D1%82%D0%B0\">reverse delay timer<\/a>&nbsp;for 60 seconds<br><strong>if timer_l==0&amp;getHours() &gt; 07&amp;getHours() &lt;23&amp;gethhmm() == &#171;**:*1&#187; then {btn12= 1; led =1; timerPump = 60}<\/strong><\/p>\n\n\n\n<p>Shutdown after 60 seconds by timer.<br><strong>if timerPump==0 then {led=0; btn12=0}<\/strong><\/p>\n\n\n\n<p>Turn on the light from 17 to 22 hours. This construction will work at any time from this interval. If suddenly there was no light and it appeared later, it will still turn on.<br>If you want it to work only at 17 you can use the module&nbsp;<a href=\"https:\/\/iotmanager.org\/en\/#\/modules\">cron<\/a>.&nbsp;<strong>if timer_l==0&amp;getHours() &gt; 16&amp;getHours() &lt;22&amp;light_time==0 then {btn13 = 1; light_time=1; tglemon2.sendMsg(&#171;\u041b\u0438\u043c\u043e\u043d1 \u0441\u0432\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0435\u043d &#187; + getTime())}<\/strong><\/p>\n\n\n\n<p>Lights out at 22.00<br><strong>if timer_l==0&amp;light_time==1&amp;getHours() &gt; 21 then {btn13 = 0; light_time=0;}<\/strong><\/p>\n\n\n\n<p>This is one of the ways to manage events in IoTmanager. There are others, each for its own case.<\/p>\n\n\n\n<p>For this scenario to work, you need a circular timer timer_l with an interval of one minute, for generating events, and a timer called timerPump. You can do without the second line:&nbsp;<strong>if timer_l==0&amp;getHours() &gt; 07&amp;getHours() &lt;23&amp;gethhmm() == &#171;**:*2&#187; then {btn12 = 0; led =0;}<\/strong><\/p>\n\n\n\n<p>The effect will be similar. This shows that you can achieve the same action in different ways.<br>You can also use the string:<br><strong>if cron then {btn12 = 0; led =0;}<\/strong><br>In this case, with the cron setting, specify:<\/p>\n\n\n\n<p><strong>0 2,12,22,32,42,52 * * * *<\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0417\u0430\u043f\u0443\u0441\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u0441 8 \u0443\u0442\u0440\u0430 \u0438 \u0434\u043e 23 \u043a\u0430\u0436\u0434\u044b\u0435 10 \u043c\u0438\u043d\u0443\u0442. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f btn12 \u0438 \u0438\u043d\u0434\u0438\u043a\u0430\u0446\u0438\u044f led. \u0421\u0442\u0430\u0440\u0442\u0443\u0435\u0442&nbsp;\u0442\u0430\u0439\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438&nbsp;\u043d\u0430 60 \u0441\u0435\u043a\u0443\u043d\u0434if timer_l==0&amp;getHours() &gt; 07&amp;getHours() &lt;23&amp;gethhmm() == &#171;**:*1&#187; then {btn12= 1; led =1; timerPump = 60} \u0412\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 60 \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0443.if timerPump==0 then {led=0; btn12=0} \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 &#8230; <a title=\"How do I manage events by time?\" class=\"read-more\" href=\"https:\/\/iotmanager.org\/en\/2023\/10\/06\/952\/\" aria-label=\"More on \u041a\u0430\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438?\">Read more<\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/posts\/952"}],"collection":[{"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/comments?post=952"}],"version-history":[{"count":1,"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/posts\/952\/revisions"}],"predecessor-version":[{"id":953,"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/posts\/952\/revisions\/953"}],"wp:attachment":[{"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/media?parent=952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/categories?post=952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iotmanager.org\/en\/wp-json\/wp\/v2\/tags?post=952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}