Some time ago, I wanted to have a SIP based doorbell to nicely integrate with my smarthome and while searching, I came across doorPi.
With my below described config, one will be able to turn on the lights on your doorPi based on openHAB Astro Binding, have your Alexa say something like “Doorbell is ringing” and hangup when the door is opened.
Prerequisits
You need to have a up and running doorPi.
Instructions can be found here (German only, sorry)
https://www.doorpi.org/forum/lexicon/entry/1-installation-doorpi-mittels-pypi-auf-einem-raspberry-pi-raspbian/
doorPi.ini - piFace config
[keyboards]
prodsystem = piface
[prodsystem_InputPins]
0 = sleep:0 // doorbell pushbutton
1 = sleep:0 // Lights ON
2 = sleep:0 // Lights OFF
3 = hangup:0 // Receive openHAB command to hangup when door is opened
[prodsystem_OutputPins]
0 = Sound
1 = Lights
Usually, you would use your input pins directly to make a call in doorPi. Defining just a sleep command lets us use the event system to take further action.
The output pins present piFace outputs to switch the relais for the soundcard or the lights.
doorPi.ini - Event config
[EVENT_OnKeyPressed_prodsystem.0]
10 = os_execute:curl --header "Content-Type: text/plain" --request POST --data "ON" http://192.168.0.112:8080/rest/items/doorPiCall
20 = call:**611#622#623
When the doorbell button is pressed, this event is triggered, sending a REST call to a openHAB Switch Item, indicating an active call. The call will be initiated in line two.
[EVENT_OnKeyPressed_prodsystem.1]
10 = out:Lights,1
[EVENT_OnKeyPressed_prodsystem.2]
10 = out:Lights,0
The unused piFace inputs 1 and 2 are used to receive a trigger from openHAB to switch ON/OFF the lights.
[EVENT_OnMediaNotRequired]
10 = out:Sound,0
20 = os_execute:curl --header "Content-Type: text/plain" --request POST --data "OFF" http://192.168.0.112:8080/rest/items/doorPiCall
Switch off the amplifier and send information to openHAB that the door call has ended.
[EVENT_OnMediaRequired]
10 = out:Verstaerker,1
Switch on the amplifier when a call will be initiated.
openHAB Items
Switch doorPiCall "doorPi call active" <soundvolume>
String Echo_Living_TTS "Text to Speech" {channel="amazonechocontrol:echo:148fa16d:B0F00715603600UB:textToSpeech"}
openHAB Rules
rule "Switch ON doorPi lights"
when
Channel 'astro:sun:local:set#event' triggered START
then
sendHttpGetRequest("http://user:password@doorPi.local/control/trigger_event?event_name=OnKeyPressed_prodsystem.1&event_source=doorpi.keyboard.from_piface")
end
rule "Switch OFF doorPi lights"
when
Channel 'astro:sun:local:rise#event' triggered START
then
sendHttpGetRequest("http://user:password@doorPi.local/control/trigger_event?event_name=OnKeyPressed_prodsystem.2&event_source=doorpi.keyboard.from_piface")
end
rule "Hangup doorPi call when frontdoor is opened"
when
Item ContactFrontDoor changed to OPEN
then
if (doorPiCall.state == ON) {
sendHttpGetRequest("http://user:password@doorpi.local/control/trigger_event?event_name=OnKeyPressed_prodsystem.3&event_source=doorpi.keyboard.from_piface")
}
end
rule "doorPi calling"
when
Item doorPiCall changed to ON
then
Echo_Living_TTS.sendCommand("Doorbell Is Ringing")
end
What is missing ?
A fancy widget for HABpanel to receive the video stream with integration of a JavaScript SIP client.