<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[lopy4 connecting to a relay (class c)]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">is lopy4 a class C device ?</p>
<p dir="auto">I am looking to connect a relay and send commands to start AC loads. Can somebody guide me how to do this ?</p>
]]></description><link>https://forum.pycom.io/topic/3791/lopy4-connecting-to-a-relay-class-c</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 10:57:14 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/3791.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Sep 2018 16:30:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to lopy4 connecting to a relay (class c) on Wed, 26 Sep 2018 16:30:43 GMT]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">is lopy4 a class C device ?</p>
<p dir="auto">I am looking to connect a relay and send commands to start AC loads. Can somebody guide me how to do this ?</p>
]]></description><link>https://forum.pycom.io/post/22450</link><guid isPermaLink="true">https://forum.pycom.io/post/22450</guid><dc:creator><![CDATA[abhishek2101]]></dc:creator><pubDate>Wed, 26 Sep 2018 16:30:43 GMT</pubDate></item><item><title><![CDATA[Reply to lopy4 connecting to a relay (class c) on Thu, 27 Sep 2018 11:50:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/579">@abhishek2101</a> any help would be much appreciated.</p>
]]></description><link>https://forum.pycom.io/post/22474</link><guid isPermaLink="true">https://forum.pycom.io/post/22474</guid><dc:creator><![CDATA[abhishek2101]]></dc:creator><pubDate>Thu, 27 Sep 2018 11:50:00 GMT</pubDate></item><item><title><![CDATA[Reply to lopy4 connecting to a relay (class c) on Thu, 27 Sep 2018 12:20:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/579">@abhishek2101</a> There is the parameter device_class in the lora.init() call or the constructor, where you can set the device class. The default is class A, but you can also set device class C.<br />
See <a href="https://docs.pycom.io/firmwareapi/pycom/network/lora" target="_blank" rel="noopener noreferrer nofollow">https://docs.pycom.io/firmwareapi/pycom/network/lora</a></p>
]]></description><link>https://forum.pycom.io/post/22475</link><guid isPermaLink="true">https://forum.pycom.io/post/22475</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Thu, 27 Sep 2018 12:20:33 GMT</pubDate></item><item><title><![CDATA[Reply to lopy4 connecting to a relay (class c) on Thu, 27 Sep 2018 14:37:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/579">@abhishek2101</a> The LoPy4 is supposed to support Class C, though I have never tested this.</p>
<p dir="auto">Note that</p>
<ul>
<li>you need the network (LNS and gateways) to support class C devices, which is quite uncommon I believe</li>
<li>a class C device needs to be always listening, so no deep sleep or anything like that, it most probably can't run on batteries and needs to be powered all the time.</li>
</ul>
]]></description><link>https://forum.pycom.io/post/22480</link><guid isPermaLink="true">https://forum.pycom.io/post/22480</guid><dc:creator><![CDATA[jcaron]]></dc:creator><pubDate>Thu, 27 Sep 2018 14:37:24 GMT</pubDate></item><item><title><![CDATA[Reply to lopy4 connecting to a relay (class c) on Fri, 28 Sep 2018 15:35:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/579">@abhishek2101</a> I've got some Lopy4 acting as a class C, and it works fine (mine are always powered)</p>
<p dir="auto">but you need a server capable of sending downlink of course.</p>
<p dir="auto">I'm sorry I can't share any code but looks like something</p>
<pre><code>LoRa(mode=LoRa.LORAWAN, public=True, tx_retries=3, device_class=LoRa.CLASS_C)

while (not lora.has_joined()):
    time.sleep(0.1)

lsock = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
lsock.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)
lsock.setsockopt(socket.SOL_LORA, socket.SO_CONFIRMED, False)
lsock.setblocking(False)
                
while true:
      data, port = self.lsock.recvfrom(32)
      lg = len (data)
      if lg &gt; 0:
          print(&quot;Downlink Port={:d} Size={:d} Payload={}&quot;.format(port, lg, hexlify(data).upper()) )
      time.sleep(0.1)
</code></pre>
]]></description><link>https://forum.pycom.io/post/22493</link><guid isPermaLink="true">https://forum.pycom.io/post/22493</guid><dc:creator><![CDATA[Charly86]]></dc:creator><pubDate>Fri, 28 Sep 2018 15:35:40 GMT</pubDate></item></channel></rss>