<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wil Heynen &#8211; SmartHomeNG | smarthome knx homematic mqtt hue 1wire home automation</title>
	<atom:link href="https://www.smarthomeng.de/author/whe/feed" rel="self" type="application/rss+xml" />
	<link>https://www.smarthomeng.de</link>
	<description>Die Device Integrations-Plattform für Dein Smart Home</description>
	<lastBuildDate>Wed, 27 Apr 2022 17:04:08 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.5</generator>

<image>
	<url>https://www.smarthomeng.de/wp-content/uploads/global/logo_small_152x152-150x150.png</url>
	<title>Wil Heynen &#8211; SmartHomeNG | smarthome knx homematic mqtt hue 1wire home automation</title>
	<link>https://www.smarthomeng.de</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>wie ich meinen ersten Shelly über das Plugin mit MQTT eingebunden habe</title>
		<link>https://www.smarthomeng.de/wie-ich-meinen-ersten-shelly-ueber-das-plugin-mit-mqtt-eingebunden-habe</link>
					<comments>https://www.smarthomeng.de/wie-ich-meinen-ersten-shelly-ueber-das-plugin-mit-mqtt-eingebunden-habe#comments</comments>
		
		<dc:creator><![CDATA[Wil Heynen]]></dc:creator>
		<pubDate>Fri, 08 May 2020 19:28:05 +0000</pubDate>
				<category><![CDATA[Beispiel-Implementierungen]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[shelly]]></category>
		<guid isPermaLink="false">https://www.smarthomeng.de/?p=2521</guid>

					<description><![CDATA[Da ich mit der Implementierung mehrere Stunden gekämpft habe, möchte ich meine Erfahrungen niederschreiben und eine kleine Anleitung erstellen, wie man am einfachsten vorgeht und welche Fehler man dabei machen kann. Zur Vorgeschichte: Meinen ersten Shelly nutze ich dazu, mein Garagentor über SmartVISU zu öffnen; es gibt zwar eine eigene<a class="moretag" href="https://www.smarthomeng.de/wie-ich-meinen-ersten-shelly-ueber-das-plugin-mit-mqtt-eingebunden-habe"> Weiterlesen&#8230;</a>]]></description>
										<content:encoded><![CDATA[<p>Da ich mit der Implementierung mehrere Stunden gekämpft habe, möchte ich meine Erfahrungen niederschreiben und eine kleine Anleitung erstellen, wie man am einfachsten vorgeht und welche Fehler man dabei machen kann.</p>
<p><strong>Zur Vorgeschichte:</strong><br />
Meinen ersten Shelly nutze ich dazu, mein Garagentor über SmartVISU zu öffnen; es gibt zwar eine eigene App, wie zu allen Smart Home Devices, aber wozu sollte ich für jedes Device eine andere App benutzen. <span id="more-2521"></span></p>
<p>Zunächst musste ich natürlich den Shelly elektrisch anschließen; hierzu gibt es auch schon reichlich Diskussionen in diversen Foren. Ich habe mich für folgende einfache Lösung entschieden und meinen Shelly, wie den Tastschalter oder den Schlüsselschalter angeschlossen.</p>
<p>Da Shelly keine spezielle Taster Funktion kennt, habe ich den Schalter über die App wie ein Treppenlicht konfiguriert; Nach der Betätigung des Schalters wird nach einer Sekunde wieder ausgeschaltet. Das funktioniert dann zunächst schon mal über die App ganz prima.</p>
<p><img decoding="async" src="https://www.smarthomeng.de/wp-content/uploads/2020/05/Config1-300x124.png" alt="" class="alignnone size-medium wp-image-2523" width="300" height="124" srcset="https://www.smarthomeng.de/wp-content/uploads/2020/05/Config1-300x124.png 300w, https://www.smarthomeng.de/wp-content/uploads/2020/05/Config1-768x316.png 768w, https://www.smarthomeng.de/wp-content/uploads/2020/05/Config1.png 881w" sizes="(max-width: 300px) 100vw, 300px" /> <img decoding="async" src="https://www.smarthomeng.de/wp-content/uploads/2020/05/Config2-300x115.png" alt="" class="alignnone size-medium wp-image-2524" width="300" height="115" srcset="https://www.smarthomeng.de/wp-content/uploads/2020/05/Config2-300x115.png 300w, https://www.smarthomeng.de/wp-content/uploads/2020/05/Config2-768x295.png 768w, https://www.smarthomeng.de/wp-content/uploads/2020/05/Config2.png 874w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>In SmarthomeNG habe ich dann mein Item wie folgt konfiguriert:</p>
<p style="padding-left: 30px">Tor:<br />
name: Tor<br />
enforce_updates: true<br />
type: bool<br />
visu: &#8218;yes&#8216;<br />
sv_widget: &#8222;{{ basic.stateswitch(&#8218;item&#8216;, &#8218;item&#8216;, &#8218;midi&#8216;, 1, &#8220;, &#8220;, &#8220;, &#8218;blink&#8216;) }}&#8220;</p>
<p>Ohne MQTT habe ich dann einfach eine Logik implementiert, die bei jedem Klick getriggert wird:</p>
<p>/etc/logic.yaml</p>
<p style="padding-left: 30px">Garagentor:<br />
filename: Garage.py<br />
watch_item: Aussen.Garage.Tor</p>
<p>/logics/Garage.py</p>
<p style="padding-left: 30px"># Shelly1<br />
# Garagentor</p>
<p style="padding-left: 30px">import urllib.request</p>
<p style="padding-left: 30px">myurl = &#8222;http://192.168.178.28/relay/0?turn=on&#8220;</p>
<p style="padding-left: 30px">req = urllib.request.urlopen(myurl)<br />
logger.info(&#8222;Garagentor&#8220;)</p>
<p>Damit funktioniert das ganze &#8222;zu Fuß&#8220; und ohne MQTT und Shelly Plugin in SmarthomeNG 1.5</p>
<p><strong>Vorbereitungen in SmarthomeNG 1.7</strong></p>
<p>Zunächst mal muss MQTT aufgesetzt werden; dies habe ich natürlich, dank &#8222;Onkelandy&#8220; über das <strong>setup_all</strong> script gemacht.</p>
<p>Wer nicht das Image benutz muss dann anhand der Komplettanleitung den mosquitto Broker installieren und konfigurieren.</p>
<p>Danach muss MQTT als Modul aktiviert werden; mit 1.7 ist MQTT in den Core gewandert und wird wie folgt aktiviert:</p>
<p>/etc/module.yaml</p>
<p style="padding-left: 30px">mqtt:<br />
module_name: mqtt<br />
broker_monitoring: true</p>
<p>Als einzigen Parameter habe ich das Monitoring eingeschaltet, damit man über das Web GUI die Aktivitäten verfolgen kann.</p>
<p>Dann wir das Shelly Plugin aktiviert:</p>
<p>/etc/plugin.yaml</p>
<p style="padding-left: 30px">Shelly:<br />
plugin_name: shelly</p>
<p>Hier gibt es keinerlei Parameter.</p>
<p>Das Shelly Plugin wird über Item-Parameter getriggert, deshalb habe ich Folgendes in meinem Garagentor Item ergänzt:</p>
<p style="padding-left: 30px">Tor:<br />
name: Tor<br />
<strong><span style="color: #3366ff">shelly_id: 8CAAB505559E</span></strong><br />
<strong><span style="color: #3366ff">shelly_type: shelly1</span></strong><br />
<strong><span style="color: #3366ff">shelly_attr: relay</span></strong><br />
<strong><span style="color: #3366ff">shelly_relay: 0</span></strong><br />
enforce_updates: true<br />
type: bool<br />
sv_widget: &#8222;{{ basic.stateswitch(&#8218;item&#8216;, &#8218;item&#8216;, &#8218;midi&#8216;, 1, &#8220;, &#8220;, &#8220;, &#8218;blink&#8216;) }}&#8220;</p>
<p>(Hier hatte ich den Fehler gemacht und shelly_<strong><span style="color: #ff0000">ID</span></strong> definiert, was mich zwei Stunden gekostet hat)</p>
<p>Danach erscheint dann (fast) alles im Web-GUI.</p>
<p>Zunächst die Definitionen im Item:</p>
<p><img fetchpriority="high" decoding="async" src="https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug1-1024x311.png" alt="" class="alignnone wp-image-2530 size-large" width="750" height="228" srcset="https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug1-1024x311.png 1024w, https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug1-300x91.png 300w, https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug1-768x233.png 768w, https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug1.png 1046w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<p>Ob der Broker läuft findet Ihr dann unter dem Tab: Broker Information:</p>
<p><img loading="lazy" decoding="async" src="https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug2-1024x383.png" alt="" class="alignnone size-large wp-image-2531" width="750" height="281" srcset="https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug2-1024x383.png 1024w, https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug2-300x112.png 300w, https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug2-768x287.png 768w, https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug2.png 1032w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<p>wenn nicht, schaut bitte in Eure Konfiguration, ob MQTT enabled ist:</p>
<p><img loading="lazy" decoding="async" src="https://www.smarthomeng.de/wp-content/uploads/2020/05/mqtt1-1024x411.png" alt="" class="alignnone size-large wp-image-2533" width="750" height="301" srcset="https://www.smarthomeng.de/wp-content/uploads/2020/05/mqtt1-1024x411.png 1024w, https://www.smarthomeng.de/wp-content/uploads/2020/05/mqtt1-300x120.png 300w, https://www.smarthomeng.de/wp-content/uploads/2020/05/mqtt1-768x308.png 768w, https://www.smarthomeng.de/wp-content/uploads/2020/05/mqtt1.png 1054w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<p>In der GUI des Shelly Plugin findet Ihr aber zunächst nichts, oder nur den <strong>Namen</strong> des Devices.</p>
<p>Jetzt geht&#8217;s wieder zur Shelly App um die Broker Verbindung zu konfigurieren. In der SmarthomeNG Konfiguration seht Ihr im letzten Screenshot, dass der MQTT Broker auf dem SmarthomeNG Rechner läuft und auf den Port 1883 hört. Das müsst Ihr jetzt noch dem Shelly Device beibringen. (In der Shelly App):</p>
<p><img loading="lazy" decoding="async" src="https://www.smarthomeng.de/wp-content/uploads/2020/05/Config3.png" alt="" class="alignnone size-full wp-image-2529" width="880" height="824" srcset="https://www.smarthomeng.de/wp-content/uploads/2020/05/Config3.png 880w, https://www.smarthomeng.de/wp-content/uploads/2020/05/Config3-300x281.png 300w, https://www.smarthomeng.de/wp-content/uploads/2020/05/Config3-768x719.png 768w" sizes="(max-width: 880px) 100vw, 880px" /></p>
<p>Zunächst müsst Ihr den haken bei &#8222;Enable action execution via MQTT&#8220; und dann noch unter Server: wo und wie er zu erreichen ist. (IP-Adresse des Raspi und Port 1883).</p>
<p>Selbstverständlich kann ich weiterhin mein Garagentor über die HTTP Logik im 1.5er System öffnen und auch über die Shelly App (hier aber nicht mehr über die Cloud, wie Ihr es in der WARNING findet)</p>
<p>Danach ist dann Eure Konfiguration komplett und das Shelly Device auch im Shelly Plugin zu finden:</p>
<p><img loading="lazy" decoding="async" src="https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug3-1024x326.png" alt="" class="alignnone size-large wp-image-2532" width="750" height="239" srcset="https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug3-1024x326.png 1024w, https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug3-300x96.png 300w, https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug3-768x245.png 768w, https://www.smarthomeng.de/wp-content/uploads/2020/05/shellyPlug3.png 1048w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<p>Diese ganzen Zusammenhänge müssen erst mal verstanden werden, ehe man eine solche Konfiguration aufsetzen kann. Deshalb habe ich das hier mal zusammengestellt, weil das so nicht aus der Dokumentation hervor geht.</p>
<p>Viel Spaß mit Euren Shelly Devices. Wie Ihr andere Devices mit mehr Funktionen konfiguriert und wie ich sie über SmartVISU administriere, beschreibe ich (vielleicht) in weiteren Blogs.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.smarthomeng.de/wie-ich-meinen-ersten-shelly-ueber-das-plugin-mit-mqtt-eingebunden-habe/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
