Abfrage Fenster auf/zu

Ja,kann ich.
Vielleicht kann jemand die zwei vorherigen Posts löschen… Habe es nicht mehr hinbekommen…

--[[
%% properties
%% events
%% globals
--]]

--Making sure that only one instance of the scene is running.
if (fibaro:countScenes() > 1) then
  fibaro:abort();
end

-- first setup some local variables
-- deBug = true then show debug messages or deBug = false then hide debug messages
local deBug = true;
-- First get source trigger
local sourceTrigger = fibaro:getSourceTrigger()

  -- if run manually or started by other scene or VD then run this part of code:
if (sourceTrigger["type"] == "other") then
  local OpenWinDoor = ""
  local opened = 0;
  -- add devices numbers separated by comma
  local winDoorID = {130,67,115,117, 113};
  local winDoorNO = 5;
  -- loop through all doors and windows and check state
  for iVar = 1, winDoorNO do
    -- if found window or door open set flag and get description to show in popup window
    if fibaro:getValue(winDoorID[iVar], "value") == "1" then
      opened = opened + 1;
      local room = 	(winDoorID[iVar]);
      OpenWinDoor = OpenWinDoor .. fibaro:getValue(winDoorID[iVar], "userDescription") .."\n";
      if deBug then fibaro:debug(fibaro:getValue(winDoorID[iVar], "userDescription").. " Fenster ist offen.") end
    end
  end 
  if opened == 0 then
    local typeInfo = "Success";
    local titleInfo = "ALLE FENSTER SIND GESCHLOSSEN";
    OpenWinDoor = ""
    
    -- pop-up call
HomeCenter.PopupService.publish({
 -- Titel (benötigt)
 title = 'Status Fenster und Türen :',
 -- Subtitel (optional), z.B. Uhrzeit und Datum
 subtitle = os.date("%I:%M:%S %p | %B %d, %Y"),
 -- Content header (optional)
 contentTitle = 'Alle Türen und Fenster sind geschloßen.',
 -- Content (benötigt)
 contentBody = 'Das Haus ist sicher.',
 -- Notification-Image (optional)
 img = imgUrl,
 -- popUp-Typ (benötigt)
 type = 'Success',
 -- definierte Buttons (optional; sollten keine definiert werden, wird ein OK-Button erzeugt)
 buttons = {
 { caption = 'OK', sceneId = 0 }
  }
})
  else
    local typeInfo = "Critical";
    local titleInfo = "Achtung ! Folgende Fenster/Türen sind noch geöffnet:";
  
 -- pop-up call
HomeCenter.PopupService.publish({
 -- Titel (benötigt)
 title = 'Status Fenster und Türen :',
 -- Subtitel (optional), z.B. Uhrzeit und Datum
     title = "Status Fenster/Türen:",
      -- subtitle(optional), e.g. time and date of the pop-up call
      subtitle = os.date("%H:%M:%S | %d.%m.%Y."),
      -- content header (optional)
      contentTitle = titleInfo,
      -- content (required)
      contentBody = OpenWinDoor,
      -- notification image (assigned from the variable)
      img = "",
      -- type of the pop-up
      type = typeInfo,
      -- buttons definition
      buttons = { { caption = 'OK', sceneId = 0 } }
    })
end

end

Hi,

Versuch mal statt der lokalen Var für
ypeInfo und titleInfo
Diese als globale Var anzulegen und in IF zu befüllen und in dem PopUp-Teil die globale Var auszulesen.

Viele Grüße Hoggle

Ok. versuche ich morgen nochmal. Bis jetzt scheint es erstmal zulaufen.Ist wahrscheinlich übelst programmiert, aber vielleicht hat jemand Lust es sauber zu schreiben. Mir fehlen dafür die Fähigkeiten…

Gratuliere Campos. Es funktioniert - auch bei mir. Ich hab jetzt die Variablen typeInfo und titleInfo ganz weggelassen und die Daten direkt in das pop-up script geschrieben. Das Script ist wirklich prima. Tut exakt was ich wollte. :wink: Danke

Könnte jemand das ganze Skript posten wie es jetzt funktioniert?
Danke im Vorraus

Ist doch oben das Script. 3 Posts vorher. Läuft so.

