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


1 Screenshot

About This File

What features does the LOQED Touch Smart Lock offer with Fibaro?

The LOQED Touch Smart Lock & Fibaro integration is done via the local bridge API.

Currently, the following functionalities are supported:

  • Send real-time status changes of the lock (open, unlock, lock) and battery, Wi-Fi, Bluetooth state to the Fibaro HC2 gateway.

  • Receive commands from the Fibaro HC2 gateway to change the lock state (open, unlock, lock).

  • Only English language supported, however you can edit the VD code to add your own language.

  • Currently this VD can’t decode json data POSTed by the bridge, as FIBARO API simply ignores any unknown data and accept only JSON key args:[{}]. Therefore, one can’t decode who opened/closed the LOQED via App (or if it was manually, with knob).

  • Security consideration: the LOQED bridge sends any status change (e.g. "the door was opened") to Fibaro over an unsecure HTTP connection in your Wi-Fi network. There is no way to add digital signature (like used by LOQED QuickApp on e.g. Home Center 3) into the Home Center 2 VD. Note that this does not affect opening/locking the door, it is only concerns the status information.

Requirements

 

Installation

Step 1: create API key

Go to https://app.loqed.com/API-Config and log in with your LOQED app e-mail address and password (note that you will be logged out of the LOQED app). Click on the “API Configuration tool" button. Click the “Add new API key” button. Set any name and create the API key. It is normal the “Remove unlocking/locking checkbox is greyed out.

After the key is created, click on the "view / edit" button. Leave this screen open.

 

Step 2: Install the Loqed VD on the Fibaro HC2 gateway

Login into your Fibaro gateway.

Download the VD, unzip the content, go to "Devices" -> "Add or Remove Device"->"Import virtual device" and click "select file".
Select the "LOQED.vfib" file and upload it.

Once uploaded, few things need to be set in the VD, go to advanced tab of the VD:

  • enter the LOQED Bridge IP Address into the VD "IP Address" field
  • enter 80 for the VD "TCP Port" field
    IP.PNG.291c5450a1f15c3977cce9655d8f138d.PNG
     
  • in each every Button (Lock, Unlock and Open) code window, change these two variables:
    local loqed_key_id = 0
    local loqed_key = 'TE9RRUQgVkQgdi4wMSBmb3IgSG9tZSBDZW50ZXIgMiAoYykgdGlubWFu'
    to the values from the LOQED API Config website
     

    loqed_key_id is LOQED API Config -> "API Keys (incoming webhooks)" -> "Local Key ID"
    loqed_key is LOQED API Config -> "API Keys (incoming webhooks)" -> "Key"
    vd_code_1.PNG.a72da0eb1cbf51cae4ddb9e2bfcc50e8.PNG
     

Save the VD.

You should get now some values displayed in the VD,

status_1.PNG.995063f6484406815f03f42068a2e48c.PNG


if this is working please change the loop value in VD mail loop window to something like e.g. 10 minutes 
 

fibaro:sleep(1000*60*10)


instead of the 10 seconds

 

fibaro:sleep(1000*10)


which are fine for test, but not daily use.

vd_code_2.PNG.774a3c5500ca4a7f74aac5b89c90d185.PNG

 

 

Step 3: Setup Variables on the Fibaro HC2 gateway

Go to "Panels" -> "Variables Panel"
Scroll down to "Predefined variables"
Click on "Add"
For variable name use "LOQED"
Add two extra values, you need totally 4 of them
For the values use following values:

  • open
  • unlocked
  • locked
  • unknown
    predefinded_variable_loqed.PNG.ea10aef942a015611554b77641c7ac2c.PNG
     

Click on save.

Later, you will be able to run your own block and LUA scenes, based on the LOQED variable values.

 

Step 4: Create webhook scenes on the Fibaro HC2 gateway

Go to scenes, and click on create -> new -> LUA
You need totally 4 scenes, the scene name does not matter, the scene ID is only important (for LOQED webhook).
For the vd_id please use the LOQED VD device ID, which you previously wrote down.

for "Open State" scene

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

-- change the xxx below to the LOQED VD ID on your HC2
local vd_id = xxx 

