<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.domoticz.com/index.php?action=history&amp;feed=atom&amp;title=Doorbel_a_virtual_Switch</id>
	<title>Doorbel a virtual Switch - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.domoticz.com/index.php?action=history&amp;feed=atom&amp;title=Doorbel_a_virtual_Switch"/>
	<link rel="alternate" type="text/html" href="https://wiki.domoticz.com/index.php?title=Doorbel_a_virtual_Switch&amp;action=history"/>
	<updated>2026-09-19T01:28:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.domoticz.com/index.php?title=Doorbel_a_virtual_Switch&amp;diff=9378&amp;oldid=prev</id>
		<title>Philchillbill: /* Your doorbell as switch in Domoticz. */</title>
		<link rel="alternate" type="text/html" href="https://wiki.domoticz.com/index.php?title=Doorbel_a_virtual_Switch&amp;diff=9378&amp;oldid=prev"/>
		<updated>2017-07-24T18:45:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Your doorbell as switch in Domoticz.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Your doorbell as switch in Domoticz.=&lt;br /&gt;
&lt;br /&gt;
First you need to connect your 12 AV relays in parallel with your doorbell.&lt;br /&gt;
&lt;br /&gt;
When your doorbell button is pressed, the contact of your relays will connect GPIO18 to ground.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the software&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install python-dev python-pip&lt;br /&gt;
sudo install --upgrade distribute&lt;br /&gt;
sudo install ipython&lt;br /&gt;
sudo install --upgrade RPi.GPIO&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the python script I made&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Doorbell py with read contact uitlezen, &lt;br /&gt;
# GPIO 18 to Ground when button is pushed &lt;br /&gt;
# Release 0.1/&lt;br /&gt;
# Author J. Jeurissen&lt;br /&gt;
# Copyright (c) 2015  J. Jeurissen &lt;br /&gt;
# Python 3&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
import urllib.request&lt;br /&gt;
import json&lt;br /&gt;
import RPi.GPIO as GPIO&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# Settings for the domoticz server&lt;br /&gt;
domoticzserver=&amp;quot;ipadres:8080&amp;quot;&lt;br /&gt;
domoticzusername = &amp;quot;&amp;quot;&lt;br /&gt;
domoticzpassword = &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
domoticzurl = &amp;#039;http://&amp;#039;+domoticzserver+&amp;#039;/json.htm?type=command&amp;amp;param=switchlight&amp;amp;idx=170&amp;amp;switchcmd=On&amp;#039;&lt;br /&gt;
&lt;br /&gt;
GPIO.setmode(GPIO.BCM)&lt;br /&gt;
&lt;br /&gt;
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)&lt;br /&gt;
&lt;br /&gt;
while True:&lt;br /&gt;
	input_state = GPIO.input(18)&lt;br /&gt;
	if input_state == False:&lt;br /&gt;
		print(&amp;#039;Button Pressed&amp;#039;)&lt;br /&gt;
		time.sleep(5.0)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add in crontab the following line&lt;br /&gt;
so your python script is always running&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot python3 /path/doorbel.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:ToBeFormatted]]&lt;/div&gt;</summary>
		<author><name>Philchillbill</name></author>
	</entry>
</feed>