@avichr : Schau dir das nochmal an :

http://www.domotique-fibaro.fr/index.php/topic/4895-utilisation-du-service-popup-notification-center/

Die Icons austauschen wäre noch ne Idee. Probiere ich die Tage mal aus. Gruß

Bei mir kommt nur: Achtung ! Folgende Fenster/Türen sind noch geöffnet:

Es zeigt aber nicht an, welche!

--[[
%% properties
%% events
%% globals
--]]

--Making sure that only one instance of the scene is running.
if (fibaro:countScenes() > 1) then
  fibaro:abort();
end

-- first setup some local variables
-- deBug = true then show debug messages or deBug = false then hide debug messages
local deBug = true;
-- First get source trigger
local sourceTrigger = fibaro:getSourceTrigger()

  -- if run manually or started by other scene or VD then run this part of code:
if (sourceTrigger["type"] == "other") then
  local OpenWinDoor = ""
  local opened = 0;
  -- add devices numbers separated by comma
  local winDoorID = {232,368,728,330,204,212,332,196,297,351, 334};
  local winDoorNO = 11;
  -- loop through all doors and windows and check state
  for iVar = 1, winDoorNO do
    -- if found window or door open set flag and get description to show in popup window
    if fibaro:getValue(winDoorID[iVar], "value") == "1" then
      opened = opened + 1;
      local room = 	(winDoorID[iVar]);
      OpenWinDoor = OpenWinDoor .. fibaro:getValue(winDoorID[iVar], "userDescription") .."\n";
      if deBug then fibaro:debug(fibaro:getValue(winDoorID[iVar], "userDescription").. " Fenster ist offen.") end
    end
  end 
  if opened == 0 then
    local typeInfo = "Success";
    local titleInfo = "ALLE FENSTER SIND GESCHLOSSEN";
    OpenWinDoor = ""
    
    -- pop-up call
HomeCenter.PopupService.publish({
 -- Titel (benötigt)
 title = 'Status Fenster und Türen :',
 -- Subtitel (optional), z.B. Uhrzeit und Datum
 subtitle = os.date("%I:%M:%S %p | %B %d, %Y"),
 -- Content header (optional)
 contentTitle = 'Alle Türen und Fenster sind geschloßen.',
 -- Content (benötigt)
 contentBody = 'Das Haus ist sicher.',
 -- Notification-Image (optional)
 img = imgUrl,
 -- popUp-Typ (benötigt)
 type = 'Success',
 -- definierte Buttons (optional; sollten keine definiert werden, wird ein OK-Button erzeugt)
 buttons = {
 { caption = 'OK', sceneId = 0 }
  }
})
  else
    local typeInfo = "Critical";
    local titleInfo = "Achtung ! Folgende Fenster/Türen sind noch geöffnet:";
  
 -- pop-up call
HomeCenter.PopupService.publish({
 -- Titel (benötigt)
 title = 'Status Fenster und Türen :',
 -- Subtitel (optional), z.B. Uhrzeit und Datum
     title = "Status Fenster/Türen:",
      -- subtitle(optional), e.g. time and date of the pop-up call
      subtitle = os.date("%H:%M:%S | %d.%m.%Y."),
      -- content header (optional)
      contentTitle = titleInfo,
      -- content (required)
      contentBody = OpenWinDoor,
      -- notification image (assigned from the variable)
      img = "",
      -- type of the pop-up
      type = typeInfo,
      -- buttons definition
      buttons = { { caption = 'OK', sceneId = 0 } }
    })
end

end

Hast du bei den einzelnen Sensoren unter “Erweitert” - “Beschreibung” des Moduls einen Namen eingetragen? Dann sollte es laufen…Sonst wird nichts angezeigt …

Danke campos, das war es.

Erstmal super Sache und es funktionierte auf Anhieb.
Jetzt müsste es nur gehen über Pushbullet die Meldung zu senden.

Ich habe dieses Script übernommen und auf meine Bedürfnisse angepasst.
Vielleicht hat ja noch jemand ähnlich wenig Ahnung wie ich und kann das gebrauchen.

Anstelle der Fenster und Türen werden hier die Lichter abgefragt.

--[[
%% properties
%% events
%% globals
--]]
 
--Making sure that only one instance of the scene is running.
if (fibaro:countScenes() > 1) then
  fibaro:abort();
end
 
-- first setup some local variables
-- deBug = true then show debug messages or deBug = false then hide debug messages
local deBug = true;
-- First get source trigger
local sourceTrigger = fibaro:getSourceTrigger()
 
  -- if run manually or started by other scene or VD then run this part of code:
if (sourceTrigger["type"] == "other") then
  local Lichtstatus = ""
  local eingeschaltet = 0;
  -- add devices numbers separated by comma
  local LichterID = {182,106,217,220,299,79,101,145,147,195,67,178,214,120,224,34,170,172};
  local LichterNO = 18;
  -- loop through all doors and windows and check state
  for iVar = 1, LichterNO do
    -- if found window or door open set flag and get description to show in popup window
    if fibaro:getValue(LichterID[iVar], "value") > "0" then
      eingeschaltet = eingeschaltet + 1;
      local room = 	(LichterID[iVar]);
      Lichtstatus = Lichtstatus .. fibaro:getValue(LichterID[iVar], "userDescription") .."\n";
      if deBug then fibaro:debug(fibaro:getValue(LichterID[iVar], "userDescription").. " ist eingeschaltet.") end
    end
  end 
  if eingeschaltet == 0 then
    local typeInfo = "Critical";
    local titleInfo = "ALLE LICHTER SIND AUSGESCHALTET";
    Lichtstatus = ""
    
    -- pop-up call
HomeCenter.PopupService.publish({
 -- Titel (benötigt)
 title = 'Status Beleuchtung :',
 -- Subtitel (optional), z.B. Uhrzeit und Datum
 subtitle = os.date("%I:%M:%S %p | %B %d, %Y"),
 -- Content header (optional)
 contentTitle = 'Alle Lichter sind ausgeschaltet.',
 -- Content (benötigt)
 contentBody = 'Es wird Energie gespart.',
 -- Notification-Image (optional)
 img = imgUrl,
 -- popUp-Typ (benötigt)
 type = 'Success',
 -- definierte Buttons (optional; sollten keine definiert werden, wird ein OK-Button erzeugt)
 buttons = {
 { caption = 'OK', sceneId = 0 }
  }
})
  else
    local typeInfo = "Critical";
    local titleInfo = "Achtung ! Folgende Lichter sind noch eingeschaltet:";
  
 -- pop-up call
HomeCenter.PopupService.publish({
 -- Titel (benötigt)
 title = 'Status Beleuchtung :',
 -- Subtitel (optional), z.B. Uhrzeit und Datum
     title = "Status Beleuchtung:",
      -- subtitle(optional), e.g. time and date of the pop-up call
      subtitle = os.date("%H:%M:%S | %d.%m.%Y."),
      -- content header (optional)
      contentTitle = titleInfo,
      -- content (required)
      contentBody = Lichtstatus,
      -- notification image (assigned from the variable)
      img = "",
      -- type of the pop-up
      type = typeInfo,
      -- buttons definition
      buttons = { { caption = 'OK', sceneId = 0 } }
    })
end
 
end
1 „Gefällt mir“

Hallo zusammen,
nach über 2 Jahren habe ich erst mit Lua Skripten angefangen.
Ich habe die Scene angepasst, bekomme ich aber direkt Fehler Meldung
“line 12:unexpected symbol near char (195)”

Die Zeile 12 sieht so aus :
–[[
%% properties
%% events
%% globals
–]]

– Script läuft nur wenn die Szene gestartet wird

– Fenster/Tür Kontakte –
– Wohnzimmer –

local Doppeltür Ost = (tonumber(fibaro:getValue(13, “value”)) == 0);
local Tür Terrase Klein = (tonumber(fibaro:getValue(15, “value”)) == 0);
local Tür Pergola = (tonumber(fibaro:getValue(141, “value”)) == 0);
local Tür Kamin = (tonumber(fibaro:getValue(164, “value”)) == 0);
local Tür Klein = (tonumber(fibaro:getValue(7, “value”)) == 0);
– Bibliothek –

Kann mir jemand , freudlicherweise, erklären was ich falsch geschrieben habe ?

Vielen Dank
Christiano

Sorry, ohne Nummerierung.
Die Zeile 12 ist : local Doppeltür Ost = (tonumber(fibaro:getValue(13, „value“)) == 0);

local Doppeltür Ost = (tonumber(fibaro:getValue(13, „value“)) == 0);

versuche es mal so

local Doppeltuer Ost = (tonumber(fibaro:getValue(13, „value“)) == 0);

Umlaute mag Lua glaub ich nicht, bin mir aber nicht sicher.

Und nimm das Leerzeichen vor “Ost” raus.
Auch bei den anderen Definitionen.

Super, Vielen Dank. Es funktioniert.

ja, die Leerzeichen hatte ich übersehen :wink: Leerzeichen bei Variablen funktionieren grundsätzlich nicht. Mit einem “_” statt des Leerzeichen würde es gehen.

Servus, komm irgendwie nicht mehr weiter.
Hab grad das Abfrageskript eingefügt und wollte das Popup testen aber es kommt immer:
line111. attempt to concatenate local ‘deviceID’(a nil value)
Zusätzlich aber z.b. büro türe ist offen.
Pop up erscheint aber keins …
Globale Variable hab ich nicht angelegt?

--[[
%% properties
%% events
%% globals
--]]
 
--Making sure that only one instance of the scene is running.
if (fibaro:countScenes() > 1) then
  fibaro:abort();
end
 
-- first setup some local variables
-- deBug = true then show debug messages or deBug = false then hide debug messages
local deBug = true;
-- First get source trigger
local sourceTrigger = fibaro:getSourceTrigger()
 
  -- if run manually or started by other scene or VD then run this part of code:
if (sourceTrigger["type"] == "other") then
  local OpenWinDoor = ""
  local opened = 0;
  -- add devices numbers separated by comma
  local winDoorID = {216,191};
  local winDoorNO = 11;
  -- loop through all doors and windows and check state
  for iVar = 1, winDoorNO do
    -- if found window or door open set flag and get description to show in popup window
    if fibaro:getValue(winDoorID[iVar], "value") == "1" then
      opened = opened + 1;
      local room = 	(winDoorID[iVar]);
      OpenWinDoor = OpenWinDoor .. fibaro:getValue(winDoorID[iVar], "userDescription") .."\n";
      if deBug then fibaro:debug(fibaro:getValue(winDoorID[iVar], "userDescription").. " Fenster ist offen.") end
    end
  end 
  if opened == 0 then
    local typeInfo = "Success";
    local titleInfo = "ALLE FENSTER SIND GESCHLOSSEN";
    OpenWinDoor = ""
    
    -- pop-up call
HomeCenter.PopupService.publish({
 -- Titel (benötigt)
 title = 'Status Fenster und Türen :',
 -- Subtitel (optional), z.B. Uhrzeit und Datum
 subtitle = os.date("%I:%M:%S %p | %B %d, %Y"),
 -- Content header (optional)
 contentTitle = 'Alle Türen und Fenster sind geschloßen.',
 -- Content (benötigt)
 contentBody = 'Das Haus ist sicher.',
 -- Notification-Image (optional)
 img = imgUrl,
 -- popUp-Typ (benötigt)
 type = 'Success',
 -- definierte Buttons (optional; sollten keine definiert werden, wird ein OK-Button erzeugt)
 buttons = {
 { caption = 'OK', sceneId = 0 }
  }
})
  else
    local typeInfo = "Critical";
    local titleInfo = "Achtung ! Folgende Fenster/Türen sind noch geöffnet:";
  
 -- pop-up call
HomeCenter.PopupService.publish({
 -- Titel (benötigt)
 title = 'Status Fenster und Türen :',
 -- Subtitel (optional), z.B. Uhrzeit und Datum
     title = "Status Fenster/Türen:",
      -- subtitle(optional), e.g. time and date of the pop-up call
      subtitle = os.date("%H:%M:%S | %d.%m.%Y."),
      -- content header (optional)
      contentTitle = titleInfo,
      -- content (required)
      contentBody = OpenWinDoor,
      -- notification image (assigned from the variable)
      img = "",
      -- type of the pop-up
      type = typeInfo,
      -- buttons definition
      buttons = { { caption = 'OK', sceneId = 0 } }
    })
end
 
end