Updated old Gitlab links and examples

This commit is contained in:
Fabio Manganiello 2023-08-20 23:14:08 +02:00
parent bc1a215048
commit d7ce9113bc

View file

@ -91,8 +91,8 @@
create automation routines when a certain event happens, programmatically action them in your
scripts, or control them all from a single consistent web interface.
<a href="https://docs.platypush.tech" target="_blank">Discover the available integrations</a>.
The <a href="https://git.platypush.tech/platypush/platypush/-/blob/master/README.md">README</a>
is also a good place to get started.
The <a href="https://git.platypush.tech/platypush/platypush/src/branch/master/README.md"
target="_blank">README</a> is also a good place to get started.
</div>
</div>
</section>
@ -112,7 +112,7 @@
<p>
Extensions may come with optional sets of additional dependencies, and they can be easily installed
through <tt>pip</tt> - see the <a
href="https://git.platypush.tech/platypush/platypush/-/blob/master/setup.py#L169"
href="https://git.platypush.tech/platypush/platypush/src/branch/master/setup.py#L85"
target="_blank"><tt>setup.py</tt></a> for a full list of supported extras. The <a
href="https://docs.platypush.tech" target="_blank">documentation</a> also provided the required
dependencies for each integration.
@ -120,24 +120,19 @@
</div>
<div class="right">
<div class="code">pip install <span class="string">'platypush[http,mqtt]'</span></div>
<div class="code">pip install <span class="string">'platypush[mqtt]'</span></div>
</div>
</section>
<section>
<div class="left">
<div class="code"><span class="comment"># Enable the Z-Wave monitor</span>
<span class="keyword">backend.zwave</span>:
<span class="keyword">- device</span>: /dev/ttyUSB0
<span class="comment"># Enable the Z-Wave actions plugin</span>
<span class="keyword">zwave</span>:
<span class="keyword">- enabled</span>: <span class="string">True</span>
<div class="code"><span class="comment"># Enable the Zigbee2MQTT integration</span>
<span class="keyword">zigbee.mqtt</span>:
<span class="keyword">- host</span>: 192.168.1.2
<span class="comment"># Enable the Philips Hue plugin</span>
<span class="keyword">light.hue</span>:
<span class="comment"># Enable the Hue lights plugin</span>
<span class="keyword">- enabled</span>: <span class="string">True</span>
<span class="keyword">- bridge</span>: 192.168.1.3
</div>
</div>
@ -149,7 +144,7 @@
Configuring an integration is as simple as defining its attributes in
<tt>~/.config/platypush/config.yaml</tt>. The attributes of each integration are the same as their
documented constructors, and an
<a href="https://git.platypush.tech/platypush/platypush/-/blob/master/examples/conf/config.yaml">example configuration</a>
<a href="https://git.platypush.tech/platypush/platypush/src/branch/master/examples/conf/config.yaml">example configuration</a>
is also provided.
</div>
</section>
@ -173,17 +168,17 @@
<div class="right">
<div class="code"><span class="keyword">from</span> platypush.event.hook <span class="keyword">import</span> hook
<span class="keyword">from</span> platypush.utils <span class="keyword">import</span> run
<span class="keyword">from </span>platypush.message.event.zwave <span class="keyword">ZwaveValueChangedEvent</span>
<span class="keyword">from </span>platypush.message.event.zigbee.mqtt <span class="keyword">import</span> ZigbeeMqttDevicePropertySetEvent
<span class="keyword">@hook</span>(ZwaveValueChangedEvent)
<span class="keyword">def</span> on_zwave_value(event, **context):
<span class="keyword">if</span> event.value['label'] == <span class="string">'Motion Sensor'</span>:
<span class="comment"># Turn on the lights when motion is detected</span>
<span class="keyword">if</span> event.value['data'] is <span class="string">True</span>:
run(<span class="string">'light.hue.on'</span>)
<span class="comment"># Turn off the lights when motion is not detected</span>
<span class="keyword">elif</span> event.value['data'] is <span class="string">False</span>:
run(<span class="string">'light.hue.off'</span>)
<span class="keyword">@hook</span>(ZigbeeMqttDevicePropertySetEvent, device=<span class="string">'My motion sensor'</span>)
<span class="keyword">def</span> on_sensor_value_change(event, **ctx):
has_motion = event.args.get(<span class="string">'properties'</span>, {}).get(<span class="string">'motion'</span>)
<span class="comment"># Turn on the lights when motion is detected</span>
<span class="keyword">if</span> has_motion <span class="keyword">is</span> <span class="string">True</span>:
run(<span class="string">'light.hue.on'</span>)
<span class="comment"># Turn off the lights when motion is not detected</span>
<span class="keyword">elif</span> has_motion <span class="keyword">is</span> <span class="string">False</span>:
run(<span class="string">'light.hue.off'</span>)
</div>
</div>
</section>