Verisure alarm status into Domoticz

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.

Moderator: leecollings

Post Reply
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Verisure alarm status into Domoticz

Post by alfred_j_kwak »

Hi,

I just made small hack. I have Verisure home alarm system and I'd like to switch lights off when I activate alarm.
I buy couple of Smart Plugs.

Image

Inside plug there is relay - just like in all remote control plugs(?) - I open plug, desolder circuit board, cut power contacts from relay to get voltage free contact and add Nexa WBT-912 inside plug. I connect plug relay into Nexa S1 input and now I have my alarm status in Domoticz.

Image

Would have been easier just add 230VAC relay into plug power socket and connect relay contacts into Nexa, but now everything is inside nice package - no hanging wires all around (wife approval factor...)
hansrune
Posts: 49
Joined: Monday 07 October 2013 10:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Verisure alarm status into Domoticz

Post by hansrune »

I do similar. I have two verisure smartplugs. One on my primary wifi router, one on my guest wifi router. The guest goes off on verisure 'arm home' . They are both off on 'arm away' . I want them off when we are not home, and a 3rd cabled router takes care of the
Internet link. I use a LUA script to ping the wifi routers every minute and update Domoticz security state accordingly . So I never have to deal with Domoticz security state other than via the Verisure panels.
... and no hardware modifications needed!
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Re: Verisure alarm status into Domoticz

Post by alfred_j_kwak »

Hah. Creative thinking. I just go with Dremel...

One nice feature in my application is that when I open front door and alarm is on the Smart Plug goes on and Domoticz turns lights on in hallway.
nizaga
Posts: 69
Joined: Monday 30 November 2015 11:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by nizaga »

Hi,

Could you please post the LUA scripts to access the verisure alarm? I am quite new to this and it would really help!

Thanks!

Nacho
hansrune
Posts: 49
Joined: Monday 07 October 2013 10:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by hansrune »

Sorry for not responding before.... My setup using wireless routers controlled by Verisure smartplugs is a based on a LUA script and a helper ping script.

You will have to adjust the helper script or supply the following as command line arguments in the LUA script:
  • Argument 1 or TESTIP - is the router controlled by arm away smartplug
  • Argument 2 or LOCALIP - is another IP adress that is always on. This is used to differentiate router off versus link problems on your Domoticz system
Helper script /usr/local/bin/ping2test:

Code: Select all

#!/bin/bash
#
PROG=$( basename $0 ) 
TESTIP=${1:-"192.168.1.4"}
LOCALIP=${2:-"192.168.1.1"}
DBGPRINT=${DBGPRINT:-":"}
DBGPRINT=${DBGPRINT:-"logger -t ${PROG} -p user.debug"}
LOGINF=${LOGINF:-"logger -t ${PROG} -p user.info"}
LOGERR=${LOGERR:-"logger -t ${PROG} -p user.error"}
#

function pingip {
        local loss=$( ping -w 3 -qc 3 "$1" 2>&1 | sed -ne 's/.*, \([0-9][0-9]*\)% packet loss.*/\1/p' )
        ${DBGPRINT} "Ping to $1 has $loss % loss" >&2
        [[ "$loss" = 100 ]] && return 1
        return 0
}

if pingip ${TESTIP}
then
        ${DBGPRINT} "Can ping ${TESTIP}" >&2
        RC=0
elif pingip ${LOCALIP}
then
        ${DBGPRINT} "Can't ping ${TESTIP} and ping ${LOCALIP} indicates local link ok" >&2
        RC=1
else
        ${DBGPRINT} "Can't ping ${TESTIP} nor ${LOCALIP}" >&2
        RC=0
fi
exit $RC
The second part is the LUA script to change security state accordingly:

Code: Select all

--
-- $Id: script_time_alarm.lua,v 1.1 2014/11/06 20:12:01 pi Exp $ 
-- Ping test IP and use gateway as fallback / link test 
--
debug = false
logging = true
device  = "Husalarm"
oldstate = otherdevices[device]
secstate = globalvariables["Security"]

