Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Arming alarm panel using lua code


Question

Posted (edited)

Hi, is possible perform arming action using lua code like is arming command in alarm panel? Arming at alarm panel looks good and works well, I can arm my house from ipad app or web, and I can see, which sensors are armed on booth of them at the same time, which have time delay, and much more.

But I need arm my house from scene and virtual device, and it would be great have possibility start same arming sequence as from app or web using lua code.

Something like java script command at web, fibaroAlarm.setArmAlarm.

I know that is possible arm each device separately, but with this I'm not happy with that.

Thank you

Edited by T.Konopka
Wrong category.

10 answers to this question

Recommended Posts

  • 0
Posted

The topic has been moved from "

Please login or register to see this link.

" to "

Please login or register to see this link.

".

 

Temat został przeniesiony z "

Please login or register to see this link.

" do "

Please login or register to see this link.

".

  • 1
Posted

Hi @marbe

 

This is the code that I use:

 

Please login or register to see this code.

 

Dave

  • Thanks 1
  • 0
Posted

Hi, It´s possible to do it to disarm?

 

Thanks


Alex

  • 0
Posted (edited)

Hi @AlexVidigal

 

Here is the code to disarm.  Basically the same but instead a "0" is passed into the "setArmed" property of the device:

 

Please login or register to see this code.

 

Dave

Edited by Dave Harrison
  • 0
Posted (edited)

Thanks

Please login or register to see this link.

:)

 

Please login or register to see this code.

Do you have it's VD?

 

Thanks again

Alex

 

 

Edited by AlexVidigal
  • 0
Posted (edited)

How can I exclude the Home Sensors. I mean only arm outside sensors?

 

Please login or register to see this code.

Change this "false" to "true" and then say device number I want exclude ???

 

thanks

Alex

 

 

Edited by AlexVidigal
  • 0
Posted
6 hours ago, AlexVidigal said:

How can I exclude the Home Sensors. I mean only arm outside sensors?

 

Please login or register to see this code.

Change this "false" to "true" and then say device number I want exclude ???

 

Hi @AlexVidigal

 

Not quite.  You'll need to change that line to this:

Please login or register to see this code.

Where the value of roomID is the room id number that you have your outside sensors located in.

 

Dave

  • 0
Posted (edited)

Hi Dave Harrison 

 

 It work but not in my case, because in the same room I have 2 devices... one to arm and other to not arm when I'm at home:

 

[DEBUG] 22:54:12: 25/11/2017 22:54:12: Mov Sensor armed
[DEBUG] 22:54:12: 25/11/2017 22:54:12: Door Sensor armed

 

In this case I don't want arm the Mov Sensor sensor only the Door Sensor

 

Thanks Dave

Edited by AlexVidigal
  • 0
Posted

It works now:

 

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

-- Scene         : Turn Alarm on
-- Version       : 1.0
-- Date Created  : 13 June 2016
-- Last Changed  : 13 June 2016
-- HC Version    : Home Center 2 v4.080
-- Created By    : Dave Harrison

-- Purpose       : To arm all the motion sensors
-- Trigger       : Called by a virtual device

--=================================================
-------------------- Declaration: Local Variables
--=================================================
local debug = true

local sourceTrigger = fibaro:getSourceTrigger()
local currentDate = os.date("%d/%m/%Y %X")
local currentDateTime = os.time() 

local securityDevices = fibaro:getDevicesId({properties = {alarmExclude="false"}})

--=================================================
-------------------- Functions
--=================================================
local function log(str) if debug then fibaro:debug(str); end; end
local function errorlog(str) fibaro:debug("<font color='red'>"..str.."</font>"); end

--=================================================
-------------------- Main
--=================================================

-- Arm each device
for i , deviceId in pairs(securityDevices) do
    fibaro:call(deviceId, "setArmed", "1")
    log(currentDate .. ": " .. fibaro:getName(deviceId) .. " armed")

-- Desarm home devices
   fibaro:call(14, "setArmed", "0")
   fibaro:call(22, "setArmed", "0")
   fibaro:call(35, "setArmed", "0")

 

 

  • 0
Posted (edited)

Hi @AlexVidigal

 

OK, that's one way of doing it, although you appear to be missing the end statement for your for loop.  Personally I like to avoid hardcoding the device ids, but I can see that in this case it might be a little difficult to do that.

 

An easier way would be to simply list the device ids that you want to arm, ie:

Please login or register to see this code.

 

Here's a simple VD for you. 

 

Please login or register to see this attachment.

 

You'll need to edit the list of device ids for the doors and windows in Advanced tab of the VD:

 

Please login or register to see this attachment.

 

 

 

Download the VD here: 

Please login or register to see this attachment.

 

Dave

Edited by Dave Harrison

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...