This guide will show you how to add and operate the LOQED Smart Lock with your Domoticz installation.

You will end up with two switches:

latch_frontdoor.png


This one will allow you open the door by unlatching the daylock.

unlock-lock_frontdoor.png


This one will allow you to unlock/latch the door, and lock the door.
It will also show the current status of the lock, even if you operate it outside of Domoticz

Create the Latch door switch

1 Create new device

- Go to Setup -> Hardware and enter the name of your device. eg: device_door
- Choose the device type 'Dummy' and click 'Add'.

2 Create virtual sensor

The new device will be visible on the top of the page.

cvs.png

- Click
- Enter the name of your switch. eg: Latch door.
- Choose the sensor type 'Selector Switch'.
- Click 'Ok'

On the 'Switches' tab in Domoticz you should have a switch that looks like this:

latch_door.png

Repeat step 2 to create another virtual sensor type 'Selector Switch' and name it 'unlock/lock door'.

3. Create API URLs

Visit https://webhooks.loqed.com, log in with your administrator account, and create an API Key. You should end up with an entry similar to below. Leave this page open. You will need the three URLs in the next step.
* This step will log you out of the LOQED mobile App.

Webhook URL

Open

url/v1/locks/0000/state?lock_api_key=xx&api
_token=xx&lock_state=OPEN&local_key_id=0

Latch

url/v1/locks/0000/state?lock_api_key=xx&api
_token=xx&lock_state=DAY_LOCK&local_key_id=0

Night lock

url/v1/locks/0000/state?lock_api_key=xx&api
_token=xx&lock_state=NIGHT_LOCK&local_key_id=0

Status

url/API/lock_status.php?api_token=xx&lock_id=xx

4 Add API URLs to sensors

Latch door switch
- On the 'Switches' tab click on 'Edit' for the 'Latch door' sensor.
- Change the Switch Type to: 'Door Lock Inverted'.
- In the 'On Action' field, paste the 'Open' webhook url.
- Set the 'Off Delay' to 5
- Click 'Save'

Unlock/lock door switch
- On the 'Switches' tab click on 'Edit' for the 'Latch door' sensor.
- Change the Switch Type to: 'Door Lock'.
- In the 'On Action' field, paste the 'NIGHT_LOCK' webhook url.
- In the 'Off Action' field, paste the 'DAY_LOCK' webhook url.
- Click 'Save'

Now you are able to unlock and lock your LOQED Smart Lock and open the door.
If you click the favorites star on the switches, they appear on your dashboard.
To use the custom build LOQED icons, download this file and upload Setup -> More Options -> Custom Icons.

Get the current LOQED status in the unlock/lock switch

When operating the door manually or trough the LOQED App, the status of the lock changes without Domoticz being aware of this. The following instructions will help you communicate the current status back to Domoticz in the unlock/lock switch at all time.

- Create a third virtual switch ( Type: Door Lock - Name: Status )
- Remember the Idx number

Create and test URLs to change the status of the ‘LOQED Status’ switch

We are now going to format an URL that the LOQED Backend can call to let Domoticz know the LOQED Status has changed. The URL looks like this, but certain parts need to be changed:

[https://www\.mywebsite\.org/json\.htm?username=\[USERNAME\]&password=\[PASSWORD\|&type=command&param=switchlight&idx=\\[IDX\\]&switchcmd=Set%20Level&level=\[LEVEL\]\(https://www\.mywebsite\.org/json\.htm?username=%5BUSERNAME%5D&password=%5BPASSWORD%7C&type=command&param=switchlight&idx=%5BIDX%5D&switchcmd=Set%20Level&level=%5BLEVEL\)\]

  • [USERNAME]: Enter your username here in BASE64 format. You can convert your username to this format by using (for example) https://codebeautify.org/base64-encode

  • [PASSWORD]: Enter your password here in BASE64 format. You can convert your username to this format by using (for example) https://codebeautify.org/base64-encode

  • [IDX]: enter the IDX of the switch ID (which you wrote down in the previous step)

  • [LEVEL]: enter the ‘Latch’ selector level (which you wrote down in the previous step)

When you are finished, enter this URL in your browser, and verify that the ‘LOQED Status’ switch changes status to the status you requested! Then, create a second URL for the other selector level ‘Night Lock’ (only the [LEVEL] part of the URL will be different).

4 Enter the URLs in the LOQED system

Go to https://webhooks.loqed.com and login with your administrator account. Click on ‘Add new webhook’. Ensure to select only the ‘Latch’ checkbox, and copy-paste the URL of ‘Latch’ status here. Save. Add another webhook, now only select the ‘Night lock’ checkbox, and copy-paste the other URL of step 3 here. Save as well.

Now you’re all set! Once the lock changes status, the new status will be send to Domoticz.

Did this answer your question?