-- for i, v in pairs(otherdevices_svalues) do print("Idx=" ..  i .. " svalue=" .. v .. "<--") end
-- for i, v in pairs(otherdevices) do print("Idx=" ..  i .. " otherdevice=" .. v .. "<--") end

function lprint(cond, s)
        if (cond) then print(s) end
end

commandArray = {}
if ( oldstate == nil ) then
        lprint(logging, "Giving up: Cannot get security state via device " .. device)
        return commandArray
end
ping_success=os.execute('/usr/local/bin/ping2test')
-- ping_success=false
if ping_success then
        newstate="Disarm"
        lprint(debug, "ping2test success. State for " .. device .. " is " .. oldstate .. "-->" .. newstate) 
else
        newstate="Arm Away"
        lprint(debug, "ping2test failure. State for " .. device .. " is " .. oldstate .. "-->" .. newstate)
end

if ( newstate == "Arm Away" and secstate ~= "Armed Away" )
then
        commandArray[device] = newstate
        lprint(logging,"change " .. device .. "=" .. oldstate .. " and  secstate=" .. secstate .. " to " .. newstate ) 
elseif ( newstate == "Disarm" and secstate == "Armed Away" )
then
        commandArray[device] = newstate
        lprint(logging, "change " .. device .. "=" .. oldstate .. " and  secstate=" .. secstate .. " to " .. newstate ) 
else
        lprint(debug,"No change needed for " .. device .. "=" .. oldstate .. " and secstate=" .. secstate .. " to " .. newstate)
end

return commandArray
nizaga
Posts: 69
Joined: Monday 30 November 2015 11:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by nizaga »

thank you very much for the scripts!

do you have any scripts to access the Verisure customers website and interact with your alarm system?

Regards,

Nacho
hansrune
Posts: 49
Joined: Monday 07 October 2013 10:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by hansrune »

Sorry. I do not. Tried sometime back to ask for verisure APIs, but that was negative.


Sent from my iPad using Tapatalk
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Re: Verisure alarm status into Domoticz

Post by alfred_j_kwak »

I just tested Python script to get Verisure status: http://www.domoticz.com/forum/viewtopic ... 737#p68732
Downside is that it only works if there is internet connection.
nizaga
Posts: 69
Joined: Monday 30 November 2015 11:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by nizaga »

hello,

I would like to share with you my approach to interact with my verisure alarm system. It might not be the "easiest" and "cleanest" way but it is the only way i found.

Verisure in Spain is not under the https://mypages.verisure.com/ websites, so i can not use the verisure API. In fact, verisure bought another alarm system in Spain and rebranded to versiure (https://customers.securitasdirect.es/)

So... my approach, that you could also use to access data from any other website. I tried to use PhantomJS to access the web site, but i could not manage it, so what i did was to install iceweasel on my RPI, install imacros, record the macro i want to execute and then write a script to run the imacro. To run the scripts you need to open a vncserver terminal

The scripts is calling a html file that is running the imacro. The imacro writes a file with the expected result and then the scripts loops until the file is there

test.html

<meta http-equiv="refresh" content="0; url=imacros://run/?m=Securitas.iim" />

The scripts looks like:
#!/bin/bash
#running server?
vncserver=$(ps aux |grep "[X]tightvnc"|awk '{print $2}')
if [[ "$vncserver" != "" ]];then
kill $vncserver 2>/dev/null >/dev/null
fi
if [[ "$(ls -lah /tmp/.X99-lock 2>/dev/null >/dev/null)" ]];then
rm -rf /tmp/.X99-lock
fi
if [[ "$(ls /tmp/.X11-unix/X99 2>/dev/null >/dev/null)" ]];then
rm -rf /tmp/.X11-unix/X99
fi
#starting
vncserver -geometry 1024x768 :99 2>/dev/null >/dev/null &
#######
sleep 10
killall -9 iceweasel 2>/dev/null >/dev/null
rm -rf /tmp/estado.html
iceweasel --display :99 /home/pi/scripts/alarma/test.html 2>/dev/null >/dev/null &
count=0
while ! [[ -f /tmp/estado.html || count -ge 20 ]];do
sleep 10
#echo "Count: $count - Esperando..."
count=$(($count + 1))
done
sed -n 's/"Tu Alarma est. \(.*\)\"/\1/gp' /tmp/estado.html
#######
#finishing
ps aux |grep "[X]tightvnc :99"|awk '{print $2}'|xargs kill 2>/dev/null >/dev/null