fibaro:call(vd_id, "setProperty", "ui.LabelStatus.value", "Open")
fibaro:setGlobal("LOQED", "open")


for "Locked State" scene

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

-- change the xxx below to the LOQED VD ID on your HC2
local vd_id = xxx 

fibaro:call(vd_id, "setProperty", "ui.LabelStatus.value", "Locked")
fibaro:setGlobal("LOQED", "locked")


for "Unlocked State" scnene

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

-- change the xxx below to the LOQED VD ID on your HC2
local vd_id = xxx 

fibaro:call(vd_id, "setProperty", "ui.LabelStatus.value", "Unlocked")
fibaro:setGlobal("LOQED", "unlocked")


for "Unknwon Position" scene

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

-- change the xxx below to the LOQED VD ID on your HC2
local vd_id = xxx 

fibaro:call(vd_id, "setProperty", "ui.LabelStatus.value", "Unknown position")
fibaro:setGlobal("LOQED", "unknown")


Write down the scene IDs, you will need them in Step 7
 

Step 5: Test VD / Scenes

Go to "Your Home" on your HC2 webpage, to be able to see the VD and scenes together.
permission_1.PNG.da1ddc3a17c948acd81faa85be93d3fb.PNG

 


Clicking on the Open, Unlock and Lock buttons of the VD should controll your LOQED Lock, additionally you should see in the VD "Lock state" label some messages,
e.g. when you click on "Unlock" the status will be "Unlock clicked" right after you clicked, and "Unlock executed" right after your LOQED Lock recieved that command.

 

Executing (simply manually click on start) of the 4 scenes, should change the VD "Lock state" label to "open", "locked", "unlocked" and "unknown position".

If all these tests are successful, you can continue with the next step.

 

Step 6: Create a user and set access permissions on the Fibaro HC2 gateway

Go to Settings->Access Control
Create new local user, e.g. loqed
Setup password for the user, please don't use any special characters

user.PNG.f2ddb1be7e33ea15d6a65ce513c319f9.PNG


Change the user Access Control rights, give the user full access to the LOQED VD and these 4 LUA webhook scenes

permission_2.PNG.26e2aed806c4e3f97629e34d04ef791f.PNG

 

permission_3.PNG.07ac5dc8c570dccb20b25968644db49c.PNG

 

 

Step 7: Create webhooks on LOQED bridge

The LOQED bridge can send any status change of the lock to your gateway as soon as they happen. For this, you need to set some URL's on the LOQED Bridge.

 

You need to create 4 webhooks on the LOQED Bridge to inform the gateway about the 4 different lock statuses.

 

Go to https://app.loqed.com/API-Config --> "Outgoing Webhooks via LOQED Bridge" --> click the button "Add/delete webhooks".
On that page, add the following URLs:

http://gw_user:gw_password@gw_ip/api/scenes/123/action/start
(only for the night lock trigger, change the 123 to the ID of the "Locked State" scene)

http://gw_user:gw_password@gw_ip/api/scenes/124/action/start
(only for the latch trigger, change the 124 to the ID of the "Unlocked State" scene)

http://gw_user:gw_password@gw_ip/api/scenes/125/action/start
(only for the open trigger, change the 125 to the ID of the "Open State" scene)

 

http://gw_user:gw_password@gw_ip/api/scenes/126/action/start
(only for the unknown state trigger, change the 126 to the ID of the "Unknwon Position" scene)

 

Above, "gw_user" and "gw_password" is your gateway's username and password created in previous step, "gw_ip" is the IP of ypur Home Center 2
 

webhooks.thumb.PNG.46d697fabe44bab76532bd9e8d1b5dd8.PNG

 

 

Done

 

That's it! You can now control your LOQED Touch using Fibaro Home Center 2.
 

LOQED_VD_HC2.PNG.b3b1e5b2b6875eea88dadbdd7054e03e.PNG

 

 

Questions?

If you have any questions regarding this VD, comments or improvements requests, please send me PM

 

tinman

 

 

 

 

Edited by tinman
wrong picture



User Feedback

You may only provide a review once you have downloaded the file.

There are no reviews to display.

×
×
  • Create New...