Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Русский
    3. ioBroker
    4. Скрипты
    5. ioBroker скрипты
    6. Включение освещения по движению

    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

    Включение освещения по движению

    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      instalator last edited by

      Включаем свет по движению и обнуляем таймер пока есть движение.

      В принципе работает. Покритикуйте) какие варианты есть еще?

      var timer;
      var flag_motion_kitchen = false;
      on('mqtt.0.myhome.Kitchen.Motion', function (obj) { 
          clearTimeout(timer);
          var lux_kitchen = getState('mqtt.0.myhome.Kitchen.Lux').val;
              if (lux_kitchen <= 515){flag_motion_kitchen = true;}
              if (flag_motion_kitchen){timer = setTimeout(function() {setState('mqtt.0.myhome.Lighting.Kitchen_Main', '0'); flag_motion_kitchen = false;}, 30000);}
              if (obj.newState.val == 1 && flag_motion_kitchen){
                  setState('mqtt.0.myhome.Lighting.Kitchen_Main', '1'); 
              }
      });
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Support us

      ioBroker
      Community Adapters
      Donate

      694
      Online

      31.8k
      Users

      80.0k
      Topics

      1.3m
      Posts

      1
      1
      1610
      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