Regards,

Nacho
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Re: Verisure alarm status into Domoticz

Post by alfred_j_kwak »

So many ways :)
I just noticed that some of recent updates add new notifications to Android Verisure app. Before, when you alarm/disalarm, app only gives Verisure notification - now it says that alarm is armed or disarmed and shows who has activate event. This makes it possible to use Tasker in Android to check notification text and trigger url to update Domoticz info.
fritz
Posts: 2
Joined: Wednesday 23 September 2015 23:03
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by fritz »

Hi @nizaga, Does your macro keep logged into securitas' web page or do you login with some frequency to check the status? Can you share some more of how you have done this? I am also in Spain.
nizaga
Posts: 69
Joined: Monday 30 November 2015 11:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by nizaga »

hi, i only access the verisure website whenever i want to enable / disable my alarm.

You can add a IFTTT rule base on Geolocalization and tell domoticz to run the script whenever you are approaching / exiting your area.

The macro is developed using imacros and i installed weasel in RPI.

The tricky part is to run the imacro, using vncserver. You have the scripts added to my previous comment.

Regards,

Nacho
fritz
Posts: 2
Joined: Wednesday 23 September 2015 23:03
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by fritz »

Thanks Nacho!
nizaga
Posts: 69
Joined: Monday 30 November 2015 11:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by nizaga »

hi fritz, let me know if it is working on your side. the script i posted was to check the status, you can change it and the imacro to activate / deactivate the alarm.

nacho
IvovanTulden
Posts: 2
Joined: Friday 16 February 2018 18:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Verisure alarm status into Domoticz

Post by IvovanTulden »

Thank you for the post and the great idea.
I have a question about the 2-channel transmitter you just, nexa wbt-912.
This looks like a local product from Finland, do you think it is possible to use a qubino for this also?
andimq
Posts: 1
Joined: Wednesday 31 October 2018 22:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Verisure alarm status into Domoticz

Post by andimq »

Hi,

registered only for this thread :-).

I am very interested on separating the Verisure Smart Plug functionality away from the 230V input & output meaning I really only want the relay with the the power in/out.

From what it sounds, Alfred managed to do this but unfortunately the pictures don't show anymore.

Apart from a little more detailed reports on how to go about this I have a follow-up question:

Does the relay still work even if there is power/internet outage in the building? Usually, Verisure components like the main unit, the alarm and the panels have a GSM fallback and batteries to ensure they continue working. How is it with the Smart Plug once the relay is stripped out of it, does it have the same GSM fallback and can be kept "alive" using a battery?

If yes, this really opens the door to a lot of applications where "live" alarm is needed no matter status of power/internet.

Thanks a lot, much appreciated!
Andreas
IvovanTulden
Posts: 2
Joined: Friday 16 February 2018 18:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Verisure alarm status into Domoticz

Post by IvovanTulden »

Dear Andreas, the smart plug needs 230V to work. The smart plug doesn't have its one battery or internet connection.
What this means, if I have a power failure at home all my smart plugs stop working, but the alarm which works on batteries and the back-up GSM module keep working.
To hopefully clarify this more: when I disconnect the smart plug for a longer period of time (don't know exactly but say one hour) then I get a message from Verisure that the connection to that smartplug is gone. The smart plug is monitored externally from Versisure but needs 230V. Also when I do plug it in, it seeks the main unit and after 1 or 2 seconds the device found this and is ready for use.

Additional: you can trigger individual smart plugs on events, when the alarm is activated, when a burglar alarm is triggered, when firewall alarm is triggered etc. As long as you got 230V you can do a lot of things.
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Verisure alarm status into Domoticz

Post by Flopp »

I have made a plugin for Verisure.
At the moment it only get data for Door lock.
I am using Yale Doorman V2N together with a Verisure gateway.
Please have a look and create an issue at github if something is not working or you need some new features.
It is very Beta at the moment
https://github.com/flopp999/Verisure-Domoticz
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest