CreationDate
stringlengths
23
23
Answer
stringlengths
60
24k
Tags
stringlengths
5
68
Title
stringlengths
15
140
Id
stringlengths
1
4
Body
stringlengths
106
19.3k
2020-11-19T13:10:51.680
<p>There are 3rd party Ethernet adapters (and Google used to do one for <a href="https://store.google.com/product/ethernet_adapter_for_chromecast" rel="nofollow noreferrer">Chromecasts</a> that I think should work) which assuming it's just the Wifi that is broken will allow you to wire the Mini into the local Lan.</p>
|google-home|
Is there any use for a Google Home Mini without WiFi?
5368
<p>The WiFi of my Google Home Mini is dead after 1 year or so of use. Yes, I have tried everything to verify this (factory reset, Wi-Fi with password, without password, different bands, two totally different Wi-Fi networks).</p> <p>I hate to use Google Home Mini only as a book weight now. Are there any other ways to use it? For example, is there a way to use its speaker which is still decent?</p>
2020-11-20T17:29:26.747
<p>For some reason it would appear that Alexa is trying to find the distance between you and either San Fransisco and Los Angeles... Perhaps Alexa is finding some place near you which is called Los Angeles or San Fransisco (like a restaurant or anything)?</p> <p>I would suggest asking &quot;what's the distance between San Fransisco <strong>California</strong> and Los Angeles <strong>California</strong>&quot;?</p> <p>This should give Alexa the &quot;hint&quot; it needs to realise that you're not talking about something local.</p>
|alexa|amazon-echo|
Incorrect answer from Alexa
5371
<p>I asked &quot;Alexa, what's the distance between San Francisco and Los Angeles?&quot;. Alexa replied &quot;11,711.8 kilometers away&quot;, which is absolutely incorrect.</p> <p>Why does this happen? Am I missing something here? What can I do about such incidents?</p>
2020-11-29T22:07:24.317
<ol> <li>The <a href="https://content.arduino.cc/assets/Arduino_SARA-U2_DataSheet_%28UBX-13005287%29.pdf" rel="nofollow noreferrer">spec</a> sheet for the radio module says it is a HSPA and 2G module, HSPA is &quot;3G&quot;. So yes this should continue to work assuming that the local 2G network runs on one of the supported frequency bands.</li> <li>That is a question for your SIM provider, the only way to be sure is to ask them directly.</li> <li>You can have multiple devices on a SPI bus, but they each need their own Chip Select pin to enable each module separately so they don't clash.</li> </ol>
|arduino|
Arduino MKR GSM/NB + CAN + SD Card
5381
<p>I have some questions about a new Arduino project I'm starting:</p> <ol> <li><p>Since Vodafone (Italy in my case) is shutting down 3G in 2021 (keeping 2G/4G up apprently), is ARDUINO MKR GSM 1400 still valid in next years?</p> </li> <li><p>Does Arduino MKR NB 1500 work with classic 4G sim too? On the website they claim it works with LTE's Cat M1/NB1 bands but I have a Thingsmobile all-in-one sim card I'd like to use. It's a virtual Telco popular for M2M.</p> </li> <li><p>Can ARDUINO MKR MEM SHIELD and ARDUINO MKR CAN SHIELD co-exist together even if they both use SPI?</p> </li> </ol> <p>Thanks!</p>
2020-12-01T03:30:02.493
<p>From all the available information in the question, the 2 simplest options.</p> <ol> <li>There are no messages being published on the topic subscribed to.</li> <li>There is an ACL in place on the broker and the user is not authorised to see messages on the topic subscribed to.</li> </ol> <p>Add <code>-d</code> to the command line to see if the connection and the subscription actually complete successfully.</p>
|mqtt|mosquitto|
mosquitto_sub command gives no respond when correct password?
5384
<p>I am trying to subscribe to a mosquitto server that I installed and configured with this command</p> <pre><code>mosquitto_sub -h myserver.myserver.myserver -p 9500 -t &quot;test&quot; -u &quot;myuser&quot; -P &quot;my-correct-password&quot; --capath /etc/ssl/certs/ </code></pre> <p>Where I substituted my actual values for <code>myserver.myserver.myserver</code>, <code>myuser</code> and <code>my-correct-password</code>. When I run this command, my terminal doesn't give any response. It doesn't even disconnect after waiting for a long time.</p> <p>However, if I replace <code>my-correct-password</code> with a password I know is incorrect, I get the response <code>Connection Refused: not authorised.</code> How come I can't subscribe to the mosquitto server with a correct password? And how come I only get a response from the server if I supply an erroneous password?</p> <p>I can't remember this being a problem in the past...I'm pretty sure I ran this command successfully in the past.</p>
2020-12-01T13:03:31.580
<p>This seems to work:</p> <pre><code>netstat -ntp | grep ESTABLISHED.*mosquitto </code></pre> <p>Which in my case outputs:</p> <pre><code>tcp 0 0 10.42.0.2:1883 10.42.0.18:56553 ESTABLISHED 448/mosquitto tcp 0 0 10.42.0.2:1883 10.42.0.19:54037 ESTABLISHED 448/mosquitto tcp 0 0 10.42.0.2:1883 10.42.0.11:49321 ESTABLISHED 448/mosquitto tcp 0 0 10.42.0.2:1883 10.42.0.15:48685 ESTABLISHED 448/mosquitto tcp 0 0 10.42.0.2:1883 10.42.0.12:57691 ESTABLISHED 448/mosquitto tcp 0 0 10.42.0.2:1883 10.42.0.13:56037 ESTABLISHED 448/mosquitto tcp 0 0 10.42.0.2:1883 10.42.0.17:40679 ESTABLISHED 448/mosquitto tcp 0 0 10.42.0.2:1883 10.42.0.16:39627 ESTABLISHED 448/mosquitto tcp 0 0 10.42.0.2:1883 10.42.0.14:33079 ESTABLISHED 448/mosquitto </code></pre> <p>If one only cares about the total count:</p> <pre><code>netstat -natp | grep ESTABLISHED.*mosquitto | wc -l </code></pre> <p>prints</p> <pre><code>9 </code></pre> <p><code>netstat</code> arguments: <code>-n</code> to avoid getting host names for ip addresses (faster), <code>-t</code> for TCP instead of UDP and <code>-p</code> to display program names so we can filter using grep.</p>
|mosquitto|
Count or list active client connections to mosquitto server
5387
<p>I just want to know how many clients are actively connected to my mosquitto server. Or even better, get a list of client ids connected to my mosquitto server. I read some documentation suggesting the topic <code>$SYS/broker/clients/connected</code> will give this information. But this command yielded no response and no results:</p> <pre class="lang-bash prettyprint-override"><code>mosquitto_sub -h myserver.myserver.myserver -p 9500 -t $SYS/broker/clients/connected -u &quot;my-user&quot; -P &quot;my-password&quot; --capath /etc/ssl/certs/ </code></pre> <p>(I replaced <code>myserver.myserver.myserver</code> and <code>my-user</code> and <code>my-password</code> with actual values.) I verified the connection is working because if I publish a message to the same topic, the message appears.</p> <p>How can I get a list of clients with active connection to my mosquitto server? Or at least a numeric count of active connections?</p>
2020-12-06T06:35:33.357
<p>There is two ways are there in GPS working, GPS will receive the information from safelight and locate you, one is AGPS , that will locate you very accurately and give you the data, this method for sure it needs Internet protocol to fetch the AGPS location itself, another method can locate you with satellite radio method , this method you can check in mobile when your data is off , satellite can locate you but initial fetching will take more time., so that now the ideology is it depends on the application, as you mentioned if you want to send the data continuously to the controller you need a protocol device like wifi or GSM on other hand locally you can use Bluetooth, on other hand your desire is only designing and tracing the geological location of the particular object in the sense you can do it without Internet and to make it effective you have to design it well</p>
|gps|cloud-computing|tracking-devices|
Can GPS device report to other device without internet?
5395
<p>I have device A which that device made by only GPS+CONTROLLER.</p> <p>Can that GPS report their location to device B which made by Controller or it will better report to internet without using GSM module or WiFi module? Is it possible?</p> <p>If possible what device B contains and made? Or what device A should modify?</p>
2020-12-18T01:14:47.253
<p>The only two network types you can count on on a phone are WiFi and BLE (or cellular, but you told us there’s no Internet). LoRa is indeed never available.</p> <p>WiFi requires the user to connect to the network (network name and usually password, though this can be provided as a QR Code), and phones don’t always like WiFi networks without Internet access (they may complain or refuse to connect). But it’s usable on any phone, even without an app.</p> <p>BLE usually requires an app to be installed on the phone, but can then work without the user having to enter any credentials.</p> <p>In both cases, range is limited, though very variable depending on the environment and the devices on both sides.</p> <p>One solution could be to set up a regular WiFi network with APs and a router (to act as a DHCP server), and have both phones and ESP32s connect to it. You may also need a DNS server, depending on what exactly you do. Depending on the size of the area to be covered and the number of devices, you may need several APs and either cables between them (possibly an Ethernet switch as well), or wireless links (e.g. “WiFi mesh” solutions).</p> <p>Another solution would be for the current phones to use BLE to talk to one of the ESP32s in range and then use some form of mesh between the ESP32s.</p> <p>Remember that the ESP32s can also act as APs, though I probably wouldn’t count on them to connect lots of phones.</p> <p>Really, we don’t have enough details to know which of those solutions could work for you, but I hope they give you starting points.</p>
|mqtt|esp32|mesh-networks|mobile-applications|
Best way to set up a portable local IoT network?
5419
<p>I'm working on a project that requires multiple ESP32s to be able to receive a signal <strong>from a smartphone</strong> in order to close/open a set of doors. The catch is that this will be happening in a remote area with no internet whatsoever, and on a wide scale (hundreds of ESP devices). The setup also needs to be portable, as it will be moving around a lot. What is the best way of going about this sort of local network? So far I have considered:</p> <ul> <li><p>LoRa (just not sure in general how this would work with a phone + esps locally. And phones can't send LoRa signals, can they?). Another problem with LoRa is that the antennae that need to be hooked up to my ESP32's for LoRa to work are too bulky for my situation.</p> </li> <li><p>MQTT (relatively low range, requires routers peppered throughout. Small number of devices/clients that could be connected if the broker is a device like an ESP or a raspberry pi)</p> </li> <li><p>Mesh network (devices can be connected with painlessMesh; seemingly ideal solution. Just having difficulties figuring out how to connect this to a smartphone (both to receive and send messages))</p> </li> </ul> <p>Does anyone have any suggestions?</p>
2020-12-31T11:07:01.820
<p>Provision an IoT thing. For your purpose, you can just do a one off. In your case, use the client id for your dad's device in the SQL where clause of the IoT rule. <a href="https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-functions.html#iot-sql-function-clientid" rel="nofollow noreferrer">https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-functions.html#iot-sql-function-clientid</a></p> <p>Another idea is to change the topic that is published. Perhaps temperature/dadsRoom and use that in the IoT rule. This would probably be the easiest to merge later if you want a report of all rooms.</p>
|mqtt|raspberry-pi|aws-iot|
Monitoring temperature using AWS IoT
5430
<p>I've developed an Android app for my dad for monitoring temperature from a specific room. He wants to be able to see the temperature even when he is not home.</p> <p>I got working with Amazon IoT and it's pretty great:</p> <ol> <li>You publish the temperature to the Amazon IoT server</li> <li>You forward the result to your app</li> </ol> <p>But I also want a device like this using the same app, so how can I make my android app identify with a specific device? I don't want a login mechanism, I just want to give my dad a digital key and based on that my app will identify which devices are his and subscribe only to that.</p> <p>What am I thinking is this: generate a key that will be stored on the raspberry and when you send a message to the server append that ID. Similar when using the app it will ask for the key which you should get from a admin.</p> <p>Is this a good way? or do you now an easier alternative through Amazon IoT?</p>
2021-01-11T04:07:05.357
<p>The general steps are:</p> <ul> <li>Figure out how to have your modem connect to the internet. See the manual for the modem. (This may involve some carrier specific settings too.)</li> <li>Now, you have the ability to do tcp/ip to the internet. Make sure you can connect to something via TCP/IP.</li> <li>Now, you're ready to connect to an MQTT broker. Find out its security needs.</li> <li>Use an MQTT library for connecting. Configure its security and use the connect method.</li> <li>If you are wanting to implement said library, see the spec on MQTT <a href="https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html" rel="nofollow noreferrer">https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html</a> and view the source code on a few existing libraries. Their test code should give you an idea of the sequences.</li> </ul> <p>If you get stuck at a specific step, you maybe able to ask a more specific question that someone can give you a specific answer to. One other option is to use AWS IoT device sdk as a starting point. See <a href="https://docs.aws.amazon.com/iot/latest/developerguide/iot-sdks.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/iot/latest/developerguide/iot-sdks.html</a></p>
|mqtt|wireless|
What is a pseudocode breakdown of the MQTT protocol for cellular devices?
5446
<p>I was wondering if anyone can give me some pseudocode structure that outlines the general procedures that need to happen to connect over cellular to a remote server using MQTT? To be specific, I already know all about MQTT basics. I need to write a library for this and I would just really appreciate some technical guidance on how to structure the code. If it helps at all, I'm using a Lara R2-02 Ublox cellular module from mikroe for my modem. If you have any technical resources you could share with me too, I would be grateful.</p>
2021-01-11T13:49:11.630
<p>Haven't tried it myself, but a few things to consider:</p> <ul> <li><p>If you had the two devices with line of sight to each other in a very very large open space, then there should be a direct relationship between RSSI and distance. However that is nearly never the case. With obstacles, reflections, multipath, and more, there's <strong>significant variation in the observed RSSI</strong>.</p> </li> <li><p>Take your favorite phone, and download a BLE scanner on it, which shows RSSI (e.g. nRF connect, but there are tons of others). It'll probably discover a good handful (or a wheelbarrow, depends) of devices around here. Observe the RSSI variations of any device while not moving at all. You'll notice that spreads which are easily over 10 dBm, sometimes a lot more. Remember that 3 dBm means a factor of 2 and 10 dBm a factor of 10. Note however that you can't compare the readings of two different devices: different TX power, different antenna...</p> </li> <li><p>Now start moving your phone. Turn around so that you are between the device and the phone. You can keep your phone in the same place and observe a drop in signal strength.</p> </li> </ul> <p>So no, you can't get any sort of accurate distance just from the RSSI, though you can get a vague idea.</p> <p>Another reference point: Apple's Core Location framework, when it reports a beacon, only reports the following proximity values (iBeacons advertise a calibrated RSSI at 1 m to assist):</p> <blockquote> <ul> <li>The proximity of the beacon could not be determined.</li> <li>The beacon is in the user’s immediate vicinity.</li> <li>The beacon is relatively close to the user.</li> <li>The beacon is far away.</li> </ul> </blockquote> <p>They state:</p> <blockquote> <p>Ranging reports when the two devices are far apart, near to each other, or in the immediate vicinity of each other; it does not offer a precise distance, nor should you rely on the strength of a beacon's signal to compute that information yourself.</p> </blockquote> <p>So after experimenting with a pair of your own devices, you could determine a threshold over which you are sure that the devices are within a given distance. Depending on your goal, you could be very lax or very restrictive, it's up to you. But don't expect something more accurate than &quot;very close&quot;, &quot;quite far&quot; and &quot;somewhere in between&quot;.</p> <p>(Things are different if you have multiple beacons in range and a fingerprint of the area, but that's a completely different topic).</p> <p>As for max range, that depends a lot on TX power, antennas, sensitivity, cases, relative position, and most importantly obstacles. I've seen BLE devices unable to talk to one another beyond a few short meters, and I've detected BLE devices 20 meters away across many obstacles, possibly more. Only experiments with your chosen devices in the target environment/context will get you a better sense of what is possible.</p> <p>Without obstacles with high TX power devices you can supposedly reach hundreds of meters with line of sight, but of course this is a scenario that never happens.</p> <p>One important thing to note is that for detection to happen, you need to advertise and scan. Battery-operated ESP32-based devices are pretty bad at that, as unless I missed something, you can't do that in combination with deep sleep. So you get a pretty high power consumption, and you probably won't last more than a few hours on any battery that would fit in a wrist-mounted case.</p> <p>Nordic Semi chips of the nRF5 series are better at that, though there are quite a few other options. Wrist-mounted options based on the nrf52832 include <a href="https://www.espruino.com/Bangle.js" rel="nofollow noreferrer">Espruino's Bangle.js</a>, though it features quite a few things you might not need (GPS, heart rate monitor, accelerometer, magnetometer...).</p>
|esp32|wearables|proximity|
ESP32 proximity detection - how near, far and how accurate can it be?
5448
<p>I did some brief search on the matter, but it doesn't really help. I want to detect when people approach each other too closely, and - possibly, in the future - leave too great a distance between one another.</p> <ul> <li><p><a href="https://www.instructables.com/ESP32-BLE-Presence-Detector/" rel="nofollow noreferrer">the Ultimate BLE Presence Detector</a></p> </li> <li><p><a href="https://www.reddit.com/r/esp32/comments/9h4u81/bluetooth_proximity_detection/" rel="nofollow noreferrer">Bluetooth Proximity Detection</a></p> </li> <li><p><a href="https://www.instructables.com/Approach-Sensor-With-ESP32/" rel="nofollow noreferrer">Approach Sensor With ESP32</a></p> </li> <li><p><a href="https://circuitdigest.com/microcontroller-projects/ble-based-proximity-control-using-esp32" rel="nofollow noreferrer">BLE based Proximity Control using ESP32 – Detect Presence of BLE Devices</a></p> </li> </ul> <p>All are very interesting articles, and I suppose that I could always build them all &amp; take my own measurements, but would rather save the time, if it is not going to be very accurate, so I am hoping that someone here can speak from experience.</p> <p>Ideally, I would prefer BLE 5.1, for AOA / AOD, to get extreme accuracy - and direction - but ESP32 doesn't have that, nor is it likely to any time soon (unless I can add it on, somehow? <a href="https://hardwarerecs.stackexchange.com/questions/13654/ble-5-1-wearable-dev-board">related question</a>)</p> <p>How accurate would it be if I want to know when two devices approach within 1 metre, 2m, 5m, 10m? And what about far away, towards the edge of reception?</p> <p>I want to achieve this with something wearable, so like the look of the <a href="http://www.lilygo.cn/claprod_view.aspx?TypeId=21&amp;Id=1282&amp;FId=t28:21:28" rel="nofollow noreferrer">LILYGO® TTGO T-Wristband DIY Programmable Smart Bracelet</a></p> <p><a href="https://i.stack.imgur.com/P6piX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P6piX.png" alt="enter image description here" /></a></p> <p>but the actual hardware is for another question, maybe another site.</p> <p>Does anyone have any experience in this? Can you provide an approximation of granularity of measurement at various distances?</p>
2021-01-16T17:48:26.163
<p>I have finally resolved the issue. I have used <code>ngork</code> to create virtual tunnel. I tried to use <code>ngork</code> earlier but was unable as I was running the service on <em>port 80</em>. When I ran the <code>nrogk</code> http service on <em>port 443</em>, I was able to access the NextCloud server using the domain name shown on the ssh terminal. NextCloud uses <em>port 80 for http</em> and <em>443 for https</em>. I am really not sure why I was not able to access the NextCloud on <em>port 80</em>. This may help if someone is stuck in the similar problem. The problem with <code>ngork</code> is, once the raspberry pi is restarted you will have to restart the <code>ngork</code> service as well and of course the domain address will also be changed. Though my use case don't have any problem with it.</p>
|raspberry-pi|routers|
Access Raspberry Pi behind a NAT firewall through Internet
5464
<p>I have been developing projects with Raspberry Pi 4. For the current project I am running a NextCloudPi server on it. I am able to access the server using my Internal IP. I want to access it using a public domain name or in other words through open Internet. My ISP does not allow port forwarding and static IP.</p> <p>I tried Zerotier, which creates a VPN and I can access the CloudServer through the static IP assigned under VPN but the transfer speeds are really slow. Another issue is that I need to install it on all the devices through which I am going to access the CloudServer and ofcourse on the RPi4 itself.</p> <p>Is there any other option that you guys have to access RPi4 (basically IoT devices) through Internet? Any suggestion would be greatly appreciated.</p>
2021-01-21T11:55:20.833
<p>Please share a link to the paper you are alluding to when you mention the authors. Perhaps someone can then think of something specific. Otherwise, the general answer is &quot;creating something new maybe better for a thesis than to say 'there exists something already' &quot; !!</p>
|over-the-air-updates|
Diff-patch algorithms
5474
<p>I am studying about incremental programming of <strong>restricted (low power)</strong> IoT devices and discovered that many diff algorithms have been introduced by the literature (DASA, R3DIFF, DG, etc).</p> <p>Trying them out, I found out that xdelta generally produces smaller patches. Hence the evident question is the following: Is xdelta suitable for such an environment and If yes, why do you believe the authors did not simply use xdelta algorithm for their applicationws (and instead developed other diff algorithms)?</p>
2021-01-25T11:11:08.327
<p>There are quite a few technologies that can be used, though I'm not sure about the impact of some of your conditions (e.g. weather) on their operation. Here are a few:</p> <ul> <li><p>Laser time-of-flight. Sends a laser pulse, checks how long it takes to come back, and tell you the distance between the sensor and the object. Very narrow beam.</p> </li> <li><p>Ultrasonic time-of-flight. Similar, but uses (inaudible) sound. Has a slightly wider beam.</p> </li> <li><p>Doppler radar. Similar, but in addition to distance, it also measures the difference between the frequency of the pulse sent and that of the echo received, which tells you the relative speed (in the direction of the signal).</p> </li> <li><p>Video camera with shape recognition. Probably doesn't qualify for cheap.</p> </li> </ul> <p>You can of course derive speed from the variations in distance for the first two, but it probably won't be as precise and quick.</p> <p>You can find many of such sensors on Adafruit, Sparkfun, etc, and they are relatively cheap. But I have no idea what the impact of rain or fog may be on them. Note that they are all &quot;active&quot; sensors, which need power to transmit a signal before then receiving a response back, so battery operation may raise its own challenges.</p>
|sensors|proximity|
What types of proximity sensors would fit this bicycle application?
5482
<p>I'm looking into proximity sensors for bicycle attachments. The idea is to detect when a car passes close by to a rider. What are some types of proximity sensors that would be:</p> <ol> <li>Cheap</li> <li>Range up to 2 meters</li> <li>Resistant to weather or can be put inside a protective enclosure and still work</li> <li>Works with relative motion between sensor and target</li> <li>Works with rain or high humidity (morning fog) between sensor and target</li> </ol> <p>I also welcome you to propose other considerations I haven't listed above.</p>
2021-01-26T18:17:36.817
<p>There may be paths with a MTU of 1280 in the way. Try 1100 or 1200 and see if that fixes it. If not, try to find an MTU finder app to try to find the MTU to your destination from your source.</p>
|mqtt|aws-iot|linux|paho|python|
Python Paho MQTT 2.5 KB messages not sending for days, while 0.1 KB messages send fine
5488
<p>I've got powerful dual-core IoT gateways in the field with high-speed cellular modems and good internet connections, but they fail to send 2.5 KB MQTT messages to my AWS IoT message broker. My program sends messages of various sizes, and the 0.1 KB or 0.2 KB messages succeed &gt;99% of the time. The 1.5 KB messages are about 50/50, and the 2.5 KB messages succeed less than 10% of the time... if I'm not watching them (It gets weirder).</p> <p>My gateways will go several days without being able to send in the 2.5 KB message (all the while successfully sending the smaller 0.1 KB and 1.5 KB messages), but as soon as I VPN into the gateway with OpenVPN to investigate, it instantly sends in the 2.5 KB message. It's like asking my kids to do something while I'm gone; as soon as I return, it gets done instantly… So weird and frustrating!!</p> <p>Thus, I'm guessing it's got something to do with my gateways' internet connections. I could stream Netflix movies on them, but they can't send 2.5 KB MQTT messages... When I install software on them, they can download megabytes of data in seconds. I'm also guessing it's not AWS IoT, because when I reproduce the problem from my development computer, the 2.5 KB message <em>always</em> publishes successfully to the AWS IoT message broker.</p> <p>USD $580 gateway specs:</p> <ul> <li>Axiomtek ICO120 dual core x86</li> <li>Ubuntu Linux 18.04 LTS</li> <li>SIMCom SIM7600AH modems</li> </ul> <p>Python code for connecting to AWS IoT message broker with Paho MQTT library:</p> <pre class="lang-python prettyprint-override"><code> class PahoContainer: def __init__( self, c, mqtt_broker, cert_dir=&quot;/home/user/certs&quot;, set_on_message=True, set_on_publish=True, aws_thing=None, set_will=True, ): &quot;&quot;&quot;Connects a client to MQTT broker&quot;&quot;&quot; self.c = c self.mqtt_broker = mqtt_broker self.cert_dir = cert_dir self.set_on_message = set_on_message self.set_on_publish = set_on_publish self.aws_thing = aws_thing self.connect(set_will=set_will) def on_connect(self, client, userdata, flags, rc): &quot;&quot;&quot;The callback for when the client receives a CONNACK response from the server.&quot;&quot;&quot; self.c.logger.info(f&quot;Paho connected with result code: {rc}&quot;) # If the result code == 0 == True, set the connected_flag = True if rc == 0: self.c.logger.info(f&quot;Setting Paho client.connected_flag = True&quot;) client.connected_flag = True def on_disconnect(self, client, userdata, rc): &quot;&quot;&quot; The callback for a disconnection. You will need to reconnect as soon as possible. Since we run a network loop using loop_start() or loop_forever(), the re-connections are automatically handled. A new connection attempt is made automatically in the background every 3 to 6 seconds. &quot;&quot;&quot; self.c.logger.info(f&quot;on_disconnect callback. Disconnection reason rc: '{rc}'&quot;) client.connected_flag = False client.disconnect_flag = True def on_message(self, client, userdata, msg): &quot;&quot;&quot;The callback for when a PUBLISH message is received from the server&quot;&quot;&quot; self.c.logger.info(f&quot;Paho msg.topic: {msg.topic}; str(msg.payload): {str(msg.payload)}&quot;) def on_publish(self, client, userdata, mid): &quot;&quot;&quot;The callback for when a PUBLISH message is sent to the server&quot;&quot;&quot; self.c.logger.info(f&quot;Paho on_publish callback for Message ID (mid): {mid}&quot;) def on_log(self, client, userdata, level, buf): &quot;&quot;&quot;Callback to record log messages&quot;&quot;&quot; self.c.logger.info(f&quot;on_log callback. Level: '{level}'; msg buf: '{buf}'&quot;) def try_connecting(self, broker, port, keepalive, try_x_times=20): &quot;&quot;&quot;Try connecting up to 20 times before raising an error&quot;&quot;&quot; counter = 0 while True: counter += 1 try: self.client.connect(broker, port=port, keepalive=keepalive) except Exception: x_more_times = try_x_times - counter if x_more_times == 0: raise self.c.logger.exception(f&quot;Problem connecting. Will try again {x_more_times}...&quot;) time.sleep(0.1) else: break def connect(self, set_will=True): &quot;&quot;&quot;Connect to the message broker server&quot;&quot;&quot; client_id = mqtt.base62(uuid.uuid4().int, padding=22) self.client = mqtt.Client(client_id=client_id, clean_session=True) # Set a will to be sent by the broker in case the client disconnects unexpectedly. # This must be called before connect() to have any effect. # topic: The topic that the will message should be published on. # payload: The message to send as a will. If not given, or set to None a # zero length message will be used as the will. if set_will: if self.aws_thing is None: self.c.logger.warning(&quot;set_will is True but there is no self.aws_thing, so it can't happen&quot;) else: topic_lwt = f'last_will/{self.aws_thing.upper()}' payload_lwt = json.dumps({&quot;connected&quot;: 0}) self.client.will_set(topic_lwt, payload=payload_lwt, qos=1, retain=False) # We MUST use this on_connect callback to set the client.connected_flag = True. # Otherwise we'll be in an infinite loop self.client.on_connect = self.on_connect self.client.on_disconnect = self.on_disconnect # Enable logging using the standard python logging package. # This may be used at the same time as the on_log callback method # If logger is specified (default logger=None), then that logging.Logger object will be used; # otherwise one will be created automatically self.client.enable_logger(logger=self.c.logger) # self.client.enable_logger(logger=None) # Set the log level, if logger=None in enable_logger() self.client._logger.setLevel(logging.DEBUG) self.client.on_log = self.on_log # The client will automatically retry connection. # Between each attempt it will wait a number of seconds between min_delay and max_delay # When the connection is lost, initially the reconnection attempt is delayed of min_delay seconds. # It's doubled between subsequent attempt up to max_delay. # The delay is reset to min_delay when the connection complete (e.g. the CONNACK is received, # not just the TCP connection is established). self.client.reconnect_delay_set(min_delay=1, max_delay=5) # Set the maximum number of messages with QoS&gt;0 that can be part way through their network flow at once. # Defaults to 20. Increasing this value will consume more memory but can increase throughput self.client.max_inflight_messages_set(10) # Set the maximum number of outgoing messages with QoS&gt;0 that can be pending in the outgoing message queue. # Defaults to 0. 0 means unlimited. When the queue is full, any further outgoing messages would be dropped. self.client.max_queued_messages_set(0) # Set the time in seconds before a message with QoS&gt;0 is retried, if the broker does not respond. # This is set to 5 seconds by default and should not normally need changing. self.client.message_retry_set(2) if self.set_on_message: self.client.on_message = self.on_message if self.set_on_publish: self.client.on_publish = self.on_publish # Initialize client.connected_flag = False self.client.connected_flag = False self.c.logger.info(f&quot;Connecting to broker: {self.mqtt_broker}&quot;) self.root_ca, self.device_cert, self.private_key = get_certs(self.c, self.cert_dir) self.client.tls_set( ca_certs=self.root_ca, certfile=self.device_cert, keyfile=self.private_key, cert_reqs=ssl.CERT_REQUIRED, tls_version=ssl.PROTOCOL_TLSv1_2, ciphers=None, ) self.try_connecting( self.mqtt_broker, port=8883, keepalive=60, try_x_times=20 ) # We must start the loop before the while not client.connected_flag loop self.client.loop_start() # If we are not connected yet, wait a bit, then try again before returning the client while not self.client.connected_flag: seconds_to_sleep = 0.05 self.c.logger.info( f&quot;Waiting {seconds_to_sleep} seconds, then checking client.connected_flag again&quot; ) time.sleep(seconds_to_sleep) </code></pre> <p>Simple code for sending a message to AWS IoT:</p> <pre class="lang-python prettyprint-override"><code># The metrics_dict is a Python dictionary with 2.5 KB of key/value pairs payload = json.dumps({&quot;metrics&quot;: metrics_dict}) info = paho_container.client.publish( topic, payload, qos=1, ) </code></pre> <p>Linux Network Manager (nmcli) command to create GSM cellular internet connection:</p> <pre class="lang-bash prettyprint-override"><code>sudo nmcli radio wwan on sudo nmcli c add type gsm ifname '*' con-name 'my_conn' apn 'pda.bell.ca' connection.autoconnect yes ipv4.dns '8.8.8.8 8.8.4.4' sudo nmcli c up </code></pre> <h2>EDIT Jan 26, 2021:</h2> <p>output from <code>ifconfig tun0</code> command for OpenVPN connection (I've changed the IP addresses):</p> <pre><code>tun0: flags=4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt; mtu 1500 inet 172.27.abc.def netmask 255.255.248.0 destination 172.27.abc.def inet6 fe80::4597:4b9f:abcd:efgh prefixlen 64 scopeid 0x20&lt;link&gt; unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC) RX packets 9235 bytes 2655505 (2.6 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9768 bytes 3329110 (3.3 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 </code></pre> <p>output from <code>ifconfig wwp0s21f0u4i5</code> command for GSM cellular connection, which shows the MTU is 1500 bytes (I've changed the IP addresses):</p> <pre><code>wwp0s21f0u4i5: flags=4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt; mtu 1500 inet 174.90.ghi.jkl netmask 255.255.255.248 destination 174.90.ghi.jkl unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC) RX packets 11784052 bytes 2475908779 (2.4 GB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 12009517 bytes 2104615202 (2.1 GB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 </code></pre> <p>Output from <code>nmcli c s user_apn</code> (I've changed the IP addresses):</p> <pre><code>$ nmcli c s user_apn connection.id: user_apn connection.uuid: 05ebc6d3-4fbb-4ddb-93fd-25fb57314ca2 connection.stable-id: -- connection.type: gsm connection.interface-name: cdc-wdm0 connection.autoconnect: yes connection.autoconnect-priority: 0 connection.autoconnect-retries: -1 (default) connection.auth-retries: -1 connection.timestamp: 1611695541 connection.read-only: no connection.permissions: -- connection.zone: -- connection.master: -- connection.slave-type: -- connection.autoconnect-slaves: -1 (default) connection.secondaries: -- connection.gateway-ping-timeout: 0 connection.metered: unknown connection.lldp: default connection.mdns: -1 (default) ipv4.method: auto ipv4.dns: 8.8.8.8,8.8.4.4 ipv4.dns-search: -- ipv4.dns-options: &quot;&quot; ipv4.dns-priority: 0 ipv4.addresses: -- ipv4.gateway: -- ipv4.routes: -- ipv4.route-metric: -1 ipv4.route-table: 0 (unspec) ipv4.ignore-auto-routes: no ipv4.ignore-auto-dns: no ipv4.dhcp-client-id: -- ipv4.dhcp-timeout: 0 (default) ipv4.dhcp-send-hostname: yes ipv4.dhcp-hostname: -- ipv4.dhcp-fqdn: -- ipv4.never-default: no ipv4.may-fail: yes ipv4.dad-timeout: -1 (default) ipv6.method: auto ipv6.dns: -- ipv6.dns-search: -- ipv6.dns-options: &quot;&quot; ipv6.dns-priority: 0 ipv6.addresses: -- ipv6.gateway: -- ipv6.routes: -- ipv6.route-metric: -1 ipv6.route-table: 0 (unspec) ipv6.ignore-auto-routes: no ipv6.ignore-auto-dns: no ipv6.never-default: no ipv6.may-fail: yes ipv6.ip6-privacy: -1 (unknown) ipv6.addr-gen-mode: stable-privacy ipv6.dhcp-send-hostname: yes ipv6.dhcp-hostname: -- ipv6.token: -- gsm.number: *99# gsm.username: -- gsm.password: &lt;hidden&gt; gsm.password-flags: 0 (none) gsm.apn: wrmstatic.bell.ca.ioe gsm.network-id: -- gsm.pin: &lt;hidden&gt; gsm.pin-flags: 0 (none) gsm.home-only: no gsm.device-id: -- gsm.sim-id: -- gsm.sim-operator-id: -- gsm.mtu: auto proxy.method: none proxy.browser-only: no proxy.pac-url: -- proxy.pac-script: -- GENERAL.NAME: user_apn GENERAL.UUID: 05ebc6d3-4fbb-4ddb-93fd-25fb57314ca2 GENERAL.DEVICES: cdc-wdm0 GENERAL.STATE: activated GENERAL.DEFAULT: yes GENERAL.DEFAULT6: no GENERAL.SPEC-OBJECT: -- GENERAL.VPN: no GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1 GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/1 GENERAL.ZONE: -- GENERAL.MASTER-PATH: -- IP4.ADDRESS[1]: 174.90.123.456/29 IP4.GATEWAY: 174.90.123.457 IP4.ROUTE[1]: dst = 174.90.123.452/29, nh = 0.0.0.0, mt = 700 IP4.ROUTE[2]: dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000 IP4.ROUTE[3]: dst = 54.218.161.180/32, nh = 174.90.186.221, mt = 0 IP4.ROUTE[4]: dst = 0.0.0.0/0, nh = 174.90.186.221, mt = 700 IP4.DNS[1]: 70.28.245.227 IP4.DNS[2]: 184.151.118.254 IP4.DNS[3]: 8.8.8.8 IP4.DNS[4]: 8.8.4.4 IP6.GATEWAY: -- </code></pre> <h2>EDIT Jan 27, 2021 at 9:00 a.m. MST: Output from <code>traceroute --mtu &lt;broker&gt;</code></h2> <p>Trying to figure out if this is a packet fragmentation issue related to the MTU of 1500 and the fact that MQTT messages start to fail around the 1.5 KB size, and almost always fail at the 2.5 KB size.</p> <pre class="lang-bash prettyprint-override"><code>$ traceroute --mtu abcdefg-ats.iot.us-west-2.amazonaws.com traceroute to abcdefg-ats.iot.us-west-2.amazonaws.com (52.43.abc.def), 30 hops max, 65000 byte packets 1 172.27.abc.def (172.27.abc.def) 78.980 ms F=1500 75.051 ms 77.459 ms 2 ec2-50-112-abc-def.us-west-2.compute.amazonaws.com (50.112.abc.def) 101.733 ms ec2-34-221-abc-def.us-west-2.compute.amazonaws.com (34.221.abc.def) 78.166 ms ec2-50-112-abc-def.us-west-2.compute.amazonaws.com (50.112.abc.def) 93.053 ms 3 * * * 4 * * * 5 * * * 6 * * * 7 * * * 8 * * * 9 * * * 10 * * * 11 * * * 12 * * * 13 * * * 14 * * * 15 * * * 16 * * * 17 * * * 18 * * * 19 * * * 20 * * * 21 * * * 22 * * * 23 * * * 24 * * * 25 * * * 26 * * * 27 * * * 28 * * * 29 * * * 30 * * * </code></pre> <h2>EDIT Jan 27, 2021 at 9:50 a.m. MST showing output of <code>ping</code> commands:</h2> <p>When I ping the AWS IoT message broker with 1300 bytes, it gets through every time:</p> <pre class="lang-bash prettyprint-override"><code>$ ping -c 3 -s 1300 52.43.abc.def PING 52.43.abc.def (52.43.abc.def) 1300(1328) bytes of data. 1308 bytes from 52.43.abc.def: icmp_seq=1 ttl=253 time=87.7 ms 1308 bytes from 52.43.abc.def: icmp_seq=2 ttl=253 time=99.7 ms 1308 bytes from 52.43.abc.def: icmp_seq=3 ttl=253 time=106 ms </code></pre> <p>However, when I ping the broker with 1400 bytes (1.4 KB), it times out! <strong>Why?</strong></p> <pre class="lang-bash prettyprint-override"><code>$ ping -c 3 -s 1400 52.43.abc.def PING 52.43.abc.def (52.43.abc.def) 1400(1428) bytes of data. --- 52.43.163.79 ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 2051ms </code></pre> <h2>EDIT Jan 27 at 13:00 MST showing <code>ip route show</code> output:</h2> <p>@hardillb asked if the &quot;default route&quot; changed due to OpenVPN (<code>tun0</code> interface) starting. I wasn't sure what that meant at first, but now I think OpenVPN <em>does</em> change the default route. See the following <code>ip route show</code> output that references <code>tun0</code> (the OpenVPN network interface):</p> <pre class="lang-sh prettyprint-override"><code>$ ip route show 0.0.0.0/1 via 172.27.abc.def dev tun0 default via 10.74.abc.def dev wwp0s21f0u4i5 proto static metric 700 10.74.abc.def/30 dev wwp0s21f0u4i5 proto kernel scope link src 10.74.abc.def metric 700 54.218.abc.def via 10.74.abc.def dev wwp0s21f0u4i5 128.0.0.0/1 via 172.27.abc.def dev tun0 169.254.0.0/16 dev enp2s0 scope link metric 1000 linkdown 172.27.abc.def/21 dev tun0 proto kernel scope link src 172.27.abc.def 192.168.2.0/24 dev enp2s0 proto kernel scope link src 192.168.2.2 metric 100 linkdown </code></pre>
2021-02-11T16:22:28.600
<p>Why not let it have an initial certificate so that the first message can be &quot;Hello. I'm up and my serial number is abcd.&quot; ? In the cloud, you can then look up your sales/fulfillment database and send it the other info about what it is configured as and for which customer. From that point on, the device can behave appropriately, with that configuration, the first message being a confirmation that it is so configured.</p> <p>If no info can be found in your fulfillment database, the device has nothing to do until next power on or perhaps tries in a few hours.</p>
|aws|product-design|
Create and manage thousands of "things"
5530
<p>I'm working on a project that might grow up to several thousands of things. The management is on AWS. My lack of knowledge is about practical operations, like the creation of the things.</p> <p>Currently we need to:</p> <ol> <li>power up the board to get (via serial, display, WiFi, etc...) the ID</li> <li>on AWS create a new thing with this ID</li> <li>create the certificates as well</li> <li>download the certificates and copy them to the board</li> <li>add the new thing to our system's database</li> <li>assign the new thing to the commercial stuff (i.e. customer, plant, etc...)</li> </ol> <p>Please note that each board is configured and installed at office. So we known in advance which is the final customer/plant.</p> <p>Of course this procedure is time consuming and error prone. It works only for few prototypes. But it cannot work when the numbers grow.</p> <p>Is there a way to automate this? For another customer - where I had the <em>whole</em> control of the code, so no AWS but a plain and simple PHP backend - I did something like this:</p> <ol> <li>On power up the board checks if it was already configured</li> <li>If not, sends its own ID to a local webserver</li> <li>If the ID is unknown, it's added to the database (&quot;thing&quot; created) in a special table of the newly discovered things</li> <li>If there are systems that are waiting for boards, the software assigns the new discovered things to them and put the record in another table</li> <li>The board updates itself downloading the configuration from a REST service</li> </ol> <p>It worked fine but there were two main characteristics that now I don't have:</p> <ul> <li>the boards had a display, so it was easy to catch the right one</li> <li>I wrote all the code, there were no &quot;hidden&quot; or third-party code like in AWS</li> </ul> <p>Please, would you help me to understand how one should approach these simple operations in a Could-based environment?</p>
2021-02-15T16:47:00.847
<p>The <code>client.connect()</code> function takes a hostname, not a URL as it's first argument.</p> <p>The failure is because the client is trying to resolve <code>wss://psmart-test-api.aegean.gr/ws/</code> as a hostname.</p> <p>You should just be passing <code>psmart-test-api.aegean.gr</code> as the first argument of the function.</p> <p>To change the path section of the connect URL then you will need to use the <code>ws_set_options(self, path=&quot;/mqtt&quot;, headers=None)</code> See the docs <a href="https://www.eclipse.org/paho/index.php?page=clients/python/docs/index.php#ws-set-options" rel="nofollow noreferrer">here</a></p>
|mqtt|raspberry-pi|web-sockets|python|
Connect to Mqtt over websockets
5538
<p>I'm trying to connect on a broker with the following script</p> <pre class="lang-python prettyprint-override"><code>#!/user/bin/env python import paho.mqtt.client as mqtt import random import requests import warnings import LoggingManager logger = LoggingManager.log_setup() logger.info(&quot;Start Working&quot;) my_client_id = f'python-mqtt-{random.randint(0, 1000)}' # method = &quot;websockets&quot; my_endpoint = &quot;wss://psmart-test-api.aegean.gr/ws/&quot; # port = 443 # keepalive = 60 key = &quot;ea75d54ea85b54ba5cde22ffb31090f9b2cbaeba8ad6eef1be575bfae89f56d3&quot; url_login = &quot;https://psmart-test-auth.aegean.gr/auth/refresh_session&quot; warnings.filterwarnings('ignore', message='Unverified HTTPS request') def myNewlogin(key, url_login): loginobj = '''{ &quot;token&quot;: &quot;%s&quot; }''' % (key) loginHeaders = {'Content-Type': 'application/json'} login_response = requests.request(&quot;POST&quot;, url_login, data=loginobj, headers=loginHeaders, verify=False) table = {} table[&quot;status_code&quot;] = login_response.status_code if (login_response.status_code == 200): result = login_response.json() mytoken = result[&quot;token&quot;] table[&quot;token&quot;] = mytoken else: table[&quot;token&quot;] = login_response.text return (table) is_connected = False # The callback for when the client receives a CONNACK response from the server. def on_connect(client, userdata, flags, rc): print(&quot;Connected with result code &quot; + str(rc)) global is_connected is_connected = True # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. # client.subscribe(&quot;$SYS/#&quot;) # client.subscribe(&quot;org/TERIADE/K4XKF6UT/Temperature&quot;) # The callback for when a PUBLISH message is received from the server. def on_message(client, userdata, msg): print(msg.topic + &quot; &quot; + str(msg.payload)) def on_disconnect(client, userdata, rc): print(&quot;Disconnected&quot;) # authenticate to take username # user = str(myNewlogin(key, url_login)) # print(user) login = myNewlogin(key, url_login) if (login[&quot;status_code&quot;] == 200): # if we can login # print(&quot;mylogin 200&quot;) logger.info(&quot;mylogin 200&quot;) else: # print(login) logger.info(&quot;mylogin&quot; + str(login[&quot;status_code&quot;])) # Create a client instance client = mqtt.Client(my_client_id, transport='websockets') # Register callbacks client.on_connect = on_connect client.on_message = on_message # client.tls_set(ca_certs=&quot;https://psmart-api.aegean.gr/roots.pem&quot;) # client.tls_set() # Set userid and password client.username_pw_set(login[&quot;token&quot;]) # Connect client.connect(my_endpoint, 443, 60) client.loop_start() publish_interval = 5 value = 0 while 1 == 1: if is_connected == True: print('hello') else: print(&quot;still waiting for connection&quot;) time.sleep(publish_interval) # Blocking call that processes network traffic, dispatches callbacks and # handles reconnecting. # Other loop*() functions are available that give a threaded interface and a # manual interface. # client.loop_forever() # while 1: # Publish a message every second # time.sleep(1) </code></pre> <p>and I'm getting the following error</p> <pre class="lang-python prettyprint-override"><code>Traceback (most recent call last): File &quot;mqtt_client_psmart.py&quot;, line 91, in &lt;module&gt; client.connect(my_endpoint, 443, 60) File &quot;/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py&quot;, line 941, in connect return self.reconnect() File &quot;/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py&quot;, line 1075, in reconnect sock = self._create_socket_connection() File &quot;/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py&quot;, line 3546, in _create_socket_connection return socket.create_connection(addr, source_address=source, timeout=self._keepalive) File &quot;/usr/lib/python3.7/socket.py&quot;, line 707, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File &quot;/usr/lib/python3.7/socket.py&quot;, line 748, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known </code></pre> <p>I can't find a solution. Any ideas? Thanks in advance</p> <p>After @hardillb help, I made the following changes:</p> <pre class="lang-python prettyprint-override"><code># Configure network encryption and authentication options. Enables SSL/TLS support. client.tls_set() # Set userid and password client.username_pw_set(login[&quot;token&quot;]) # Set websocket connection options. client.ws_set_options(path=&quot;/ws&quot;, headers=None) # Connect client.connect('psmart-test-api.aegean.gr', 443, 60) </code></pre> <p>The code is running now... I get <strong>still waiting for connection</strong> but that another issue....</p>
2021-02-17T13:47:17.007
<p>We're lacking quite a bit of data, but let's run a few numbers.</p> <ul> <li><p>If each message is about 1000 bytes, then 10K * 1000 * 8 / 2 = 40 Mbit/s. Not even considering the Wi-Fi part, that's quite a lot of upstream bandwidth.</p> </li> <li><p>If each message is closer to 10 K bytes (quite possible if yous end each message as its own HTTPS request without keepalives or TLS session caching), then we're in the hundreds of Mbit/s.</p> </li> <li><p>If you manage to stay below 100 bytes (possible if you send short messages in an existing socket or Websocket), down to a few Mbit/s. More reasonable but still quite a bit of traffic.</p> </li> </ul> <p>Also consider that those 10K devices at 1 message every 2 seconds means your server receives 5K messages per second. If the server is just forwarding them to another connection, fine. If you are storing in a database, we're talking thousands of IOPS. By far not impossible with decent SSD-backed storage, but not on you run-of-the-mill single HDD of course.</p> <p>Also remember that if that data comes about 1 Kbyte on disk per message (very possible if you include indexes, etc, possibly much more depending on your DB schema), you're writing 10K * 1024 * 86400 / 2 = 442 Gigabytes per day!</p> <p>But let's consider the upstream and server parts are sorted.</p> <p>You'll never run 10K devices on a single AP. It's just not possible. Most &quot;consumer&quot; APs will choke beyond a few dozen devices. The best ones will stop at a few hundred in the best of conditions (using multiple radios on multiple bands). That's just for maintaining state, keys, and so on, we're not even talking about the devices communicating yet.</p> <p>The ESP8266 operates only in the 2.4 GHz band. That band is quite small and also quite busy. We'll consider the case of &quot;most countries&quot; (the US has more restrictions). You only have 3 non-overlapping channels in 802.11b or 4 in 802.11g/n at 20 MHz.</p> <p>I don't think you'll be able to have more than about a 100 devices in 2.4 GHz on a single AP. So we're already reaching 100 APs!</p> <p>But with only 2 to 4 non-overlapping channels, the risk of interference between neighbouring devices and APs is probably too great for things to run reliably.</p> <p>Remember that the speeds quoted for Wi-Fi (72 Mbit/s max for the ESP8266) are just raw stream data rates. They do not take into account overhead, preamble, ACKs, RTS/CTS frames, guard intervals, inter frame space, collisions, retransmits... When sending very short frames, the overhead can quickly use a vast majority of the airtime, so you can't compare 72 Mbit/s with the 40 Mbit/s quoted above.</p> <p>Remember as well you'll have (at least) TCP ACKs, and 802.11 is half-duplex.</p> <p>At this scale, I'm not sure what the right solution is. My first instinct would go towards Ethernet (and possibly PoE), but this is a massive setup (that's quite a few switches, and quite a lot of cables).</p> <p>A probably better option is to have a single ESP8266 with sensors for multiple machines to reduce the number of devices, but I have no idea if that's possible in your case.</p>
|esp8266|wifi|routers|
How many machines do I connect to a single WiFi router?
5550
<p>I have 10,000 machines (to make jute-bags), and each machine needs to send data to a remote server every 2 seconds. The data consists of machine id, machine state and various other information collected from different sensors.</p> <p>I have successfully integrated the ESP8266 WiFi module with the machine. It collects all necessary data, and transmits it to the router, which then uses the internet to send data to my remote server. As a demonstration to the factory management, I successfully sent data of 10 machines, every 2 seconds.</p> <p>But now, I have to do the same task for 10,000 machines.</p> <p>I have absolutely no idea as to how much bandwidth I need and how many machines I can connect to a single router?</p> <p>If my question seems incomplete, please feel free to ask me more questions.</p>
2021-02-24T03:44:43.893
<p>I’ve pieced together the solution which is fairly straightforward, just poorly documented.</p> <p>Firstly, I discovered Amcrest's Privacy Mode which is exactly the option that I want to toggle using my Action Rule.</p> <p>Amcrest has a <a href="https://s3.amazonaws.com/amcrest-files/AMCREST_CGI_SDK_API.pdf" rel="nofollow noreferrer">partially documented API</a> but this doesn’t mention Privacy Mode.</p> <p>However, the missing piece to the puzzle is <a href="https://amcrest.com/forum/ip-cameras-f18/cgi-bin-url-for-privacy-mode--t14496.html" rel="nofollow noreferrer">this Amcrest user</a> who found the right syntax by trial and error:</p> <pre><code>http://youramcrestip/cgi-bin/configManager.cgi?action=getConfig&amp;name=LeLensMask http://youramcrestip/cgi-bin/configManager.cgi?action=setConfig&amp;LeLensMask[0].Enable=true http://youramcrestip/cgi-bin/configManager.cgi?action=setConfig&amp;LeLensMask[0].Enable=false </code></pre> <p>Lastly, you can call this using the <a href="https://www.synology.com/en-global/knowledgebase/Surveillance/tutorial/General/How_do_I_build_a_Smart_Home_through_IFTTT" rel="nofollow noreferrer">Webhook option</a> as the Action in the SS Action Rule:</p> <p><a href="https://i.stack.imgur.com/0wOZe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0wOZe.png" alt="Webhook settings for Amcrest API" /></a></p>
|surveillance-cameras|
How to stop Amcrest camera from tracking motion while Surveillance Station is in Home Mode
5556
<h2>Problem</h2> <p>I have an Amcrest IP camera set up which records to Synology Surveillance Station (SS) when triggered by motion detecting, with motion tracking enabled. I've set up my regular recording profile (record only when motion is detected) and Home Mode (no recording at all).</p> <p>What I would like to achieve is that when I’m in Home Mode, not only does the camera not record, but it also doesn’t track any motion (i.e. pan or tilt) at all. Ideally, it would be even better if I could tell at a glance whether the camera was currently active or not (mostly for the benefit of house guests).</p> <p>As a last resort I might buy a smart plug and use IFTTT to trigger it to shut the camera's power off, but I would prefer to avoid adding another device to the mix.</p> <h2>What I've tried</h2> <p>I’ve set up Action Rules in SS where the trigger is entering (or leaving) Home Mode, and the action is to disable (or enable) the camera. When I enter Home Mode I can see that this has the effect of disabling the camera, but this applies on the SS side only - so the camera still actively detects and tracks motion.</p> <p>Is there a way that I can configure the Action Rule to disable the camera itself (either by disabling motion tracking, or powering it off)?</p>
2021-02-25T14:41:39.867
<p>Answered in <a href="https://github.com/arendst/Tasmota/discussions/11246" rel="nofollow noreferrer">Tasmota's github</a>. Generally, using <code>PulseTime</code></p>
|tasmota|
Using TASMOTA for timeout operations
5563
<p>I wish to use TASMOTA to replace my code that when triggered ( button or sensor ) to operate not as <code>Toggle</code> but staring a timeout, for example, IR sensor input triggers ON for 15 minutes.</p> <p>Is is possible ?</p>
2021-03-03T06:16:59.680
<p>You can ship as so many electronic devices shipped internationally, so that you too can but do it with proper safety measures, if you done that then you are free to grow your business, or else <em><strong><a href="https://batteryshipping.cc/how-to-ship-lithium-battery/?gclid=CjwKCAiAp4KCBhB6EiwAxRxbpNrD85WQahUOLKAwmY6aSeHGSkdeDNl47_JduF41f0Z2PS9QrE1e9xoCB6EQAvD_BwE" rel="nofollow noreferrer">https://batteryshipping.cc/how-to-ship-lithium-battery/?gclid=CjwKCAiAp4KCBhB6EiwAxRxbpNrD85WQahUOLKAwmY6aSeHGSkdeDNl47_JduF41f0Z2PS9QrE1e9xoCB6EQAvD_BwE</a></strong></em> this guys can ship your battery internationally, contact them</p>
|batteries|
Can I ship the product (internationally) with LiPo battery included?
5576
<p>I want to distribute an IoT product commercially. The product is powered by LiPo battery (3.7V nominal) ‎which is charged by solar panel (6V, 2W). ‎ My question is can I ship the product (internationally) with LiPo battery included? Are there any ‎regulations against it? What is the usual practice in similar case?‎ Do the same regulations apply to LiFePo4 batteries also?‎</p>
2021-03-04T08:51:40.333
<p>Google Documentation includes a check list which has the ToS</p> <p><a href="https://developers.google.com/assistant/smarthome/develop/launching" rel="nofollow noreferrer">https://developers.google.com/assistant/smarthome/develop/launching</a></p> <p>Especially read the first item on the list on that page.</p> <p>For Amazon you should probably start here:</p> <p><a href="https://developer.amazon.com/en-US/alexa/devices/connected-devices/business-resources" rel="nofollow noreferrer">https://developer.amazon.com/en-US/alexa/devices/connected-devices/business-resources</a></p> <p>And look at &quot;Certification and Badging&quot; section</p>
|smart-home|alexa|google-home|
Developing a product for commercial use compatible with Google Home/Alexa
5581
<p>I would like to know whether there are any restrictions/rules when developing a product which is compatible with Google/Alexa or maybe even other hubs. Do I need to get some license or follow some rules?</p>
2021-03-06T16:45:36.117
<p>According to <a href="https://en.wikipedia.org/wiki/Google_Nest_(smart_speakers)#Model_comparison" rel="nofollow noreferrer">Wikipedia</a> the rebranded one is the 2nd Generation one. So there's just a Home Mini (1st gen) and a Nest Mini (2nd gen) but nothing in between. I also know from my colleagues at work who are doing integration with these products that they only have those two types of Minis. On the page there are also the differences between the two. Seems your retailer there was a bit lazy in putting the correct names on these products.</p>
|smart-home|google-home|
Is there a difference between Google Nest Mini and Google Nest Mini 2nd gen?
5589
<p>I'm looking to dive into home automation starting from a <code>Google Nest Mini</code> device. <br/> I understand that there has been a <code>Home Mini</code> and then the second iteration was rebranded as <code>Nest</code>. But a retailer site <a href="https://store.google.com/in/magazine/retailers_google_nest_mini" rel="nofollow noreferrer">recommended by Google India</a> has two generations of Google Nest Minis with two different prices - <a href="https://www.tatacliq.com/google-nest-mini-chalk/p-mp000000006446830" rel="nofollow noreferrer">Nest Mini</a> and <a href="https://www.tatacliq.com/google-nest-mini-2nd-gen--chalk/p-mp000000005976505" rel="nofollow noreferrer">Nest Mini (2nd Gen)</a>. Also, they do <a href="https://www.tatacliq.com/google-home-mini-chalk/p-mp000000002964941" rel="nofollow noreferrer">list Home Mini</a> separately.<br/> I cannot figure out the difference between Nest Mini and Nest Mini 2nd gen. Every article/video I read/watch compares <code>Nest</code> with <code>Home</code> without suggesting that there's a 2nd Gen Nest Mini.</p> <p>If there's, I'd love to be directed towards a link where I can understand the difference. I'm very confused. <br/> TIA!</p>
2021-03-09T15:25:13.833
<p>Rather than describing how to cover all your wishes, I'll act as if there's one precise question. (All your wishes may be covered in the article I recently found <a href="https://toic.org/blog/2009/reverse-ssh-port-forwarding/" rel="nofollow noreferrer">here</a> )</p> <p>The precise question I'll answer is: I have a linux gateway that gathers sensor data.<br /> I have shell access to that gateway logged in as &quot;gatewayuser&quot;<br /> I want to be able to access that gateway by ssh from &quot;somewhere on the internet&quot;<br /> How do I do that?</p> <p>OK, now we're working from some fixed criteria. You're right, SSH and tunneling are the answer. You probably can't or don't want to expose your sensor gateway as a fixed place on the internet. (At a minimum, your router will probably make it difficult.)</p> <p>So, you want to use SSH reverse forwarding<br /> <a href="https://man.openbsd.org/ssh#R" rel="nofollow noreferrer">ssh -R</a></p> <p>If you want your sensor gateway to be able to continually try to establish this connection, you'll want the other end to be a static ip address or at least unchanging host name.</p> <p>Say you use some cheap VPS or developer-tier (free) Amazon AWS (or other) instance. Say that this public host is assigned the IP address 111.222.33.44 and you created an account 'clouduser' Say this host has port 2222 available for use.</p> <p>From your linux gateway, you would enter the command</p> <pre><code>sudo ssh -R 2222:localhost:22 clouduser@111.222.33.44 </code></pre> <p>Technically you will log into 111.222.33.44, and if you're going to run this in a crontab, that's not necessarily what you want.</p> <p>Now, from that cloud server 111.222.33.44, assuming you've ssh'ed into it as clouduser, you can then run</p> <pre><code>ssh -p 2222 localhost -l gatewayuser </code></pre> <p>There are ways to secure this better (bind addresses come to mind) and make it so you don't have to log into the gateway first (crontab comes to mind). I found that blog article did a pretty good job, so I'm going to conclude my simple &quot;do this one thing&quot; reply and refer you off to those resources.</p>
|networking|protocols|linux|
How to use SSH server on a remote device and overcome routing issues
5595
<p>I am designing an embedded Linux device that acts as a gateway for sensor data. In some cases this device will use a back-haul that I don't control (e.g. customer supplied cell or cable modem). I assume this device will be behind some sort of NAT and that network parameters will be assigned via DHCP in most installations.</p> <p>For typical communications, the device will open up sockets with a REST web service.</p> <p>I would like to add some secure diagnostic, command, and control capabilities. What I <em>want</em> is for each gateway to be running something like an SSH server. That way I could have a very flexible interface that a human can use on demand to communicate with a misbehaving gateway and troubleshoot or fix what is going wrong. This presents some obvious security issues, but I am more interested in talking about the networking hurdles I need to overcome at this point:</p> <ol> <li>My customers would need to open a port on their router and forward port that my device, or my device needs to be directly connected to the internet and not behind NAT.</li> <li>If my device is behind NAT it will probably need a static IP</li> <li>The customer will need a static IP for their network, or we'll need to capture dynamic IP's through our REST interface.</li> </ol> <p>How can I hole punch SSH?</p> <ol> <li>Can I make each gateway act like an SSH client and open a session with one of our servers, is there some way to transfer or takeover the SSH session?</li> <li>Can I tunnel the data using an IP-in-IP connection or similar?</li> </ol>
2021-03-26T22:05:51.757
<p>Azure IoT Hub doesn't act as Telemetry database for querying the data. Indeed it's storing the data for the specified time defined in the retention policy but you don't have a direct access to it from the portal. To get the data you can do the following -</p> <ol> <li>Create a Message Route on the Device Telemetry Messages that will route your messages to an external storage. <a href="https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-d2c" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-d2c</a></li> <li>Create an Azure Function with IoT Hub trigger that will get the messages and then you can programmatically route them. <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-iot-trigger?tabs=csharp" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-iot-trigger?tabs=csharp</a></li> <li>Use tools like Device Explorer - <a href="https://docs.microsoft.com/en-us/azure/iot-pnp/howto-use-iot-explorer" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/iot-pnp/howto-use-iot-explorer</a></li> <li>Use the EventProcessorHost library to get the data <a href="https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-event-processor-host" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-event-processor-host</a></li> </ol>
|azure|
Where is my sensor data being stored in the IoT Hub?
5630
<p>Context: I am sending temp/humidity data from an NCD.io sensor through a gateway device to Azure, where it is being stored in the IoT Hub, somewhere.</p> <p><a href="https://i.stack.imgur.com/HCSEB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HCSEB.jpg" alt="enter image description here" /></a></p> <p>Problem: Where is this data? I can access it through the device twin &amp; also see it being sent via the Azure CLI, but the data logged in the IoT Hub only conveys information about the gateway message itself, not the actual data. The screenshot is a chart of messages received to date; I can go step deeper and glean insights about the messages but nothing about the sensor data.</p> <p><a href="https://i.stack.imgur.com/b7RNJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b7RNJ.png" alt="enter image description here" /></a></p> <p>Can this information only be accessed via another service? Is there no way to view data in the Hub?</p> <p>Looking for clarification, tips/tricks. Thanks!!</p>
2021-04-01T14:07:07.797
<p>I looked around for an answer, and while it seems unlikely that you will get an authoritative answer without doing the experiment yourself, there is <a href="https://www.reddit.com/r/googlehome/comments/85up06/play_on_all_speakers_bandwidth_question/" rel="nofollow noreferrer">this reddit thread</a> which indicates that the music is only streamed to one of the devices (the master), which then streams to the other devices.</p> <p>It is debated whether a device will always take the stream from the master or simply from the device it that will give it the best quality (which in most cases would be the master), but it seems pretty unanimous that the music is only streamed once, meaning that your 6 speakers will not consume 6 times more data than 1 speaker.</p> <p>There is <a href="https://support.google.com/googlenest/thread/55078279?hl=en" rel="nofollow noreferrer">one thread</a> on the Google Nest help which asks for this information, but unfortunately the answer is notoriously unclear... the community specialist says,</p> <blockquote> <p>The only way to stream music on Google Home devices at the same time is by playing it on a group of speakers and that is consider <em>[sic]</em> as one streaming.</p> </blockquote> <p>Grammar aside, it sounds as though it is a single stream being broadcast to the group, but it's not clear.</p>
|google-home|audio|
Will casting music to a Google Home speaker group consume more Internet data than casting to a single speaker?
5636
<p>Here's my setup:</p> <p>My Internet at home comes from a 4G modem, because that's the best deal in my area in terms of price/speed. However, my speed is reduced to 3 Mbps after using 150 GB per month, but that's usually fine as I usually stay below 150. It does happen that I have to endure slow speeds for a few days during the last days of the month, though.</p> <p>I use a Google Nest Wifi with one router connected by Ethernet to the 4g modem, and one more Google wifi (also acts as speaker) to enhance the signal.</p> <p>I also have 6 Google speakers in various rooms throughout the apartment (3 Nest Audios, 1 Home Max, 1 Home Mini, and 1 original Home.)</p> <p>I have made those 7 speakers into one group, and quite often I use Spotify to play on the entire group so they music plays in sync in the entire apartment.</p> <p>Now, my question is: Will this consume more Internet data than simply casting to one speaker? For example, let's say I stream an album that would usually require 100 MB of data. I would assume that when this plays on all 7 speakers, this is only transferred once from the Internet, then transmitted on my local network to all the speakers.</p> <p>Is that true though? After all, most people's data plans on home WiFi are unlimited, so it's not entirely unthinkable to me that Home was designed so that each speaker streams the music from the Internet. I see in the Google WiFi app that all speakers seem to have consumed considerable amounts of data during a month, so this makes me wonder.</p> <p>So while I assume the former, I would like to ask whether someone understands the inner workings of the Home/Nest system well enough to give me a concrete answer here.</p>
2021-04-06T03:08:46.697
<p>There are many forms of (distributed) denial of service attacks. If some are based just on bandwidth, many will impact the service way before any link is saturated.</p> <p>If any request sent to your server(s) takes 100 ms of CPU time to execute, for instance, each CPU/core will at most be able to process 10 such requests per second. Even if you have 10 servers with 8 cores each, then 800 requests per second will saturate your infrastructure. Even counting 10 KB per request, that’s just about 64 Mbit/s. Even if you have Gbit/s links everywhere, your service will still be unavailable or very slow.</p> <p>Others may saturate your servers by just keeping connections open. They don’t even need to use any CPU, just keep the connection open as long as possible. Depending on the server software and settings, this may bring your service to a halt quite quickly.</p> <p>So it all really depends on the type of attack and the servers and their setup.</p>
|ip-address|
Does a DDoS attack’s effectiveness depend on your bandwidth?
5647
<p>I read <a href="https://www.tanaza.com/tanazaclassic/blog/how-to-calculate-network-bandwidth-requirements/" rel="nofollow noreferrer">here</a>:</p> <blockquote> <p>Network bandwidth is the capacity of a network communications link to transmit the maximum volume of data from one point to another over a computer network or Internet connection in a given amount of time, usually one second. Bandwidth has the same meaning of capacity, and defines the data transfer rate.</p> </blockquote> <p>Does this mean that the higher the bandwidth, the (generally) more likely that your router can withstand a DDoS?</p> <p>And what is a typical bandwidth (in Gbps) that most routers have? If someone stresses my router with a 1Gbit/sec attack, how much bandwidth (or whatever it is that an attack’s effectiveness depends on) would I need to withstand it with 0 issues? If it doesn’t completely override my router to the point that it’s useless, would it give me lag or something?</p> <p><strong>NOTE:</strong> if there’s a better SE I could ask this on, please redirect me to it</p>
2021-04-06T20:59:55.100
<p>If your cable modem has an open ethernet port you will be good to go. The nest wifi becomes the router/mesh network so if you have a modem/router combo you may need to put it in bridge mode.</p>
|wifi|nest|
Nest Wifi - What to look for to make sure your current modem is compatible with a Nest Wifi device?
5649
<p>I'm about to pull the trigger on buying a Nest Wifi <a href="https://store.google.com/ca/product/nest_wifi" rel="nofollow noreferrer">https://store.google.com/ca/product/nest_wifi</a>.</p> <p>So before I spend 200$ on that... how can I verify that my current modem can handle the Nest Wifi?</p> <p>Are the cables from the modem to the router universal?</p>
2021-04-19T12:41:04.243
<p>Thank you for helping, I've found what I needed and that is the Shelly SmartPlug</p> <p>Shelly SmartPlug supports both, a documented Cloud API (Through shelly servers) so you don't need to intercept or reverse Engineer anything.<br /> as well as support for MQTT protocol.<br /> you will need to enable it first through its web interface, enter your MQTT broker IP and port and you're good to go.</p> <p>It uses an ESP8266 chip, running Mongoose OS, You can also flash tasmota on it on the air without soldering.</p> <p>It has three ways of communications<br /> 1.Local HTTP API<br /> 2.MQTT<br /> 3.Cloud API</p> <p>Here's my plan :<br /> first I will press the power button on the shelly smart plug<br /> it will open a wifi network with a local HTTP server that you can use to configure it.<br /> through my custom Android app, I will call that server API, pass my Wifi credentials to it, enable MQTT, Add my MQTT Server IP and port to it and that's it!</p> <p>I can then use its local HTTP server to communicate with it through LAN or use MQTT to communicate with it through WAN.</p> <p><a href="https://shelly.cloud/products/shelly-plug-smart-home-automation-device/" rel="nofollow noreferrer">https://shelly.cloud/products/shelly-plug-smart-home-automation-device/</a></p> <p>Local API: <a href="https://shelly-api-docs.shelly.cloud/_review/mqtt/#shelly-plug" rel="nofollow noreferrer">https://shelly-api-docs.shelly.cloud/_review/mqtt/#shelly-plug</a><br /> <a href="https://shelly-api-docs.shelly.cloud/#shelly-plug-plugs" rel="nofollow noreferrer">https://shelly-api-docs.shelly.cloud/#shelly-plug-plugs</a></p> <p>Cloud API: <a href="https://shelly.cloud/documents/developers/shelly_cloud_api_access.pdf" rel="nofollow noreferrer">https://shelly.cloud/documents/developers/shelly_cloud_api_access.pdf</a></p> <p>Tasmota profile: <a href="https://templates.blakadder.com/shelly_plug_S.html" rel="nofollow noreferrer">https://templates.blakadder.com/shelly_plug_S.html</a></p> <p>Flashing: <a href="https://youtu.be/_TSJB_IzxG0" rel="nofollow noreferrer">https://youtu.be/_TSJB_IzxG0</a></p>
|smart-plugs|
Connect a smartplug to a custom web API
5667
<p>I'm making a graduation project where I need to connect a smart plug to a web server through WAN (obviously the smart plug and the server aren't on the same network).</p> <p>In other words, I want to be able to turn the smart plug on/off through my website and have the smart plug send power readings to my server's API.</p> <p>Most smart plugs out there connect to their manufacturer's API. I want to buy a smart plug that I can configure/program to connect to my own API.</p> <p>Are there any smart plugs out there that support that?</p> <p>I would appreciate any more suggestions or information because I'm kinda lost.</p> <p>EDIT: I did an extensive google searching, most methods out there :</p> <ol> <li><p>reverse engineering the API between the android app and the manufacturer's server and calling the manufacturer's server to control the smart plug, or using IFFT which also calls the manufacturer's server.</p> </li> <li><p>Creating a script on the local network that receives commands from WAN and sends commands to the smartplug through it's LAN API , but obviously this is not what I need as it requires that you run the script on a device (raspberry pie) 24 hours.</p> </li> <li><p>There are also upnp and port forwarding methods that allow you to use the local network API on WAN but that's also not an option for security reasons.</p> </li> </ol> <p>I need a smart plug that has power monitoring capabilities that I can make it connect to my own server.</p> <ol start="4"> <li>I read about flashing a custom firmware (tasmota) on a smartplug (sonoff) to make it connect to an MQTT broker on WAN. I think this satisfies what I need, I can install an MQTT brocker on my server and make the smartplug connect to it, but this method is kinda hacky and I don't wanna risk. I also don't know if it supports power monitoring or not.</li> </ol> <p>there's a smart plug called MOKO SMART MK112 that supports MQTT and power monitoring out of the box, but the problem is that I couldn't get it from china due to COVID19.</p> <p>If you know any good resources to do that or any smartplug that supports MQTT as well as power monitoring I or any other suggestions would really appreciate it.</p>
2021-05-06T20:52:41.393
<p>As mentioned in the comments</p> <p>A LTE radio is unlikely to have a MAC address that is of any use to you (it will have similar ids on the cellular network e.g. IMEI). MAC addresses in LWIP's context are normally for use with Ethernet networks. I suggest you probably want to use the LWIP PPP mode. Docs <a href="https://lwip.fandom.com/wiki/PPP" rel="nofollow noreferrer">here</a></p> <p>As for the IP address, any IP address that is available to the LTE modem is most likely going to be from a Private IP address range and be behind a CGNAT gateway as IPv4 addresses are in increasingly short supply and to get a fully routable address you will be paying a premium. If you want a publicly accessible device you really should be looking at IPv6 support these days.</p>
|communication|
Getting IP and MAC address of LTE modem using AT commands
5705
<p>I have an LTE modem connected to my mcu. It's a simcom7600 modem.</p> <p>I am trying to find the IP and MAC address of the modem (I need that, so that I can hook up <a href="https://www.nongnu.org/lwip/2_1_x/index.html" rel="nofollow noreferrer">lwip</a> and start communicating to the outside world).</p> <p>I achieved a few things already:</p> <ul> <li>basic stuff like reset, attach, activate, ping, etc</li> <li>played around with mqtt using AT commands</li> <li>set the modem in ppp mode, and switch from/to command mode and back to data mode (ppp).</li> </ul> <p>However, getting the IP address and MAC address seem a more daunting task.</p> <p>What I have tried is :</p> <pre><code>AT+CGPADDR=1 Sending command: AT+CGPADDR=1 [CR][NL]+CGPADDR: 1,xxx.xxx.xxx.xxx[CR][NL][CR][NL]OK[CR][NL] </code></pre> <p>xxx.xxx.xxx.xxx obviously shows a real IP address, I think it's best not to share that online ;-)</p> <p>Could anybody confirm this is the IP address which is visible to the outside world? Because when I try to ping or trace it, it seems to be unreachable.</p> <p>For MAC address I found this:</p> <p><a href="https://i.stack.imgur.com/QcaMv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QcaMv.png" alt="enter image description here" /></a></p> <p>But when I try that, it always errors out.</p> <pre><code>AT+CWMACADDR? Sending command: AT+CWMACADDR? [CR][NL]ERROR[CR][NL] </code></pre> <p>For what it's worth: I CAN ping from the modem to e.g. google. So I know I am connected.</p> <pre><code>AT+CPING=&quot;www.google.com&quot;,1 Sending command: AT+CPING=&quot;www.google.com&quot;,1 [CR][NL]OK[CR][NL] [CR][NL]+CPING: 1,216.58.211.100,64,299,255[CR][NL] [CR][NL]+CPING: 1,216.58.211.100,64,288,255[CR][NL] [CR][NL]+CPING: 1,216.58.211.100,64,287,255[CR][NL] [CR][NL]+CPING: 1,216.58.211.100,64,277,255[CR][NL] [CR][NL]+CPING: 3,4,4,0,277,299,287[CR][NL] </code></pre> <p>Who can confirm that the approach to obtain my IP address is correct? Who can give me some guidance how to get the modems MAC address?</p> <p>Many thx in advance!!</p> <p>AT+CWMACADDR?</p>
2021-05-09T17:52:53.147
<p>The exact setup depends on what you want or need to do, but the basic scheme is that:</p> <ul> <li>you define a service with your own custom UUID</li> <li>you define a characteristic on that service (or several), with read/write/notify flags depending on your needs</li> <li>you start advertising</li> </ul> <p>This is a scheme that will work with all BLE devices with an appropriate app running on them.</p> <p>Sometimes you can just advertise and not bother with the service and characteristics. Sometimes you use pre-defined services and characteristics. And there are probably other combinations.</p>
|bluetooth|bluetooth-low-energy|
BLE client server communication
5708
<p>This is probably asked several times before, but my websearch skills can't really direct me to an adequate answer.<br /> I have a thingy, that takes commands from a mobile application with a request-response protocol.<br /> Also from time to time it sends notifications to the mobile app.<br /> Until now, I used RFCOMM, but iOS doesn't really seem to support it. So I had to switch the underlying implementation. So far I found that the GATT profile might be what I need, but I'm not sure if it is the right direction. Or if it is achievable at all.<br /> So what profile/setup should I dig into to implement this communication pattern?</p>
2021-05-11T13:48:22.410
<p>There are different possible stages, though the details will vary a lot on what you are trying to achieve, what is on the market, your technical and financial means, expected volume, etc.</p> <ul> <li><p>The easiest solution is to use <strong>development boards</strong>, which are not always very small, but usually have all sorts of interfaces, connectors and additional stuff which is very useful for prototyping (such as USB interfaces, configuration jumpers, several power sources, test pads, connectors for antennas and batteries and external devices, pins to use on a breadboard, LEDs, etc.), but of course takes space (and adds cost). You can often use those without soldering a thing.</p> <p>This allows you to test the functional aspects, software, and so on.</p> <p>For some products you can directly re-use such boards, if they meet your constraints.</p> </li> <li><p>The next possible solution is to use <strong>SMT modules</strong>. Those have the minimum components to run (in your case the 9205 needs additional components such as the SDR105 front-end, a PMIC...), but more limited physical interfaces. In many cases the only connections are just the solder pads, which may be more or less easy to manipulate (they can be just on the edges or you could have dozens of contacts under the module).</p> <p>Many such modules include shielding and have been EMC/RF tested, which can simplify your regulatory approval process.</p> <p>In some situations such modules will include an antenna connector (u.FL), a PCB trace antenna, or a ceramic antenna, and associated matching network. All the rest needs to go through the contacts of the module, which means you'll have this soldered onto a PCB which will then have the connectors for whatever your need (antenna, battery...) as well as buttons (reset? factory reset? configuration?), LEDs, and whatnot. Depending on the power source and what is inside the module, you may also need voltage regulators, battery charging circuits, USB ports... Don't forget that you'll need to program the devices initially!</p> <p>Of course in this case, you ned to design your own PCB, have it made and assembled (or have the resources to do it yourself), which on every new version means time and money.</p> </li> <li><p>The final step is just to design your own full PCB onto which you'll have all the components you need and just those you need. In some cases it may be relatively easy, in others significant skills may be needed which you may not need when using an SMT module.</p> </li> </ul> <p>Note that the minimum quantities involved usually increase along the way: dev boards are sold by the unit, modules sometimes require slightly higher quantities, the chips themselves may have very high minimum order quantities (MOQ). 100K pieces to order directly from the manufacturer is common, and for some chips it's the only way to get them (others you can get for any quantity, but the price may be quite different depending on the quantity).</p>
|hardware|
IOT prototyping
5711
<p>I am having a difficult time figuring out how to prototype in the IOT realm. This mainly stems from the accessibility of components and modules; and the size of them. Here is what I have done so far.</p> <ul> <li>Identified chipsets that fit my use case such as qualcomm 9205/9206.</li> <li>Found modules that I think have that chipset in them (at this point the chip has become physically too big) Quectel EP06</li> <li>searched for prototyping boards that the module will fit into.</li> </ul> <p>So my problem is that the Quectel EP06 is too big and I dont know my next step after this POC prototype. Essentially I need to fit the final solution into less than 18mm by 18mm. All the SOC needs is low power LTE and global positioning like GNSS.</p> <p>I've searched online and the only chip that looks like it will work is the qualcomm 920x series.</p> <p>Does anyone know the process to prototype with a chip like this? Am I going down the right path here? I am new relatively new to prototyping and very new to working with SOC type chips.</p> <p>Thanks</p> <p>Adam</p>
2021-05-14T16:50:38.477
<p>The manufacturer advertising data looks like this:</p> <pre><code>01 01 a4 c1 38 3a 07 3a 01 07 08 ce 25 89 62 00 01 ?? ?? ---MAC address--- ?? ?? Temp- -Hum- Ba ?? ?? </code></pre> <ul> <li><p>Bytes 3-8 are the MAC address (it's present elsewhere in the frame, but iOS does not give that info to apps, while it gives the full advertising data, that's why this is repeated here)</p> </li> <li><p>Bytes 11-12 are the temperature (0x08ce = 2254 -&gt; 22.54°)</p> </li> <li><p>Bytes 13-14 are the humidity (0x2589 = 9609 -&gt; 96.09%)</p> </li> <li><p>Byte 15 is the battery level (0x62 = 98 -&gt; 98%)</p> </li> </ul> <p>That leaves us 6 unknown bytes, but all the rest (which I believe includes all the info you need) is pretty clear.</p> <p>You would have to capture more traffic to see if those remaining values change.</p>
|raspberry-pi|bluetooth|
BLE Sensor Gateway & RaspPi Project
5716
<p>Goal:</p> <p>To build a gateway using a RaspPi 4 which will receive the BLE data from the sensor and be able to see this on my mobile remotely anywhere.</p> <p>Sensor:</p> <p>Temperature &amp; Humidity BLE (T201), you use an APP called &quot;SensorsPro&quot; to receive the data from the sensor when within range and you can sync the data to produce a up to date graph which logs the data. The sensor itself has a 20 day memory approx in which you can open the app and sync the data. When you open the app the data takes a few seconds to start flowing again with a live Temp &amp; Humidity readings. The app can also connect and read multiple sensors, each had a unique MAC address starting with [A4:C1:38:<strong>:</strong>:**].</p> <p>Why: I use these to monitor my vivariums with creatures inside, each needs to be within a temp &amp; humidity range and i'd like to be able to monitor remotely and receive alerts if the temp range spikes or the humidity drops so I can activate the appropriate cooling fans, misting system, turn off the lights in spikes of hot weather etc.</p> <p>What i need help with:</p> <ol> <li><p>I have been able to put an old galaxy s6 into dev mode and use the app from the manufacturer and receive data and logged it via the btsnoop_hci.log file and exported to Wireshark but i can't seem to translate this data after searching for hours i'm struggling to read the data for one to be able to convert it into a temperature and humidity reading plus device battery level.</p> </li> <li><p>The T201 sensor is always advertising but connecting via a mobile ble scanner or gatttool disconnects frequently without being able to do much more, i need to find a way to mimic the app via the RPi and send the data to my pi which i could then use / convert with once i know what data i'm receiving and use python (optimisically) and then forward to Mosquitto / Node Red / MQTT Dashboard to read the data and then work out a IFTTT or Telegram notification to alert me if the temperature / humidity is out of</p> </li> </ol> <p>Any help would be appreciated, i'm a beginner in linux and python so certainly have a challenge ahead.</p> <p>I looked into OpenHab too but without the data from the sensor i feel thats a no go too at present.</p> <p>Thank you in advance for any contributions towards my project.</p> <p><strong>18/05/21:</strong></p> <p><a href="https://easyupload.io/kdc6gp" rel="nofollow noreferrer">https://easyupload.io/kdc6gp</a> - 30 second of BLE Data</p> <p><a href="https://streamable.com/bgqo5v" rel="nofollow noreferrer">https://streamable.com/bgqo5v</a> - Video of the 30 seconds to see the temperature, humidity, battery level live against the 30 seconds to see how it changes.</p> <p>[A4:C1:38:3A:07:3A] - Top reading, [A4:C1:38:C0:01:E1] - Bottom reading</p>
2021-05-16T20:47:21.847
<p>There is no known limit to the number of IOT things that can be concurrently connected. The broker is obviously able to have enough IP addresses and ports to allow virtually unlimited incoming connections. It is also a cluster so that you wont bog down the rules engine, etc. AWS has some good experience with large scale systems. Besides, you'll be paying for each connection, though a small amount ! I'm sure if you try hard enough, there is a way to cause trouble in the rules engine and get slapped on the wrist/banned. But for someone who's just doing their work, that is unlikely.</p> <p>Topics are dynamic. i.e, until something subscribes to a topic or something publishes to a topic, the broker just has no knowledge of it. You dont &quot;create&quot; a topic.</p> <p>Now, from a device perspective, there is a limit of how many subscriptions a connection can make. I think it was 50 (my knowledge is from some time ago. Please check.) Also, from an account perspective, there is a limit of the number of messages that can go on per second, and the number of connections per sec, subscriptions per sec etc. Some of these are soft limits and some of these are hard limits. Many of these dont usually affect you unless there is some event that causes a bunch of devices to reconnect at the same time. (E.g: an AWS datacenter has a power glitch that causes a reboot of all the machines, or there's an outage at the cellular provider that gets fixed suddenly and all devices connect at the same time. Or, there's a power outage across Texas that gets fixed suddenly!). But if you will have say, 200k devices that come up and connect randomly between say, 7 and 9AM and will send a couple of messages every few seconds, you will not come close to any limits. Keep an eye on the costs, though.</p>
|aws-iot|aws|
What is the maximum number of IOT things of topic per AWS account?
5719
<p>What is the maximum number of AWS IOT Things that can be concurrently connected to the IOT broker? Or what is the maximum number of topics that can be created per AWS account?</p> <p>So for example is it possible let us say to have a product, and the expected production for example is more than 200,000 (two hundred thousands). Can I add those 200.000 things in the AWS account to keep tracking of all of these products and all of them can be connected and subscribed/publishing concurrently to the broker? Would that be possible?</p> <p>I tried to find that info on AWS, but couldn't.</p>
2021-05-23T23:23:23.987
<p>The way a got it to work was to buy a separate router and connect only the switches to it. Sometimes one of them still keeps disconnecting but it is better than having my phone kicked from the network all the time.</p>
|networking|wifi|linux|
"Smart" switch keeps disconnecting from wi-fi network
5731
<p>I bought a smart switch to control my room lamp. It is a JWCOM Smart SA-01 model with very little to no documentation available on the internet (at least I wasn't able to find anything useful). The problem is that whenever I connect the device on the wi-fi network it either disconnects and keeps trying to reconnect or it kicks my phone from the network. Since the only two devices connected to my wi-fi network are my phone and this switch, I think that it might be consuming too much band and the router has no other option to kick one of them off of it.</p> <p>I contacted the seller about this issue and they didn't give a valid answer, saying that the problem might be occurring due to the wi-fi signal being too weak, which is not the case because the switch is literally less than a meter from the router.</p> <p>Since I don't know the problem, do you guys know a Linux command that allows me to check for the band usage on my wi-fi router? Has anyone run into a similar problem before and, if so, what did you do to fix it? Since my router doesn't provide band control by MAC address, is there a way to control the network usage of this device from my computer somehow?</p> <p>Thanks in advance</p>
2021-05-29T07:32:37.927
<p>I am trying to answer all your questions one after the other below.</p> <blockquote> <p>In what scenario is it possible that collision happens between two packets.</p> </blockquote> <p>If at the location of the receiver the signal of two or more LoRaWAN radio packets interfere so that the receiving device is not able to demodulate that packet that was addressed to it, we say that the packet was lost due to collision.</p> <blockquote> <p>And if a collision happens, is it possible to demodulate?</p> </blockquote> <p>If the signal of two LoRaWAN radio packets interfere at the location of the receiver, it may still demodulate the one that was addressed to it.</p> <blockquote> <p>How?</p> </blockquote> <p>A radio packet that is facing collision with another radio packet at the receiver can be demodulated with high likelihood under the following conditions:</p> <ul> <li>The two radio packets are sent on different LoRaWAN channels.<br /> (LoRa is using several channels with 125 or 500 kHz channel bandwidth.)</li> <li>The two radio packets are sent on the same LoRaWAN channel but they are modulated with a different spreading factor.<br /> (LoRa applies 6 possible spreading factors for modulation. These are referred as SF7..SF12 where SF7 corresponds to the highest, SF12 to the lowest data rate)</li> </ul> <p>There is only a little interference between neighbouring radio channels and LoRaWAN modulations of different spreading factors are orthogonal.</p> <blockquote> <p>Regarding <a href="https://behrtech.com/blog/4-technical-approaches-to-ensure-interference-resilience/#:%7E:text=Intra%2Dsystem%20interference%2C%20or%20self,scheme%20in%20many%20LPWAN%20systems." rel="noreferrer">here</a> it says there are two types of interference. Intra and internetwork for unlicensed networks. I suspect when a node from outside network interferes with signals inside network, it is recoverable. But how? Thanks.</p> </blockquote> <p>Your referred link (<a href="https://behrtech.com/blog/4-technical-approaches-to-ensure-interference-resilience/#:%7E:text=Intra%2Dsystem%20interference%2C%20or%20self,scheme%20in%20many%20LPWAN%20systems." rel="noreferrer">here</a>) is talking about inter-<strong>system</strong>/intra-<strong>system</strong> interferences and not inter-<strong>network</strong>/intra-<strong>network</strong> interferences that you mentioned in your question. It is important to make a difference between the two scenarios.</p> <ul> <li><p>In case of LoRaWAN technology, inter-<strong>network</strong> interference means collisions with LoRaWAN radio packets that are sent by such devices that belong to other, (foreign) LoRaWAN networks. In these cases the conditions of successful demodulation of a radio packet are the same as listed above (different channel, different spreading factor).</p> </li> <li><p>Inter-<strong>system</strong> interference means interference with radio signals produced by non-LoRa devices (e.g.: a garage opener) that operate in the same ISM band. In these cases the signal of foreign systems is considered as noise of the LoRa signal to be demodulated. Whether or not demodulation will be successful depends on the SNR threshold of the actual spreading factor and receiver.</p> </li> </ul>
|lorawan|
LoRaWAN collision and demodulation
5740
<p>In what scenario is it possible that collision happens between two packets. And if a collision happens, is it possible to demodulate? How? Regarding <a href="https://behrtech.com/blog/4-technical-approaches-to-ensure-interference-resilience/#:%7E:text=Intra%2Dsystem%20interference%2C%20or%20self,scheme%20in%20many%20LPWAN%20systems." rel="noreferrer">here</a> it says there are two types of interference. Intra and internetwork for unlicensed networks. I suspect when a node from outside network interferes with signals inside network, it is recoverable. But how? Thanks.</p>
2021-06-01T19:57:38.123
<p>If you want to use it “as a keyboard”, i.e. whenever a card is presented some data from the card is sent to the PC as if it were typed on a keyboard, they I don’t believe you can do that with this combination:</p> <ul> <li>An USB/UART converter will present itself as a serial port to the PC, not as a keyboard (which would be an “HID”)</li> <li>The PN532 will not just spit out raw data anyway, it needs to exchange properly formatted commands and responses. Some NFC chips are programmable to do that, I don’t believe that is the case of the PN532.</li> </ul> <p>If you really want an NFC reader acting as a keyboard you’ll probably need a device that has been designed for that (there are quite a few). If you want to do it yourself, you can probably use the PN532 but you’ll need something a bit more intelligent to connect it to the PC, some kind of microcontroller with USB peripheral support which allows use of the HID profile and an UART to talk to the PN532.</p> <p>Some Arduino boards as well as some of the Teensy boards should be able to do that.</p> <p>In any case, you’ll need to determine exactly what you want to read from the tags and output as keystrokes. A classic case is the card’s UID, but other applications may require reading different information from the card, possibly with encryption and whatnot.</p> <p>If you don’t care about it actually acting as a keyboard, but just want to communicate with the PN532, then the combination should work out. Note that IIRC the PN532 has multiple interfaces (SPI, I2C, UART I believe), and some ready-made boards are preset to a specific interface. Other will require cutting or soldering some jumpers to select the right mode.</p> <p>Note that on PCs, the optimal use case is generally to have a reader which is compatible with the PC/SC protocol. This allows you to use all sorts of software which can work with any such reader.</p>
|rfid|microsoft-windows|
Is it possible to connect a PN532 with CP210 to Windows x86/64?
5744
<p>I want to use my PN532 as input device like a keyboard on my pc with windows 10. I have a PN210 USB to UART Bridge.</p> <p>Is there a way to use my PN532 on a x86/64 device?</p>
2021-06-20T15:41:38.957
<p>USB3.0 interference is real! I had 2 fit-size USB 3.0 drives plugged directly into the pi USB3 ports, with the ConBee II plugged in next to them in the USB 2.0 port, and that completely prevented the ConBee from being able to pair with zigbee devices. What's more surprising is that moving the ConBee to a powered USB hub (with 3+ feet of distance from the Pi) didn't make a difference - I still couldn't pair with any Zigbee devices. Also note that this is NOT a power issue - I'm using the official CanaKit 3.5a power supply.</p> <p>As soon as I removed the two USB thumbdrives, the ConBee was able to pair with all 7 of my devices.</p>
|raspberry-pi|zigbee|home-assistant|docker|
Can't Connect to ZigBee Devices (Raspberry Pi4, HomeAssistant, Docker-Compose, ConBeeII)
5762
<p>I'm stumped on this one - everything appears to be correctly configured and working properly...except that HomeAssistant can't discover any ZigBee devices. Adding the ConBee II appears to work just fine (recognized under the mapped address as below):</p> <p><a href="https://i.stack.imgur.com/Ckclo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ckclo.png" alt="Screenshot of modal to add ConBee device" /></a></p> <p>...but when I go to add a device, this spins until it times out after a few minutes:</p> <p><a href="https://i.stack.imgur.com/GP2gl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GP2gl.png" alt="screenshot of unsuccessful attempts to discover devices" /></a></p> <p>This is a fresh install Raspbian, with the following docker-compose.yml (I've tried the commented out options, as well):</p> <pre><code>version: '3' services: homeassistant: container_name: homeassistant # image: homeassistant/home-assistant:stable image: homeassistant/raspberrypi4-homeassistant:stable ports: - &quot;8123:8123&quot; volumes: - ./config:/config - /etc/localtime:/etc/localtime:ro devices: # - /dev/ttyACM0:/dev/ttyACM0 - /dev/ttyACM0 restart: unless-stopped # network_mode: host # privileged: true </code></pre> <p>This is the debug output from docker which writes immediately when I click on Add Device in the HomeAssistant configuration for ConBee:</p> <pre><code>homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.zigbee.application] Sending Zigbee broadcast with tsn 1 under 2 request id, data: b'013c00' homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_request (17, 2, 0, &lt;DeconzAddressEndpoint address_mode=1 address=65532 endpoint=None&gt;, 0, 54, 0, b'\x01&lt;\x00', 2, 0) homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Send: 0x12130018001100020001fcff00003600000300013c000200 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Frame received: 0x121300090002002202 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] APS data request response: [2, &lt;DeviceState.APSDE_DATA_REQUEST_SLOTS_AVAILABLE|2: 34&gt;, 2] homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Frame received: 0x0e14000700aa00 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] Device state changed response: [&lt;DeviceState.128|APSDE_DATA_REQUEST_SLOTS_AVAILABLE|APSDE_DATA_INDICATION|2: 170&gt;, 0] homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_indication (1, 1) homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Send: 0x1714000800010001 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Frame received: 0x17140021001a002201fcff0102000000000036000300013c0000afdd873601001e homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] APS data indication response: [26, &lt;DeviceState.APSDE_DATA_REQUEST_SLOTS_AVAILABLE|2: 34&gt;, &lt;DeconzAddress address_mode=ADDRESS_MODE.GROUP address=0xfffc&gt;, 1, &lt;DeconzAddress address_mode=ADDRESS_MODE.NWK address=0x0000&gt;, 0, 0, 54, b'\x01&lt;\x00', 0, 175, 221, 135, 54, 1, 0, 30] homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy.zdo] [0x0000:zdo] ZDO request ZDOCmd.Mgmt_Permit_Joining_req: [60, &lt;Bool.false: 0&gt;] homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] 'aps_data_indication' response from &lt;DeconzAddress address_mode=ADDRESS_MODE.NWK address=0x0000&gt;, ep: 0, profile: 0x0000, cluster_id: 0x0036, data: b'013c00' homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Frame received: 0x0e15000700a600 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] Device state changed response: [&lt;DeviceState.128|APSDE_DATA_REQUEST_SLOTS_AVAILABLE|APSDE_DATA_CONFIRM|2: 166&gt;, 0] homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_confirm (0,) homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Send: 0x04150007000000 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Frame received: 0x04150012000b00220201fcff00e100000000 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] APS data confirm response for request with id 2: e1 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] Request id: 0x02 'aps_data_confirm' for &lt;DeconzAddressEndpoint address_mode=ADDRESS_MODE.GROUP address=0xfffc endpoint=None&gt;, status: 0xe1 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.zigbee.application] Error while sending 2 req id broadcast: TXStatus.MAC_CHANNEL_ACCESS_FAILURE homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] Command Command.write_parameter (2, &lt;NetworkParameter.permit_join: 33&gt;, b'&lt;') homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Send: 0x0b160009000200213c homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.uart] Frame received: 0x0b16000800010021 homeassistant | 2021-06-20 11:05:07 DEBUG (MainThread) [zigpy_deconz.api] Write parameter permit_join: SUCCESS </code></pre> <p>Things I've tried:</p> <ol> <li>Deleting the Integration in HomeAssistant and re-adding the device</li> <li>RMing the docker setup and starting fresh</li> <li>The commented out parameters in the docker-compose file</li> <li>Changing the zigbee channel to 24 (via ./config/configuration.yaml</li> <li>Pairing multiple different device types (I've tried both Leviton switches and Aqara door sensors, always in discoverable mode)</li> <li>Connecting the ConBee to a powered USB hub to rule out any USB3 or wifi interference (although the pi is a client on a 5GHz wifi network)</li> <li>Googling the <code>MAC_CHANNEL_ACCESS_FAILURE</code> error extensively, which appears to be a red herring</li> </ol>
2021-06-22T12:37:11.490
<p>Mosquitto is only local (on the same computer) if no custom config is used, do you use a custom config?</p> <p>What OS do you have on the laptop?</p> <p>Under listener in the config example found here: <a href="https://github.com/eclipse/mosquitto/blob/master/mosquitto.conf" rel="nofollow noreferrer">mosquitto/mosquitto.conf</a>.</p> <p>On row 216 add <code>listener 1883 0.0.0.0</code> to allow outside of the computer connections.</p>
|mqtt|esp32|
ESP32 MQTT error
5764
<p>I have been trying to connect my ESP32 board to my laptop via MQTT. I have installed Mosquitto MQTT broker on my laptop but I fail to connect my ESP32 every time. This is the test code I am using to check MQTT connection.</p> <pre class="lang-c prettyprint-override"><code>#include &lt;WiFi.h&gt; #include &lt;PubSubClient.h&gt; const char* ssid = &quot;......&quot;; //WiFi Name const char* password = &quot;......&quot;; //WiFi Password const char* server= &quot;xxx.xxx.xx.xx&quot;; //RPi or Machine IP on which the broker is WiFiClient espClient; PubSubClient client(espClient); int setup_WiFi(){ delay(10); // We start by connecting to a WiFi network Serial.println(); Serial.print(&quot;Connecting to &quot;); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print(&quot;.&quot;); } Serial.println(&quot;&quot;); Serial.println(&quot;WiFi connected&quot;); Serial.println(&quot;IP address: &quot;); Serial.println(WiFi.localIP()); Serial.print(&quot;Attempting MQTT connection...&quot;); client.connect(&quot;esp32&quot;); if (client.connect(&quot;esp32&quot;)){ Serial.println(&quot;connected&quot;); } else { Serial.print(&quot;failed, rc=&quot;); Serial.println(client.state()); } return 0; } int reconnect() { unsigned long startAttemptTime = millis(); while (!client.connected()) { Serial.println(&quot;Attempting MQTT connection...&quot;); // Attempt to connect if (client.connect(&quot;esp32&quot;)){ Serial.println(&quot;connected&quot;); } else { Serial.print(&quot;failed, rc=&quot;); Serial.println(client.state()); Serial.println(&quot; try again in 5 seconds&quot;); // Wait 5 seconds before retrying delay(5000); } } return 0; } int send_mqtt(){ setup_WiFi(); char sss[15]=&quot;Hello World&quot;; if (!client.connected()){ reconnect(); } client.publish(&quot;esp32/test&quot;, sss); //send message WiFi.disconnect(true); Serial.println(&quot;Sent&quot;); return 0; } void setup() { Serial.begin(115200); client.setServer(server, 1883); //mqtt server details setup_WiFi(); reconnect(); } void loop() { send_mqtt(); delay(10000); //Wait 10 secs before next transmission } </code></pre> <p>But each time I get the error</p> <blockquote> <p>failed, rc=-2</p> </blockquote> <p>I have been trying to do the same for the past 2 months or so but to no success. Meanwhile, I have searched the internet extensively, to see what was it that I am doing wrong. I make sure that both the devices are on the same LAN.</p>
2021-06-26T13:36:41.023
<p>Raw LoRa is just about sending raw data using the LoRa modulation. There's no encryption, there are no acks, no counters, no device identifiers, nothing. All of this, happens in upper layers, usually the LoRaWAN layer.</p> <p>If you want encryption on a raw LoRa link, unless the providers of the LoRa modules have added <del>they</del> their own, you'll have to do it yourself, with all the associated caveats (it's harder than you think, as was shown by <a href="https://en.wikipedia.org/wiki/Wired_Equivalent_Privacy#Weak_security" rel="nofollow noreferrer">WEP</a>, though the levels of traffic on a LoRa link make some of the attacks on WEP unlikely).</p> <p>In LoRaWAN encryption indeed happens between the end device and the LNS (network server).</p> <p>If you use raw LoRa without encryption, you will most definitely be able to read any data sent by the end devices</p>
|esp32|lora|lorawan|
LoRa point-to-point communication
5778
<p>I would like to create a point-to-point connection between a LoRa temperature sensor and a M5 Stack (ESP32) with LoRa module. However, I am a beginner with LoRa, so I have a few questions:</p> <p>Are all packets send with LoRa (not LoRaWAN) encrypted? Or does it depend on the producer of the LoRa sensor? Can the content of the packet received by the M5 Stack be viewed? (If I understand correctly, with the LoRaWAN the content can only be viewed after it is on the server). Can I send measured temperatures from multiple LoRa sensors to one M5 Stack? If yes, how could I distinguish from which sensor the packet has been sent?</p> <p>Any help would be appreciated!</p>
2021-06-27T18:23:14.323
<p>There's an alternative, but it depends a lot on what the other &quot;LoRa compatible device is&quot;.</p> <ul> <li><p>If it has gateway functionalities (ability to listen on multiple channels and data rates and matching software, usually means SX13xx-based) and you can freely program it, then it may be possible to have the LNS directly embedded in the gateway. In that case you just continue to use full LoRaWAN.</p> <p>Probably much easier if it's something running some Linux flavour (e.g. a Raspberry Pi of some sort) than a more basic device (e.g. ESP32 based), but it's really just software, so as long as it fits it should be possible.</p> <p>Depending on your scenario, you probably don't need a full-fledged LNS, so you can probably just build a pretty basic thing with lots of stuff hardcoded if you need to run that on a more limited device.</p> </li> <li><p>If the other device is just an end-device (which can listen only on a single channel/data rate at a time, usually based on SX12xx chips), then you have the option to try to turn it into a &quot;nano-gateway&quot;, and again, embed an LNS.</p> <p>The LNS would need to be configured to change the channels sent to the sensor so it only uses the single channel your nano-gateway is listening on.</p> <p>The join process is going to be clumsy as the sensor will send join requests on one of 3 standard channels at random, while the nano-gateway will only listen on a single channel, but once joined it should work.</p> <p>Again, it would need the ability to run an LNS (at least a minimal one) on the nano-gateway, see above.</p> </li> </ul> <p>Otherwise, as the other have pointed out, if you really want to use raw LoRa and no LNS at all , then you will need to modify the existing device. Depending on the device, the MCU, whether the firmware source is publicly available, etc, this may be very easy or very complex. Without any details about that device, it's very difficult to say more.</p>
|lora|lorawan|
Sending LoRa packets using LoRaWAN sensor device
5780
<p>I would like to measure temperatures using a LoRa device and establish a point-to-point connection with another LoRa compatible device. However, the only appropriate temperature sensors use LoRaWAN, which requires a network server, which I am trying to avoid. Is there a way to enable a LoRaWAN sensor device to establish a point-to-point connection and receive packets that don't have to go through a network server?</p> <p>Thanks in advance!</p>
2021-06-29T13:11:27.473
<p>LWTs are part of the session that mosquitto will persist to the db along with the rest of the session.</p> <p>But if both the pi's fail due to a powercut then the broker will never get the chance to send the LWT as both will go offline at the same time as the client, so the keepalive timeout will never be reached.</p> <p>It will not start the clock for any disconnected clients when it comes back online as keepalive is only valid for currently connected clients and no clients will be connected as it restarts.</p> <p>So to answer the last question, no there is no way to get the behaviour you are looking for.</p>
|mqtt|mosquitto|
Does mosquito broker persist LWT messages to disk, so they may be recovered between restarts?
5784
<p>I have two RaspberryPis, one with the mosquito broker, and one acting as a client. The client has set up a LWT with the broker. After a power outage that affects both RPis, both RPis come back online, but the LWT is never sent. I expected it would be sent since from the broker's point-of-view, the client is not longer receiving pings. I am wondering if this is because mosquito does not persist LWT to disk (all my other retain messages are present)? If so, can I change mosquito to allow this?</p> <p>My config looks like:</p> <pre><code># Place your local configuration in /etc/mosquitto/conf.d/ # # A full description of the configuration file is at # /usr/share/doc/mosquitto/examples/mosquitto.conf.example pid_file /var/run/mosquitto.pid persistence true persistence_location /var/lib/mosquitto/ log_dest file /var/log/mosquitto/mosquitto.log include_dir /etc/mosquitto/conf.d autosave_interval 300 </code></pre>
2021-07-02T15:53:27.807
<p>Here's what I'd do. I would use a CPLD (maybe even a PLD would do).</p> <p>If you need to choose amongst a set of known logic trees, I would have it all pre-programmed and use some sort of wired or wireless or light based comm to select the right input pins, to select the right logic tree for other pins.<br /> If you need the logic to be changeable but cannot make a fixed set, then you'd need to compile the required logic into a JTAG programmable file and send the file over perhaps by wired or wireless or light based comms to the target and have something at the target to change the CPLD via JTAG.<br /> It has been done before.</p> <p>If you need some analog capabilities along with this, look for something like this one instead of the CPLD: <a href="https://www.cypress.com/products/32-bit-arm-cortex-m3-psoc-5lp" rel="nofollow noreferrer">https://www.cypress.com/products/32-bit-arm-cortex-m3-psoc-5lp</a>.</p> <p>Beyond this, it is hard to read your mind to see what you're looking for!</p>
|hardware|wireless|microprocessors|plc|
Non-locally Electrically Programmable Logic Gates - Technological Advances Progress
5788
<p>Preface: I’d like to clarify that I understand what a relay is and that a PLC uses a fairly conventional microprocessor that only digitally establishes logical logic gate configuration as a digitally programmable alternative to relay banks for analog and/or (depending on the PLC) digital signals. My question is based on the understanding that to date actual logic gates (as far as I know) aren’t non-locally programmable (“re-wirable”) without a person manually rewiring truly programmable actual (not logical programming of a statically wired microprocessor) logic gates.</p> <p>Rectenna work interests me specifically around any potential relevance of varying transmission wavelengths and material resistances (if this is not possible with MoS2, generally as a concept for other potential materials) to making possible remote switch activation of logically chosen switches along an array. Essentially I am curious about if this or other research has potential for constructing truly physically reprogrammable (externally and maybe wirelessly) logic gates.</p> <p>In general any information on advances towards this capability would be appreciated as right now it seems like the only rudimentary build I could manage for my project is a 64 gate one. That’s not great because anything less than 512 gates would be very hard to make useful for my proof of concept project, and I know there’s no way I could get to a more ideal 262,144 gates.</p> <p>One example would be any publication which covers if the kind of uses of phase-engineered low-resistance contacts for ultrathin MoS2 transistors covered in the articles below would be able to be produced with varying resistance in a band usable for varying activation via radio waves for switches.</p> <p><a href="https://doi.org/10.1038/nmat4080" rel="nofollow noreferrer">https://doi.org/10.1038/nmat4080</a></p> <p><a href="https://www.ece.cmu.edu/news-and-events/story/2019/05/rectennas-converting-radio-waves-into-electricity.html" rel="nofollow noreferrer">https://www.ece.cmu.edu/news-and-events/story/2019/05/rectennas-converting-radio-waves-into-electricity.html</a></p> <p>I’m not picky if someone knows about other technological advances approaching this capability such as biochemical non-locally programmable switch activation equivalent processes. Thanks everyone.</p> <p>Update 1: My specific question is: Have there been any significant technological advances towards non-locally electrically programmable logic gates?</p> <p>Update 2: After further review I’ve found that FPGAs are not what I am asking about. Their reprogramming like PLCs is digital not analog. They seem to just be a more generalized similar thing to PLCs rather than being factory equipment. I might incorporate one or more in my project, but they aren’t what I am referring to which is true analog reprogramming. Why does analog matter? Analog means more efficient at the surface level, but it also allows structured logic similar to ladder logic at the hardware level which enables significantly different uses in structuring and restructuring logic execution.</p>
2021-07-06T14:15:35.357
<p>DDOS protection should be at the network level, not in the application.</p> <p>By the time it's made it down the TCP/IP stack to the application, it's too late and your machine is already on it's knees</p>
|mqtt|mosquitto|
DDOS Protection in Open Source MQTT Brokers
5796
<p>I'm doing a research on DDOS protections in MQTT brokers and I started with open source Mosquitto broker. I couldn't find any countermeasure listed in the documentation page.</p> <p>Since my C language knowledge is not that deep, I would like first ask this here before checking the source code. Are there any countermeasures against DDOS attacks in Mosquitto broker?</p>
2021-07-07T11:30:57.657
<p>Your publishing code needs to run the client loop as well otherwise it will only send 1 TCP/IP packet which will limit the sending size to what ever the MTU is on the network.</p> <p>Adding the same timed period with the client loop running will work, but a better solution would be to use the single shot wrappers included in the Paho library that will ensure that the message is fully sent before closing the connection. The docs can be found <a href="https://www.eclipse.org/paho/index.php?page=clients/python/docs/index.php#single" rel="nofollow noreferrer">here</a></p> <pre class="lang-python prettyprint-override"><code>import paho.mqtt.publish as publish f = open(&quot;/opt/plcnext/test.txt&quot;,&quot;rb&quot;) imagestring = f.read() byteArray = bytearray(imagestring) publish.single(&quot;paho/test/single&quot;, byteArray, hostname=&quot;192.168.1.115&quot;) </code></pre>
|mqtt|
Cannot transfer Files from linux machine to windows machine (via mqtt)
5803
<p>I'm running an MQTT Broker on my Windows machine using Mosquitto broker. I have setup a client on the same Windows machine through the Paho MQTT python library. Another client is setup using the same python library on a Linux machine that I have.</p> <p>So, when I publish a file from the Windows client, it reaches the Linux client easily without any issues. However, when I tried to publish a file from my Linux client, it does not reach my Windows client. Later I noticed that if the file size is greater than 50KB, the file does not transfer from the linux machine. The log from the broker does not display the &quot;Publish message recieved&quot; if the filesize exceeds 50KB.</p> <p>The code for Windows machine to publish:</p> <pre class="lang-python prettyprint-override"><code>import paho.mqtt.client as mqtt import time client = mqtt.Client(&quot;P2&quot;) client.on_message=on_message print(&quot;COnnecting&quot;) client.connect(&quot;localhost&quot;) print(&quot;Connected&quot;) f = open(&quot;D:/Downloads/test.txt&quot;,'rb') imagestring = f.read() byteArray = bytearray(imagestring) print(&quot;Publishing&quot;) client.publish(&quot;photo&quot;, byteArray) </code></pre> <p>The code for Linux machine to subscribe:</p> <pre class="lang-python prettyprint-override"><code>import paho.mqtt.client as mqtt import time def on_message(mosq, obj, msg): with open('test.txt', 'wb') as fd: fd.write(msg.payload) print(&quot;message topic=&quot;,msg.topic) client = mqtt.Client(&quot;P1&quot;) client.on_message=on_message print(&quot;COnnecting&quot;) client.connect(&quot;192.168.1.115&quot;) client.loop_start() print(&quot;Subbing&quot;) client.subscribe(&quot;photo&quot;) time.sleep(1000) client.loop_stop() </code></pre> <p>Code for Windows machine to subscribe:</p> <pre class="lang-python prettyprint-override"><code>import paho.mqtt.client as mqtt import time def on_message(mosq, obj, msg): with open('test.txt', 'wb') as fd: fd.write(msg.payload) print(&quot;message topic=&quot;,msg.topic) client = mqtt.Client(&quot;P2&quot;) client.on_message=on_message print(&quot;COnnecting&quot;) client.connect(&quot;localhost&quot;) client.loop_start() print(&quot;Subbing&quot;) client.subscribe(&quot;photo&quot;) time.sleep(1000) client.loop_stop() </code></pre> <p>Code for Linux machine to publish:</p> <pre class="lang-python prettyprint-override"><code>import paho.mqtt.client as mqtt import time client = mqtt.Client(&quot;P1&quot;) print(&quot;COnnecting&quot;) client.connect(&quot;192.168.1.115&quot;) print(&quot;Connected&quot;) f = open(&quot;/opt/plcnext/test.txt&quot;,&quot;rb&quot;) imagestring = f.read() byteArray = bytearray(imagestring) print(&quot;Publishing&quot;) client.publish(&quot;photo&quot;, byteArray) </code></pre> <p>Is there any restriction from the Linux machine side? or am I doing something wrong here?</p>
2021-07-16T01:59:29.993
<h1>Edit</h1> <p>I've come across <a href="https://stackoverflow.com/questions/56625594/mqtt-authentication-with-same-jwt-token">this</a> stack overflow post. In case the link is dead: In short, the post describes a way to use JWT to authenticate a frontend user with your backend and mqtt broker.</p> <p>While it doesn't really cover your question, I think it still is useful. Specifically, it solves your problem of authenticating a client and controlling access to topics. The mosquitto broker, compiled with mosquitto-go-auth, would be an example of how you could implement the architecture described in the post.</p> <p>Further building on this architecture, to support multiple clients you could develop some sort of gateway from mqtt to other protocols. E.g. a backend service that connects to your mqtt broker and listens for messages on topic <strong>newprotocol</strong>. When it receives such message it translates the message content to your desired protocol. Your frontend clients would only need to speak http and mqtt then.</p> <hr /> <p>I'm trying also trying to build a DIY home automation system and I would very much appreciate it if you could keep this question up-to-date with your progress.</p> <p>That being said, I found a few useful links that you'll maybe also find useful:</p> <ul> <li><a href="https://dejanglozic.com/2014/05/06/rest-and-mqtt-yin-and-yang-of-micro-service-apis/" rel="nofollow noreferrer">Article from 2014 explaining a way to combine REST and MQTT</a></li> <li><a href="https://www.slideshare.net/michaeljohnkoster/mqtt-rest-bridge" rel="nofollow noreferrer">MQTT-REST Bridge Presentation (Mentioned in the article)</a></li> <li><a href="https://redis.io/topics/pubsub" rel="nofollow noreferrer">Redis' PUB/SUB messaging paradigm</a></li> </ul> <p>The gist of the article is:</p> <blockquote> <p>Essentially, you start with a normal REST API and add MQTT messages for REST endpoints that result in a state change (POST/PUT/PATCH/DELETE).</p> </blockquote> <p>Then add to this approach, anytime a IOT device changes state, publish the new state to a REST endpoint.</p> <h2>What I've tried</h2> <p>I hope you'll let me share my thoughts on how to build a system like this and I also hope that this'll be useful to someone. One way I thought about structuring this system is to have 3 components: Clients, REST-API and MQTT-Broker.</p> <p>In my case I have a react app running in the browser. It makes API calls to the REST backend (i.e. GET all IOT devices, POST new message to IOT device, etc.). The backend handles authentication, the PUB/SUB messaging with the broker (i.e. Handle IOT device status changes, find out what IOT devices exists, etc.) and any messages coming from the react app.</p> <p>However, I ran into problem with this approach. How do you let the react app know the state of an IOT device changed while using a stateless protocol (HTTP in this case)? I thought about using websockets to transmit changes to the react app but I ended up not implementing it and went back to the drawing board. And that's were I am now. Another issue with this is that I would be restricting myself to use MQTT for every IOT device. But what if a device doesn't talk MQTT?</p> <h2>Redis</h2> <p>Kalyanswaroop's answer is very insightful. I don't know much about redis but it sounds very interesting. Instead of using MQTT as the sole protocol, we could use redis' messaging system. The IOT devices publish their messages into the message queue of redis instead of directly to the REST-API. All messages from various protocols are stored in the database. Then the API would only need to talk to the database and any clients, e.g. a react app.</p> <p>To transmit changes in the database to a client in real-time, you could use websockets.</p>
|mqtt|https|rest-api|
How to make a MQTT Broker and a REST API communicate?
5828
<p>I'm still very new to IoT and IoT protocols, so pardon my ignorance.</p> <p>I'm trying to go about creating a home automation system to control lights, read room temperatures etc.</p> <p>The user should be able to interact with the IoT devices via a mobile client that is being developed with React Native. Could I implement a MQTT client on that platform? Yes, but I think is way more convenient to have a REST API between the mobile client and the IoT devices. This way I can easily manage user-created routines, add authentication to control certain devices and implement a lot of other functionalities. Also, some devices may use different protocols so I'll let my API take care of this instead of implementing multiple clients on the front-end.</p> <p>I've found ways to &quot;bridge&quot; MQTT and HTTP transforming HTTP posts into MQTT publishes, but this isn't exactly an elegant solution. I want to use my server as a subscriber to MQTT topics and serve the information over HTTP to the mobile client, as well as publish topics when requests arrive or scheduled routines are triggered. How can I do this?</p> <p>I'll be preferably running the MQTT broker and the REST API on the same device (a RaspberryPi) connected to the local network.</p>
2021-07-19T13:31:30.200
<p>Although I have accepted @hardillb answer. But I am writing this answer to share the another approach that I came across when researching around this.</p> <p>Ok so idea is to use IP Broadcasting. So what I have done is, my edge device is continuously emitting an UDP messages over broadcast IP that contains the itself IP. The micro-controller ESP listen to UDP messages and extract IP from that and connect to it.</p> <p>So advantage is that if I have more then one edge device is in system, it is easy to allocate different edge to UC at run time.That keeps the load balancing too.</p> <p>Thanks</p>
|mqtt|
Searching local MQTT server on Local network
5836
<p>I have a micro-controller,ESP8266 for the moment, which is connecting to a mqtt broker and pulish some messages. I have configured mqtt broker on raspberry pi which has an IP address <code>192.168.43.164</code>. so for now I have hard coded the mqtt broker IP in micro-controller firmware. But I want it like it search the mqtt server in local network and then connect to the same.</p> <p>so is it possible to do the same ?? Does such micro-controller can have that capability to do so? I have already search a lot on Google but does not found any solution. Please provide some path.</p> <p>Thanks Abhishek</p>
2021-07-22T15:41:02.913
<p>If you have internet, it would be easiest to use a switch that can be controlled via IFTTT. Just google IFTTT light switch and you'll see the light ! If you dont have internet, you can still use a RaspberryPI with a relay shield and run an MQTT broker on a PC to which the raspberryPI will connect. And you can then run another MQTT program on the PC to send on/off messages to the PI. You could also locate the broker on the PI. May also run a web server on the PI. Google can help there too !</p>
|remote-access|ac-power|
Monitor plug socket remote from desktop PC
5839
<p>Planning a one off party event that involves turning mains lights on/off and then playing media on a PC connected screen.</p> <p>It need not be very fast and doesn't need to use internet but WiFi is available if that route would be simpler/cheaper.</p> <p>It is easy enough to source dump <a href="https://www.wilko.com/en-uk/wilko-remote-control-wall-plug-sockets/p/0343066" rel="nofollow noreferrer">433mhz remote controlled sockets</a> and rig the remote to fire when needed. But I am unsure how to go about detecting the transmission from remote to the socket to play the media on the PC.</p> <p>I imagine I would need some sort of USB transceiver but I haven't found any USB ones that I could drive under Linux. Most of the articles online use expansion boards for Pi or Arduino. I did find one <a href="https://www.cnx-software.com/2017/05/23/this-8-usb-transceiver-can-add-433-mhz-device-support-to-your-home-automation-gateway/" rel="nofollow noreferrer">article</a> using a cheap USB dongle and others vaguely mentioning USB SDR radio.</p> <p>I do have a <a href="https://www.amazon.co.uk/gp/product/B072K3Z3TL/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&amp;psc=1" rel="nofollow noreferrer">USB to TTL Serial Converter</a> that I use for flashing, could I buy a 433 transceiver and rig it up to that?</p> <p>Alternatively I have a Wiimote lying around that could be rig up as the sensor and then use a WiFi plug that is accessible from Linux to turn on/off the lights?</p>
2021-08-16T12:15:33.677
<p>What's &quot;best&quot; depends on the situation. However, here are the advantages:</p> <ol> <li>[TCP, Websocket, MQTT] Connected session. There's a concept of a &quot;connection&quot; after which you can send data in either way.</li> <li>[Websocket, MQTT] Framing. When you want to send multiple messages, you need a way for the receiver to know where each message ends. With TCP, you have to write your own.</li> <li>[Websocket, MQTT] Security. With TCP, you have to either build your own security or use something like TLS (or HTTPS on top of TCP). With websockets, that comes as part of the standard. With MQTT, most providers (AWS, Azure, etc) provide security as part of the package. Note that AWS allows MQTT over websockets too !</li> <li>[MQTT] pubSub: Instead of a 1-1 connection, you may want an ability to send from one, but receive by various/multiple receivers, depending on the topic. MQTT allows the concept of a broker as part of the standard for this. There is the concept of topics and routing in the broker. Some even support persistent messages, etc.</li> <li>[MQTT] LastWillAndTestament: One more feature of pub/sub. Look it up. Not all MQTT implementations support it.</li> <li>[MQTT] Ease of implementation: Since providers such as AWS, Azure provide IoT infrastructure, implementation is very easy. With TCP/Websocket, you'll have to setup the server. In that sense, HTTP may be easier than plain TCP/Websocket.</li> </ol> <p>What's your use case ?</p>
|mqtt|
Why MQTT protocol is better than Websocket or direct TCP socket for live data IoT?
5876
<p>We know MQTT is based on TCP.</p> <p>Why don't we directly using plain TCP connection for live data? Recently I'm using plain TCP for realtime / live connection for transfer sensor data to another device through plain TCP connection in internet.</p> <p>Architecture that I make:</p> <pre><code>IoTBoard -&gt; Server(VPS)-&gt; ClientDevice(eg: smartphone) </code></pre> <p>This architecture looks similliar like MQTT:</p> <pre><code>Publisher -&gt; Broker -&gt; Subscriber </code></pre> <p>The format data I used looks like this in plain TCP in IoT board for one update data.</p> <pre><code>device_id(defined by programmer)|meta_data|sensorA_val|sensorB_val|etc </code></pre> <p>So basically it's just sending plain text to server</p> <p>So I'm using pipeline separator for every topic. Then the server handle it like filtering pipeline before send to client.</p> <p>Also I heard websocket is good for live data too, why it's not better than MQTT?</p> <p>Do you think what am I doing is the best?</p>
2021-08-18T20:42:02.653
<p>With a 3 axis accelerometer in the watch, if the gravity vector is predominantly pointing at the right hand edge of the watch, it's on the left wrist and vice versa.</p>
|wearables|
How does a smartwatch detect the worn handedness?
5879
<p><strong>How does a smartwatch detect the worn handedness?</strong></p> <p>I have googled, but I could not find any valuable information on the query. What is/are the hardware(s) and/or algorithm(s) smartwatches use to detect on which hand the user is wearing the device?</p>
2021-08-20T11:55:51.710
<p>Unfortunatelly, the LoRaWAN 1.0.x spec does not define any standard way for having end-devices rejoin the same or another LoRaWAN network and generate new session keys. This is a big operation issue. Just image what happened if your production Network Server lost (because of a datacenter disaster) all session keys. All devices would be disconnected without having any way to reconnect. (LoRaWAN 1.1 introduces a new message type: rejoin request, that solves this issue.)</p> <p>Device manufacturers usually implement proprietary solutions in the application layer of their firmware to let devices join the same or a new network after session keys are lost. The most common technic is that upon detecting that the Network Server stops answering to LinkADRReq MAC commands (for a certain period: e.g.: for 6 hours) , the device sends new JoinRequests until the new or recovered NS replies with a new JoinAccept so that new session keys can be created.</p> <p>According to my experience 90% of the device manufacturer (but not all of them) implement this technic. Therefore I suggest the following procedure to move end devices from the old NS to a new one.</p> <ol> <li>Perform lab tests with all types of devices connected to your current network server and check if they really try to rejoin after a certain period of time not being connected. (You can remove the device from your current NS, and immediately provision it again so that you can be sure that it's session keys are deleted.)</li> <li>Remove all your devices from your current Network Server</li> <li>Provision all your devices on your new Network Server</li> <li>Visit those devices (&lt;10%) that do not automatically rejoin upon not receiving LinkADRAns messages and restart them manually. (You must have identified all these devices during lab tests before you started the migration procedure)</li> <li>Wait until the rest of the devices rejoin to the new network.</li> </ol> <p>This procedure is far not ideal, but there is currently nothing better. (In theory you could copy the session keys device by device, from the old NS to the new NS but in practice it would require additional integration effort with your old and new NS vendor that would bee too costly.)</p>
|networking|lorawan|over-the-air-updates|
(Re)Joining existing Lora-wan end-devices to another network server
5882
<p>We are moving our Lora-wan gateways and end-device from Loriot to another opensource network server. But we are experiencing problems with some of our devices, when trying to rejoin using OTAA.</p> <p>What is the 'best practise' for connecting and joining end-devices to another network server? Are you always able to reset or rejoin devices using a downlink, or is there maybe another smart way of doing it?</p>
2021-08-21T12:29:02.733
<p>It can, but there's a ~5 minute timeout on unused records in the ARP table. So entries will timeout.</p> <p>You can probably extend that timeout, but a quicker answer is just to sweep through the IP network first.</p> <pre><code>fping -a -g 192.168.1.0/24 ; arp -an | grep -v incomplete </code></pre> <p>Grepping out the incomplete records removes the ones where no host was found, and <code>-n</code> saves waiting for a bunch of reverse DNS lookups that won't work anyway.</p> <p>I like <code>fping</code> but there are other options like arping or nmap or scripting the use of ping.</p>
|networking|wifi|wireless|routers|ip-address|
Why arp -a does not show all devices connected to WIFI?
5883
<p>I am trying to see the IPs of all the devices connected to my WIFI. Everyone suggests to use the command <code>arp -a</code> in the terminal but when I do so I get always the same list of devices. I try to connect new ones but they do not show up. However if I connect to the router administration site (192.168.1.1) in the browser, I can see all the devices I am looking for.</p> <p>How can I get all devices in the terminal using <code>arp -a</code>? Is there an alternative to get the complete list?</p>
2021-08-26T08:03:13.160
<p>Some quick possibilities:</p> <ol> <li>You don't actually have a thing with the name of &quot;myid&quot;.</li> <li>You haven't given this client the rights to the topics you're subscribing to or publishing on.</li> <li>There's not a named shadow with that name (though that should have got you an empty shadow I'd assume.). Try doing a put (after giving it rights to do so).</li> </ol> <p>Also, does the default shadow work?</p>
|mqtt|arduino|esp32|aws|
MQTT disconnects from AWS when publishing a message
5895
<p>Please look at this sketch for ESP32. It does nothing but:</p> <ol> <li>connects to WiFi</li> <li>connects to AWS MQTT</li> <li>subscribes to the <code>/get/accepted</code> topic</li> <li>every 5 s publish an empty message to the <code>/get</code> topic to retrieve the shadow file</li> </ol> <pre class="lang-c++ prettyprint-override"><code>#include &lt;SPIFFS.h&gt; #include &lt;WiFi.h&gt; #include &lt;WiFiClientSecure.h&gt; #define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT #define ETH_PHY_POWER 12 #include &lt;ETH.h&gt; #include &lt;SSLClient.h&gt; #include &lt;PubSubClient.h&gt; #define MQTT_PACKET_SIZE 4096 #define ID &quot;myid&quot; WiFiClientSecure networkClient; PubSubClient pubsub; char *rootCA; char *privateKey; char *certificate; unsigned long old_millis = 0; bool readFile(const char *path, char **buffer) { File file = SPIFFS.open(path); size_t size = file.size(); *buffer = (char *) malloc(size + 1); char *p = *buffer; while(file.available()) *p++ = file.read(); *p = '\0'; return true; } void callback(char *topic, byte *payload, unsigned int length) { Serial.print(&quot;Received &quot;); Serial.print(length); Serial.print(&quot; bytes @ &quot;); Serial.println(topic); Serial.println((char *) payload); } void setup() { Serial.begin(115200); SPIFFS.begin(); WiFi.mode(WIFI_STA); WiFi.begin(&quot;myssid&quot;, &quot;mypassword&quot;); while (WiFi.status() != WL_CONNECTED) { Serial.println(&quot;.&quot;); delay(1000); } Serial.println(WiFi.localIP()); char filename[64]; readFile(&quot;/AmazonRootCA1.pem&quot;, &amp;rootCA); networkClient.setCACert(rootCA); sprintf(filename, &quot;/%s-cert.pem.crt&quot;, ID); readFile(filename, &amp;certificate); networkClient.setCertificate(certificate); sprintf(filename, &quot;/%s-private.pem.key&quot;, ID); readFile(filename, &amp;privateKey); networkClient.setPrivateKey(privateKey); pubsub.setServer(&quot;myendpoint-ats.iot.us-east-2.amazonaws.com&quot;, 8883); pubsub.setBufferSize(MQTT_PACKET_SIZE); pubsub.setClient(networkClient); pubsub.setCallback(callback); old_millis = millis(); } void loop() { char topic[64]; if (pubsub.connected()) { pubsub.loop(); if (millis() - old_millis &gt; 5000) { sprintf(topic, &quot;$aws/things/%s/shadow/name/module-1/get&quot;, ID); pubsub.publish(topic, &quot;&quot;); Serial.print(&quot;Publish to &quot;); Serial.println(topic); old_millis = millis(); } } else { Serial.print(&quot;State &quot;); Serial.println(pubsub.state()); if (pubsub.connect(ID)) { Serial.println(&quot;MQTT connected&quot;); sprintf(topic, &quot;$aws/things/%s/shadow/name/module-1/get/accepted&quot;, ID); if (pubsub.subscribe(topic)) Serial.print(&quot;Subscribed to: &quot;); else Serial.print(&quot;Error while subscribing to: &quot;); Serial.println(topic); } else { Serial.print(&quot;failed, rc=&quot;); Serial.println(pubsub.state()); delay(1000); } } } </code></pre> <p>Here the output:</p> <pre><code>. . . 09:52:35.752 -&gt; . 09:52:36.745 -&gt; . 09:52:37.738 -&gt; 192.168.1.41 09:52:37.837 -&gt; State -1 09:52:40.716 -&gt; MQTT connected 09:52:40.716 -&gt; Subscribed to: $aws/things/myid/shadow/name/module-1/get/accepted 09:52:42.834 -&gt; Publish to $aws/things/myid/shadow/name/module-1/get 09:52:42.967 -&gt; State -3 09:52:45.945 -&gt; MQTT connected 09:52:45.945 -&gt; Subscribed to: $aws/things/myid/shadow/name/module-1/get/accepted 09:52:47.831 -&gt; Publish to $aws/things/myid/shadow/name/module-1/get 09:52:47.997 -&gt; State -3 09:52:50.975 -&gt; MQTT connected 09:52:50.975 -&gt; Subscribed to: $aws/things/myid/shadow/name/module-1/get/accepted 09:52:52.828 -&gt; Publish to $aws/things/myid/shadow/name/module-1/get 09:52:52.993 -&gt; State -3 </code></pre> <p>Every time it publish the message the MQTT connection is lost. <strong>Why?</strong> What is my mistake?</p>
2021-09-07T14:29:40.417
<p>It is possible with rsync but it is 1-1 and needs you to have a server running in the cloud. If you use Amazon S3 instead, you can just use the AWS client with the sync option to put the data to S3 in the cloud. Then, you could use that to sync to another (1 or more) computers if you need it.<br /> If you dont want to use the AWS client on your device, you could use rclone and still have an S3 backend. rclone even supports Microsoft Azure blob storage and a whole lot of others too.<br /> syncthing.net provides similar services to rsync.<br /> Unreliable connectivity can be mitigated by scheduling and if needed, triggering based on connectivity establishment.</p>
|cloud-computing|edge-computing|
Is there an equivalent to the rsync toolset/protocol for the IoT world
5913
<p>Is rsync suitable for IoT devices to move data from and to the cloud?</p> <p>Is there an equivalent for devices that have an unreliable connection?</p>
2021-09-14T05:58:35.240
<p>LoRaWAN has a feature called &quot;macro-diversity&quot;, which allows more than one GW to demodulate the same uplink frame (UL).</p> <p>Multiple gateways receiving the same UL increases network resiliency and performance (in the face of changing/challenging RF conditions).</p> <p>Thanks to the LoRaWAN Passive Roaming feature, set of multiple GWs demodulating the UL can belong to different networks: home network and one or more roaming partners. (Interestingly, a LoRaWAN device can be seen as at home and roaming into multiple visited networks simultaneously).</p> <p>This &quot;network collaboration&quot; creates the net effect of multiple networks contributing their GWs to act as &quot;one densified network&quot;. Which, thanks to the LoRaWAN ADR algorithm, enables the end-device to use higher data rates with lower transmission power, and therefore reduces the battery consumption and interference. This is a win-win-win for the end-device - home network - visited networks.</p> <p>That's why it is highly advisable to use LoRaWAN roaming even for the networks with overlapped coverage.</p>
|lorawan|thingpark|
LoRaWAN roaming for overlapping networks
5926
<p>Why shall we consider having a LoRaWAN roaming agreement with another LoRaWAN network operator that has partly overlapping network coverage with our network? Our end devices are fixed (e.g.: water meters, temperature sensors, etc.) and our network is slightly larger than our partner's network. Does it make sense to set up roaming in such environment? We operate a ThingPark LoRaWAN network server that can be easily connected to the ThingPark Exchange (TEX) roaming hub.</p>
2021-09-14T06:14:08.177
<p>Yes, firmware updates are a big issue with LPWAN networks, because they do not have the downlink capacity to do device-per-device full firmware updates as you can do using e.g.: Bluetooth or WiFi.</p> <p>However, there is a good solution for that leveraging the fact that (1) often new Fw updates are only patches and (2) many devices require the same update.</p> <p>The ThingPark platform has a module that provides reliable multicast (RMC server), allowing you to broadcast a given file to multiple radio cells at once (the multicast group is created by flagging radio cells). you can combine it with another feature of this server to <strong>automatically compute a delta patch (ThigPark FUOTA, <a href="https://www.actility.com/iot-device-firmware-update-over-the-air/" rel="nofollow noreferrer">https://www.actility.com/iot-device-firmware-update-over-the-air/</a>)</strong>, i.e. compress the new FW by sending only updates. This is actually very complex because even small patches can change pointers all over in the code... but ThingPark FUOTA does a good job at this and will typically deflate your new Fw by ~85-90%. You can create upgrade campaigns and follow progress in terms of % of devices upgraded. It automatically stops when a given success rate (e.g. 95%) is reached, and then you can restart campaigns for only the failed devices, or use other methods (e.g. on site visits and BLE) for the devices that are unreachable.</p> <p>The reliable multicast part is a LoRa Alliance standard (supported by ThingPark RMC), but the delta patch isn't, so you need support in your firmware for this, but the good news is that it is available for free if you use FUOTA and there is an optimized implementation for STM MCUs (for other ports you can ask Actility). You can find the documentation and pointer to the client side GIT here: <a href="https://www.actility.com/thingpark-documentation-portal/" rel="nofollow noreferrer">https://www.actility.com/thingpark-documentation-portal/</a></p>
|lorawan|thingpark|
Firmware update over a LoRaWAN network
5927
<p>We are planning to connect several thousands of LoRaWAN connected water meters. The expected battery life time is 8+ years. Our concern is that meter suppliers are releasing new firmware version including bug fixes quite often (~ in every 6 month) so we cannot afford not updating the firmware of our devices for a period of 8 years. Is there any way to update device's firmware over a LoRaWAN network? We are operating a ThingPark network server.</p>
2021-09-14T06:32:17.790
<p>Actually even in OTA (using Join) <strong>the LoRaWAN spec separates the network session key</strong> (used by the network server to verify checksums and potentially de-ambiguate colliding short DevAddr addresses into their unique devEUIs), <strong>and the payload encrypting session key</strong> (AppSKey). It is one of its key innovations compared to other MAC layers like 802.15.4.</p> <p>The trick is to use a HSM (hardware security module) which will have access to the device's root key (AppKey), and derive the NwkSKey and AppSkey (joining process). <strong>The HSM will pass the NwkSkey to the network server in clear, and will pass the AppSkey encrypted</strong> (using a key encryption key previously shared with the application server). The network server therefore has no access to the payload information, is passes the payload as-is (encrypted by device at the source), together with the encrypted AppSkey, to the Application Server. The AS first decrypts the AppSkey, then the payload using AppSkey.</p> <p>A common misconception is that the HSM must be at the end customer premises. It is not the case, <strong>HSMs are designed to be secure in a hostile environment</strong>, i.e. the HSM in the cloud will not reveal its keys unless a pair of smart cards are presented to it, and any attempt to get into the hardware will destroy the keys. Therefore <strong>you can use hosted HSMs, as long as the smart cards are kept by trusted party</strong>.</p> <p>This secure framework is available on your ThingPark platform, either locally by taking the HSM option, or by using the separate ThingPark Activation platform (<a href="https://www.actility.com/iot-device-activation/" rel="nofollow noreferrer">https://www.actility.com/iot-device-activation/</a>), which acts as a secure join server and can be used in combination with any network server which supports the standard LoRaWAN back-end interface.</p> <p>You can use these solutions either with AppKeys provisioned by your device vendor into the ThingPark platform HSM, or using preconfigured Secure elements for your devices. The ThingPark HSM hosts secure key derivation sostware from leading SE vendors, which can access the AppKey directly from the SE serial number, so there is no need to provision any key in the HSM.</p> <p>Once the device root key is provisioned in ThingPark Activation Platform, it can never be accessed, you can only transfer it's ownership by means of a one-time activation token (provided, the first time, as part of the standard LoRaWAN QR code on recent LoRaWAN devices).</p>
|security|lorawan|thingpark|thingpark-activation|
LoRaWAN end-to-end security with Over The Air Activation
5928
<p>We are planning to connect several thousands of door opening and other home security sensors to a public LoRaWAN network country-wide, but our concern is, that in theory our public LoRaWAN network provider can decode the devices' messages. We may apply ABP activation (Activation By Personalization) so that we don't share the AppSKey with the public service provider, but it would result in a very complicated provisioning procedure. Is there any way to set up end-to-end security with ThingPark network server even in case of Over The Air Activation?</p>
2021-09-14T06:49:48.427
<p>If you use only GPS geolocation or a local BLE location solver, then a cloud service is not required. However <strong>if you want to benefit from assisted-GPS, or WiFi geolocation, then the ThingPark Location Engine (cloud based) is required</strong>.</p> <p>The main benefit of Assisted-GPS is that the GPS chip will not need to wait to have acquired the full satellite information (which requires to have a good signal as this information is transmitted using modulation that requires good SNR): <strong>you will get a much faster fix from cold-start situation with assisted GPS (typically &lt;10s versus over a minute)</strong>, this is particularly noticeable if your application requires indoor-outdoor tracking, e.g. people tracking who get i and out of buildings. Shorter fix time means lower power, by an order of magnitude. This fix also has lower accuracy than a full GPs fix, because GPs does local avaraging before sending the location via LoRaWAN, which is not possible with A-GPS (so you get a single fix with AGPS). Assisted GPS is the only option if you use the LR1110 chip which is not a full GPS. All Abeeway trackers have a full GPS chip, which is used first in AGPS mode to get a shorter fix time, and then switch to full GPS when all satellite data is available so you get better accuracy if/when needed.</p> <p><strong>WiFi geolocation</strong> is very useful of course for indoor location, but also in urban area where it can be used typically in over 80% of the cases and also consumes a lot less power than GPS. Abeeway trackers can also use WiFi positioning, and this requires access to a cloud database (via ThingPark location).</p> <p>The bottomline is that <strong>cloud services from ThingPark Location make Abeeway trackers much lower power and increase battery life</strong>, and also makes GPS location faster and more robust. Abeeway has a patent called &quot;LP-GPS&quot; with further enhances AGPS by solving independently for time leveraging LPWAN synchronicity, further reducing the fix time.</p>
|lorawan|thingpark|thingpark-location|
Location Solver with LoRaWAN trackers
5929
<p>We use <a href="https://www.abeeway.com/compact-tracker/" rel="nofollow noreferrer">Abeeway Compact Trackers</a> connected via a ThingPark powered LoRaWAN network to track pallets. Our Application Server receives and decodes messages and stores the location coordinates in a DB so that the App Server can visualise the location history on request.</p> <p>What would be the benefit of using a cloud-based location solver (e.g.: ThingPark X Location Engine) with this solution? Would that increase the location accuracy? Wouldn't it just add unnecessary complications to the platform?</p>
2021-09-16T07:33:43.247
<p>The Seedstudio <a href="https://wiki.seeedstudio.com/Grove-16-bit-ADC-ADS1115/" rel="nofollow noreferrer">doc</a> for the part says it has 4 channels so you should be able to connect up to 4 analogue sensors to each ADS1115 device.</p> <p>The ADS1115 devices can also be configured with 4 different i2c addresses which means you can connect up to 4 of them to a single i2c bus, which would mean up to 16 analogue sensors in total to a Pi (using the default single i2c bus).</p>
|raspberry-pi|sensors|
4-Channel 16-Bit ADC for Raspberry Pi (ADS1115) - Can I connect two analog sensors?
5934
<p>I have a RP4 and thinking about buying EC and PH sensors from <code>Grove</code>. I've learned that RP4 doesn't have an analog input so I'm thinking about connecting it through <code>ADS1115</code> from <code>Grove</code>. I'm not sure about the connections, so I would like to know if for two sensor will need two ADS1115, or can I use one for both sensors in a same time? Also if I need two, it is possible to connect one on the top of the next?</p>
2021-09-23T10:17:55.927
<p>Hi you might be interested in this Olivier Seller from Semtech Network Capacity with LoRaWAN From thier modelling a NbTrans of 3 is optimal</p> <p><a href="https://www.youtube.com/watch?v=VmYuItA6q4I&amp;list=RDCMUCv85CXnZUXEKnlZpQapTAwQ&amp;start_radio=1&amp;rv=VmYuItA6q4I&amp;t=450" rel="nofollow noreferrer">https://www.youtube.com/watch?v=VmYuItA6q4I&amp;list=RDCMUCv85CXnZUXEKnlZpQapTAwQ&amp;start_radio=1&amp;rv=VmYuItA6q4I&amp;t=450</a></p>
|lora|lorawan|thingpark|
The impact of LoRaWAN repeated transmissions
5956
<p>The LoRaWAN spec defines the <em>LinkADRReq</em> MAC command with a field (<em>NbTrans</em>) specifying the number of requested repeated transmissions of every frame. Actility claims that their ADRv3 algorythm uses that field to improve the packet error rate by requesting every frame to be transmitted multiple times instead of just increasing the Spreading Factor.</p> <p>I have several concerns about that approach:</p> <ul> <li>What is the impact of repeated transmissions on the capacity of the LoRaWAN Network?</li> <li>What is the impact of repeated transmissions on the battery life time?</li> <li>Why is a repeated SF9 transmission better than a simple SF10 transmission?</li> </ul>
2021-09-27T11:24:21.567
<p>I'm not sure how, but the devices recently started working as expected. If others run into the same issue, I suggest updating your UDM (or whatever router you use) to the latest software version (I'm running 7.0.23) and making sure the washer/dryer is also up to date. Before the issue resolved itself, I took to unplugging the device and plugging it back in whenever it'd stop connecting, in order to force a soft reset.</p> <p>Resetting the network settings of the machine <a href="https://www.samsung.com/us/support/answer/ANS00087882/" rel="nofollow noreferrer">(see here for instructions)</a> and then connecting it to SmartThings again may also help.</p> <p>These are my Wi-Fi network settings:</p> <p><a href="https://i.stack.imgur.com/ZcVpx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZcVpx.png" alt="enter image description here" /></a></p>
|networking|samsung-smartthings|mobile-applications|
Samsung SmartThings washer and dryer unable to connect to the app
5964
<p>For the past few weeks I've been unable to use my Samsung SmartThings washer and dryer via the app. I use the notification feature to keep track of completed loads and sometimes use the app to start the machines or delay their runs.</p> <p>Ever since I switched to a Unifi Dream Machine to run the devices, I've been struggling to connect to them and use them remotely. Every time I run the set-up process, they will stay connected for a few hours at a time and then irreparably go offline. Only plugging them out and in again temporarily fixes the issue.</p> <img src="https://i.stack.imgur.com/9zqVA.jpg" width="300"> <p>Here's what I've tried:</p> <ul> <li>Connecting the devices to a dedicated IoT VLAN (isolated Wi-Fi network)</li> <li>Punching the necessary holes in the firewall according to <a href="https://docs.google.com/spreadsheets/d/1m-ghwm_1nR7T7JeI7ACe-U0883qj6i9WGKN1hYu-Ao8/edit#gid=0" rel="nofollow noreferrer">this guide</a> (rules 2024, 2025)</li> <li>Resetting the devices' network settings <a href="https://www.samsung.com/us/support/answer/ANS00087882/#:%7E:text=Reset%20your%20washing%20machine,all%20it%20takes%20to%20reset." rel="nofollow noreferrer">with the guide provided by Samsung</a></li> <li>Researching the Unifi forums and tweaking all settings that could affect connectivity negatively (disabling 5GHz Wi-Fi, disabling U-APSD, enabling/disabling router features that help or hinder connectivity</li> <li>Giving the devices static IP addresses</li> <li>Uninstalling and reinstalling the iPhone app, as well as running the app on a different Apple device to see if it had to do with the iPhone itself</li> <li>Deleting my Samsung account</li> <li>Unplugging each of the devices manually and re-plugging them (which only fixes the connectivity issue temporarily)</li> </ul> <p>Nothing so far has worked. I plan to contact Samsung support soon but I wonder if anyone else has run into this before and whether they've been able to solve it. It's a minor issue as the devices still work manually but frustrating nonetheless as it's part of the reason why I bought these devices in particular.</p> <p>Here are the model names:</p> <ul> <li>Washer: Samsung WW90T636ALH Autodose</li> <li>Dryer: Samsung DV90T5240AW</li> <li>SmartThings iOS App: 1.6.70-549</li> <li>UDM: Dream Machine (EU Version), Unifi OS 1.10.0, Unifi Network 6.4.54</li> <li>iPhone XS Max, running iOS 15.</li> </ul>
2021-10-06T09:16:34.073
<p>LoRaWAN's ADR has a relative long convergence time, because the network server needs to collect data (SNR, packet error rate, etc.) from several uplink messages before it could calculate the ideal data rate and packet repetition parameters. For example: if a device sends UL messages in every 2 min and the NS needs 10 UL messages to calculate the packet error rate and the average SNR value, it would result in 20 min convergence time. If the NS calculates parameters based on a sliding window of the last 10 messages, this could be bit shorter, e.g.: ~10 min.</p> <p>If the link budget is changing on the scale of the convergence time, ADR won't bring any benefit and it mustn't be used. The proper solution to this challenge depends on the actual use case.</p> <p><strong>PARKING SENSORS</strong><br /> A possible solution to manage the changing link budget of parking sensors could be the following:</p> <ul> <li>When the sensor detects that a car started parking on top of it, it suspends ADR and sends immediately a few (2..5) repeated UL messages (with the same FCount number) using a low data rate so that the backend receives at least one of them. This way the backend will be able to detect that the parking lot got occupied even in case of poor radio conditions.</li> <li>When the sensor detects that the car left the parking lot, it resums ADR with the same parameters it was suspended with.</li> </ul> <p><strong>MOVING SENSORS (e.g.: Tracking Sensors)</strong><br /> I case of moving devices, (e.g.: asset trackers) there is no obvious way to predict the actual link budget. In such environment the tracker must use static transmission parameters (e.g.: always the same data rate and the same num. of retransmissions) and the data rate should be so slow that UL messages can be decoded comming from all area the tracker could show up.</p> <p><strong>IMPACT ON NETWORK CAPACITY</strong><br /> It is very important to notice, that forcing hundreds of frequently talking tracker devices using always the same low data rate at a certain area (e.g.: in the area of a factory) will generate high congestion in the network and increase the packet error rate significantly.</p> <ul> <li>The solution to this challenge is using randomly selected low datarates. E.g.: instead of using a fixed SF11 data rate, the tracker would randomly select one from [SF10, SF11, SF12] data rates. This lowers the packet error rate because there won't be any collisions between different data rates since they use orthogonal modulations.</li> <li>The above mentioned solution can be further improved by applying double transmissions so that the 1st transmission is sent with a randomly chosen high data rate [SF7, SF8] and the 2nd transmission is sent with a randomly chosen low data rate [SF11, SF12]. This helps when the tracker is at a well covered area so that the 1st transmission is successful, but the 2nd UL message is lost due to congestion caused by the longer time on the air.</li> </ul> <p><strong>WHEN SHALL A MOVING OBJECT SWITCH BACK TO ADR?</strong><br /> In case a moving sensor has a built-in accelerometer and can detect that motion has stopped, it may decide to use ADR again. Defining the &quot;motion stopped&quot; event can be done based on a time interval that the device should wait for without motion. When ADR starts again, the initial data rate should be the same that the device would start ADR with at boot time (even.g.:SF12).</p>
|lora|lorawan|thingpark|thingpark-location|
What are the datarate and ADR best practices for moving objects
5974
<p>For static objects, LoRaWAN has a very neat 'Adaptive Datarate (ADR)' feature that is key to the scalability of the protocol, it allows the network server to select the fastest uplink datarate compatible with target packet error rate (to conserve energy and minimize collisions), but also to control power and repeat (channel diversity). A lot of the value add of LoRaWAN network servers is here.</p> <p>However, it only works for static objects as this optimization depends on a stable radio channel. For a moving object (or one with unstable radio channel like a parking sensor when car is parked), what are the best practices to select uplink datarates, power and repeat ? When the motion stops, what should be the initial datarate, power &amp; repeat settings ?</p>
2021-10-09T20:48:44.340
<p>Via bluetooth would be one way.<br /> You just need to buy a bluetooth adapter so that you can send the phone output to the amplifier via bluetooth (which I assume it currently does not have.)<br /> There are many on the market. Eg. <a href="https://rads.stackoverflow.com/amzn/click/com/B086VZQG55" rel="nofollow noreferrer" rel="nofollow noreferrer">https://www.amazon.com/dp/B086VZQG55/ref=cm_sw_em_r_mt_dp_VJGK0VRDQYVXA6GSHQR7?_encoding=UTF8&amp;psc=1</a><br /> Now, the issue will be that you'll have to have the phone app actually on and doing the work of downloading the song bytes and sending out bluetooth. You cant just 'cast' it to the amplifier like you could with chromecast.<br /> If you have to use chromecast with your beloved amp, you may have to find an HDMI chromecast and then something like this <a href="https://rads.stackoverflow.com/amzn/click/com/B084RN22MW" rel="nofollow noreferrer" rel="nofollow noreferrer">https://www.amazon.com/dp/B084RN22MW/ref=cm_sw_em_r_mt_dp_KA6H54059MFRAKE6PK4R?_encoding=UTF8&amp;psc=1</a> to extract the audio out and feed it to your amplifier. (I haven't tried this.)<br /> There are of course, other amplifiers with chromecast built in...<br /> Wish you all the best !</p>
|streaming|
Is there anyway to stream music from an unsupported streaming service to a DLNA enabled amp?
5986
<p>I have an amplifier that supports DLNA streaming. DLNA is not actually supported by the streaming services I use (amazon music, idagio).</p> <p>There are applications out there that are supposed to bridge the gap between the phone &amp; DLNA supported device, such as BubbleUPnP &amp; mconnect.</p> <p>However their support is also frustratingly limited. For example BubbleUPnP does support streaming from TIDAL &amp; Qobuz but that's it.</p> <p>I am going to give up DLNA solution and move on to something like Chromecast or a dedicated streamer.</p> <p>However I just want to make sure, is there a way I can stream anything (in an adhoc way) from my phone to my amp?</p>
2021-10-11T12:12:02.963
<p>Indeed, having a Gateway-LNS backhaul with optimized signaling overhead is key for OPEX saving in case of cellular backhaul. It is even essential for backhaul connectivity over satellite.</p> <p>Actility's ThingPark LRR (LRR stands for Long Range Relay, which is the name of the packet forwarder in the ThingPark platform) has been designed to optimize GW-NS backhaul traffic. Here are the main related features:</p> <ul> <li><strong>Gateway filtering of uplink frames</strong> by NwkID, thus forwarding to NS only frames from whitelisted NwkID/NetIDs (for home devices or roaming partners): field feedback from a tier-1 Telecom Operator in France shows 80% reduction of GW-NS traffic thanks to this feature.</li> <li><strong>Use of binary encoding instead of text-based message format</strong> (such as JSON for Semtech packet forwarder / Basic Station) --&gt; This binary encoding is far more efficient, from compactness standpoint. It is the same reason why the LoRa Alliance has already disqualified text-based message formats (e.g. JSON) from the candidate IDL message formats for the ongoing standardization of the GW-NS protocol.</li> <li>Use of <strong>grouped acknowledgment</strong>, with IEC-104 protocol.</li> <li>Fully-<strong>configurable reporting periodicities</strong> for the different RF/WAN/System statistics, adaptable for each backhaul type.</li> </ul> <p>For sake of minimizing the backhaul overhead for satellite connections, with optimized settings of the keep alive periodicity and other application-specific timers - we measured a monthly house-keeping traffic reduced to 50 MB/month (including secure IPSec tunneling overhead, but excluding LoRaWAN traffic). Combining the compact binary encoding + NwkID filtering to this optimized house-keeping overhead should yield less than 400MB of monthly volume, but the exact volume of course depends on the LoRaWAN traffic volume.</p> <p>Expect a 30x reduction compared to GW to LNS backhaul protocols using JSON or similar text format.</p>
|lorawan|thingpark|
LoRaWAN backhaul overheads over satellite or cellular
5989
<p>LoRaWAN is optimized for the constrained LoRa physical layer, however the gateways add their own overheads when relaying LoRaWAN frames to/from the network servers, and there is also trafic related to the operations and maintenance of the gateway.</p> <p>What kind of overheads can we expect per LoRaWAN packet (i.e. on top of the LoRaWAN over the air frame size), and also how much monthly trafic is related to maintenance of the gateway ? Is this tunable for constrained/expensive backhaul like satellite or cellular ?</p>
2021-10-13T15:01:19.900
<p>There’s no shortage of options, though they may have different advantages or drawbacks.</p> <p>The two main things to consider are how the device will connect to the Internet, and power.</p> <p>To reach the Internet, you have at least the following options:</p> <ul> <li><p>WiFi. This is ubiquitous and cheap, nearly everybody has WiFi. You’d need a device that can use it, and the details of your friends WiFi (SSID and key, usually). The most common chip to do that os the ESP32 (though there are other options), and there are plenty of boards and even full devices with a button that can do that, like <a href="https://blog.aprbrother.com/product/abutton-v3-and-battery-charger" rel="nofollow noreferrer">APR Brother’s AButton</a> or the <a href="https://shop.m5stack.com/collections/stick-series/products/m5stickc-plus-esp32-pico-mini-iot-development-kit?variant=35275856609444" rel="nofollow noreferrer">M5 StickC Plus</a>.</p> <p>One thing to note, though, is that an ESP32 connected to WiFi will draw quite a bit of current and won’t run long on battery. It needs to use deep sleep and wake-on-pin to achieve decent battery life, but be aware that many devices and boards draw a lot more than their specs say because they only count the ESP32’s deep sleep current and forget the LDO or other chips. Most boards and devices will draw hundreds of microamps (or more), a good one will draw less than 20 (like the <a href="https://www.tinypico.com/" rel="nofollow noreferrer">TinyPICO</a>). That can dramatically change the battery life of the device.</p> <p>There’s even the <a href="https://www.tindie.com/products/kdcircuits/trigboard-ultra-low-power-esp32-iot-platform/" rel="nofollow noreferrer">TrigBoard</a> which uses an external chip to actually completely power off the ESP32 and only wake on pin, drawing 1.5 microamps during sleep!</p> </li> <li><p>Other short-distance wireless technologies, such as BLE, Zigbee, Thread, etc. These can achieve very low currents, but you do indeed need some sort of gateway. If your friends already have a Zigbee network at home, that could be an option. There are lots of Zigbee wireless switches out there, and you can usually make them call an URL somehow (e.g. via IFTTT). It’s the bridge which determines what happens on button press, so you would need to configure your friend’s bridge.</p> <p>Philips even had the batteryless Hue Tap at some point (it uses the mechanical power of the actual button press to have enough energy to send the message via Zigbee) but I’m not sure it’s still available (I should have bought more back when they were available!). There may be others.</p> <p>Note that a Zigbee switch/button + a bridge will be a less than $100.</p> </li> <li><p>LoRaWAN. You need to be within coverage of a LoRaWAN gateway, like The Things Network (TTN). Coverage can go for miles outdoors, but is a lot more difficult to predict indoors. In some regions regulatory constraints make it difficult to use confirmed packets, so you could end up with the device in “fire and forget” mode, sending packets but having no idea if it got to its destination. This may or maybe not be an issue for you.</p> </li> <li><p>Cellular (LTE-M or NB-IoT). Again, you need coverage, and you’ll have to pay for traffic (though this should be quite cheap) and possibly a small monthly fee, depending on the country and carrier. But this will work anywhere there’s coverage, and no need to configure your friends’ WiFi or anything. Battery life may be an issue.</p> </li> </ul> <p>Until here I have mostly considered that you want to operate the device on battery with no wires. If wires are not an issue, you could simply plug an USB adapter into the device (and then an <a href="https://shop.m5stack.com/products/atom-lite-esp32-development-kit?variant=32259605200986" rel="nofollow noreferrer">M5 Atom Lite</a> is probably the cheapest option), or even use PoE.</p>
|rest-api|
How to call an API using a smart button?
5993
<p>I want to do a simple thing:</p> <p>Give away buttons to my friends that they can click randomly and it simply calls an API that I have implemented.</p> <p>I cannot wrap my head around what should I do and what is the cheapest option. So far I have found <a href="https://flic.io/" rel="nofollow noreferrer">Flic</a> button but it needs a hub and the price would be above $100 to do this simple thing.</p> <p>Any stand alone button that I can configure to do this simple thing?</p>
2021-10-14T20:12:12.643
<p>There are quite a number of possible interfaces for sensors and other peripherals. Some exist on nearly all platforms (possibly with a few differences), others are less common.</p> <ul> <li><p>UART is probably the simplest. It also know as “serial port” or “RS232” (though this is nearly universally an abuse of language). It involves at the bare minimum one wire in each direction (TXD from one device connected to RXD of the other and vice versa, though sometimes peripherals will have pins labelled with the corresponding pin on the MCU). You’ll also need a reference ground, and there’s often a power line as well.</p> <p>UART is an asynchronous serial port. Data is sent as characters, which are framed with a start bit and a stop bit. Common speeds are 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 bits per second, though higher speeds can be found.</p> <p>Some devices will also have flow control pins (RTS/CTS and the like) but this is becoming quite rare.</p> <p>Either device can send data at any time.</p> <p>One important issue here (it may also be present on other interfaces, but is more often an issue for UART) is that not everybody uses the same voltages. Most common are 5V and 3.3V, but you can probably still find a few others. You may need voltage level adapters (you don’t want to send 5V to a 3.3V device, and vice versa, though. It for the same reasons). Some devices are “tolerant”, others not at all.</p> </li> <li><p>SPI is very common in the microcontroller world. It’s a synchronous point to point serial interface. Like UART, there’s one wire in each direction (MOSI and MISO, master out to slave in and vice versa), but there’s also a separate wire for the clock (SCLK), which allows speeds in hundreds of kilobits or megabits per second. There’s also often a “chip select” pin (CS) which allows several peripherals to share the same SPI interface on the MCU (one at a time, though): they will share SCLK, MOSI and MISO, but will each have a different CS on the MCU. One device (the MCU) is the master, the other is the slave.</p> <p>As usual, there’s usually also a common ground pin, and often a power supply pin.</p> <p>There are high speed versions of SPI using more pins like QSPI.</p> </li> <li><p>I2C is a bus, on which you can have multiple devices. There are only two “signal” wires (taken loosely), SDA, which is the actual data, and SCL, which is the clock. As usual, often complemented by ground and power.</p> <p>There’s one master (the MCU) and one or more slaves (peripherals). Each slave has an address, and all commands from the master include the address of the slave it wants to talk to. Some devices have a fixed address, others can be configured either via pins (you’ll usually have a limited choice of 2, 4 or 8 different addresses) or more rarely by software. Some devices have a single fixed address but can be ordered with different addresses.</p> </li> <li><p>Digital pins are used for peripherals which deliver or need a simple on/off signal.</p> </li> <li><p>Analog pins are used for devices which deliver or need a variable voltage (e.g. voltage is proportional to temperature or distance). They are connected to an ADC (Analog to Digital Converter, for inputs) or DAC (I’ll let you guess, for outputs), which convert a variable voltage to/from a digital value.</p> </li> <li><p>CSI is a special interface for cameras. It is available on many ARM-based SOCs like the RPi Broadcom chip or other ARM-based chips (Allwinner, Rockchip, etc.). Not common on lower-power MCUs like the ESP32.</p> </li> <li><p>Likewise, DSI is for high resolution displays, and the same kind of limits apply. You can also find LVDS, HDMI, DP, eDP…</p> </li> </ul> <p>Most MCUs, including the ESP32 on the FiPy, will include several UART, SPI, I2C, ADC and/or DAC ports, which can often be assigned to different pins. There are sometimes limits on which pins can do what, and of course a given pin can only be used for one function at a time. Different chips have different numbers of ports (for instance they may have 1, 2 or 3 UARTs), and have different numbers of available pins.</p> <p>On a board like the FiPy, many pins of the ESP32 are already used to connect the various peripherals on the board itself (LoRa/SigFox modem, cellular modem, LED, flash). The expansion board uses a few more (for the SD card, the PIC which acts as a serial/USB converter…). The final choice is often quite limited.</p> <p>Many types of devices exist in many different forms with varying interfaces. Which ones to use will depend on the combination of peripherals you need and what interfaces they are available with.</p> <p>You’ll often find devices using “standard” interface ports like Grove (from Seeedstudio, also many M5stack devices and a few others), Qwiiic/Stemma QT (Sparkfun/Adafruit) or UEXT (Olimex). The first one at least is tricky, because it used the same physical interface, but may have different logical/electrical interfaces, either UART, SPI, I2C, digital or analog. I think the same applies to Qwiic/Stemma QT, though I’m not sure. They may also have different voltages (3.3V or 5V), though many devices have the necessary logic to support both. UEXT carries multiple interfaces on the same port, but they use different pins.</p>
|sensors|
Guide to connecting generic peripherals
5996
<p>I have some development boards like the <a href="https://pycom.io/product/fipy/" rel="nofollow noreferrer">FiPy</a> with <a href="https://pycom.io/product/expansion-board-3-0/" rel="nofollow noreferrer">Expansion Board</a>, mainly to experiment with programming on the processor, but it would be interesting to connect some peripherals (by wire, not wireless) like cameras and sensors for motion, temperature, sound, etc. Is there a guide to generic peripherals that would help me understand what kind of wired connections are possible on these various boards? It's fairly easy to get info about a Raspberry Pi or an Arduino, but I'm not using those boards. I'm a total newbie to IoT, though I've been programming on ordinary desktops for many decades. How can I learn the basics of wiring generic peripherals to an IoT dev board?</p>
2021-10-15T11:01:25.713
<p>LoRaWAN end devices have to cope with 2 different types of network connectivity issues:</p> <ol> <li>The device temporarily loses <strong>network connectivity</strong>.<br /> This can happen in the following example cases: <ul> <li>There is no network coverage at the current location of a moving device</li> <li>There is a temporary network outage at the area of a fixed device. (e.g.: the LoRaWAN Gateway that is supposed to serve the device lost backhaul connectivity.)</li> </ul> </li> <li>The network server loses the <strong>session context</strong> (<em>AppSkey</em>, <em>NwkSkey</em>) of the device.<br /> This can happen if <ul> <li>the network server had a non-recoverable db failure or a new server is taking over the role of an old one without providing session continuity.</li> <li>or the owner simply deleted the device from the network server and provisioned it again.</li> </ul> </li> </ol> <h3>Lost network connectivity</h3> <p>The device has 2 ways to detect that the network connectivity is temporarily lost:</p> <ul> <li><strong>In case ADR is on:</strong> It sets the ADRACKReq bit of its uplink frames to 1 after ADR_ACK_LIMIT uplinks not followed by downlink that tells the network that it expects a downlink frame within the next ADR_ACK_DELAY frames.</li> <li><strong>In any cases:</strong> The end device can send a <em>LinkCheckRequest</em> MAC command to the network that must be answered by the Network by a <em>LinkCheckAns</em> MAC command.</li> </ul> <p>If the device detects (in any way) that the network is not available, it should first try sending uplink messages (e.g.: <em>LinkCheckReq</em> messages) with the lowest possible data rate (that will increase the link budget to the maximum), and if it still does not fix the connectivity problem, the device should exponentially back off consecutive uplink messages. In practice, end devices are rather sending new JoinRequest messages than basic UL messages. The next chapter explains why.</p> <h3>Lost session context</h3> <p>In a LoRaWAN 1.0 network, if the network server lost the session context, the only way to reconnect a device is to make it send a new join request.<br /> However, the device has no means to check if its network connectivity problem is due to temporary network outage or because of the lost session. (Both result in no downlink messages.) The solution to this issue is that in case of any long-term connectivity problem (that cannot be fixed by lowering the data rate), the device starts sending new Join Request messages that will make the Network Server start a new session context and reset the frame counter too.</p> <p>This &quot;lost session&quot; problem is managed by LoRaWAN 1.1 networks in a much better way. LoRaWAN 1.1 introduces a new message type: <em>Rejoin-Request</em>. End devices are regularly sending <em>Rejoin-Request</em> Type 1 messages, that offers the Network Server an option to create a new device session by answering them by a Join Accept message. However, in case the Network Server still has a valid session, it will silently drop these messages. This solution prevents triggering unnecessary reset of valid device sessions in case of connectivity issues and increases the level of security.</p>
|lora|lorawan|thingpark|thingpark-activation|
LoRaWAN device leaving a network and then coming back... what Join behavior to expect?
5998
<p>For smart-city or industrial campus type of projects, there are devices that leave the network for e.g. 2 days (worker leaving on a week-end), and then come back... but they might remain disconnected for a while until the next Re-join.</p> <p>The LoRa alliance has a best practice that mandates exponential back-off of joins, but it is still a bit vague on detection of isolation (which triggers Re-joins) and this question is to ask what are the best practices on the field, pros/cons of rejoining strategies, and what is effectively tested as part of LoRaWAN certification.</p>
2021-10-20T11:52:25.810
<p>Yes, without TLS the CONNECT packet is sent in the clear so all of it's content can be seen.</p> <p>A full breakdown of how to decode the CONNECT packet can be found <a href="http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718028" rel="nofollow noreferrer">here</a></p>
|mqtt|security|tls|
Can traffic spy see username and password of MQTT client
6016
<p>Can Traffic spy see the username and password of client send to broker when broker don't use TLS ?</p>
2021-10-26T00:57:43.140
<p>There's some costly bluetooth sniffer that will allow you to do the capture of BLE including key exchanges while pairing and all the messages you might need afterward.</p> <p>You can find some cheaper BLE sniffer that will do part of what the bigger one can do, it will be able to capture BLE data and you will then be able to provide it with your keys allowing it to decipher the messages. In some cases they can also do the key pairing sniffing but they are way less effective.</p> <p>But even then, assuming you are able to get some keys and see what's exchanged, it will be hard for you to reverse engineer the protocol, unless it's standard HID codes shared on the proper BLE service. That's possible but very unlikely for &quot;Smart&quot; devices. I would expect for most of the product a non standard service with custom commands.</p> <p>So I would say that if you want to do a product that will interface with such devices, the best you can do is to contact the product manufacturer and ask for a datasheet so that you can manufacture your own product based on that.</p> <p>However if that's for a DIY project I'm not sure they will provide the datasheet to you unless you have a very good reason to get access to it or a promising probable future business opportunity. That can be for instance developing yet another IOT protocol to rule them all, or integrating their device to an existing IOT stack.</p>
|smart-home|
Is there a generic way to replace BLE remote with your own BLE controller?
6029
<p>Many smart appliance can only be controlled by the orinigal BLE remote. To control such appliance by your own smart home system, there need to be a way to replace the original BLE remote with something that is compatible with your smart home system.</p> <p>It is easy to replace IR remote and capture the command code on air, but BLE remote and the appliance seems to have pre-shared keys, how to link to the appliance with your own BLE node such as ESP32 node and how to know the command formats? Is there some existing generic way to do such things?</p> <p><strong>Appendix</strong>:</p> <p>Examples:</p> <p>Example 1, turn on/off BLE TV or switch HDMI channel of BLE TV at some given condition (e.g. some specific person is dothing some specific thing).</p> <p>Example 2, some appliance (such as smart toilet) with builtin offline voice command recognition which is error prone, the idea is to use external camera and/or online speech recognition system and send BLE order to the appliance automatically on some condition.</p> <p>Note:</p> <p>Why not using appliance that is compatible with existing standard smart home system such as Alexa?</p> <p>Reason 1: many applicance doesn't support such way and may only support a system that is not compatible with your system.</p> <p>Reason 2: to protect privacy, one possibly better way is to build your own system with ESP32/fruit pies/PCs etc.</p>
2021-10-29T14:44:44.577
<p>There are several reasons that may cause a failed join procedure. The typical problems are the following: </p> <ol> <li>The network server does not receive the <em>Join Request</em> because there are no LoRaWAN Gateways in the nighbourhood, or the gateway that is supposed to forward the message has no backhaul connection.</li> <li>The network server receives the <em>Join Request</em> but silently ignores it because the device is provisioned with incorrect <em>DevEUI</em>, <em>AppEUI</em>/<em>JoinEUI</em> and <em>AppKey</em>.</li> <li>The network server receives the <em>Join Request</em> and answers it by a <em>Join Accept</em> message, but the device does not receive it because the downlink message is sent with wrong TX parameters (<em>Channel number</em>, <em>RX1/RX2 delay</em>, <em>Spreading Factor</em>, etc.)</li> </ol> <p>In the first two cases, you won't see any messages in the  <em>Wireless Logger</em> application however, in the 3rd case you will see both the <em>Join Request</em> and the <em>Join Accept</em>.</p> <p>If you can see the <em>Join Accept</em> message in <em>Wireless Logger</em> and your device keeps sending new <em>Join Requests</em>, it is most probably because the <em>Join Accept</em> is not sent with the TX parameters that are expected by your device. All TX parameters can be verified in <em>Wireless Logger</em>.</p> <p>The expected initial TX parameters may change device by device and that is why <em>ThingPark</em> introduced the concept of <em>device profiles</em>. When you provision your device it is important to select the right <em>device profile</em> that tells <em>ThingPark</em> what <em>channel</em>, <em>datarate</em>, <em>RX delay</em>, <em>DL data rate offset</em> should be used for sending the first downlink message which is obviously the Join Accept message. If your device does not have a pre-configured <em>device profile</em> on <em>ThingPark</em> yet, you can chose one of the <em>Generic device profiles</em>, that is compatible with your device.</p>
|lorawan|thingpark|
LoRaWAN device not receiving Join Accept
6034
<p>I have provisioned my LoRaWAN class A device using OTAA on the ThingPark Community platform. Now, it doesn't seem to receive a Join Accept message from the network as answer to the Join Request that is sent. What could be the issue here?</p>
2021-11-06T00:41:52.317
<p>I recently dug into the Shelly switches and installed my first. Most are UL certified, the 1 in particular.</p> <p>The most &quot;heavy duty&quot; of the Shelly switches only support up to a 16 amp load, so they need to be protected by a 15A breaker, and, therefore, can be installed on 14AWG wiring. Unfortunately, they will <em>not</em> take 12AWG wire (as I learned the hard way). You can, however, pigtail from #12 to #14 in the box where you're installing it (so long as there's a 15A breaker in there; if it's a 20A breaker, you're out of luck either way). On the bright side, you don't need 20A to protect lighting circuits, as you'd be hard pressed (especially if you're using LEDs) to get anywhere close to a 20A load for your whole house full of lights, and most houses don't have all lighting on one circuit.</p> <p>I'm not sure what the Sonoff &quot;DIY mode&quot; is (as mentioned in you comment), but I have mine connected to Home Assistant, not connected to the internet and have never installed the Shelly app on my phone, so they're pretty much stand alone. Once powered up, it exposes its config via a self-hosted web page where you can then configure it to use your home's WiFi, turn <em>on</em> internet access (mine was off by default), etc.</p> <p>In the config, you can set the switch to &quot;edge&quot; mode which effectively turns the Shelly &amp; the physical switch it's connected to into a 3-way pair. A toggle of either will toggle the lights. There are other modes, so if you want &quot;up&quot; = &quot;on&quot; on the physical switch, you can select the proper mode and you may have to toggle the physical switch to get the current light status and switch direction into sync before the switch will cause action on the lights it's attached to. I <em>think</em> this addresses your push/polling question.</p> <hr> <p>No, I'm not a Shelly sales rep. I spent more than a week reading up on them and found a YouTube channel with a guy who did a really nice job of explaining at a 1st grade level the differences between the different Shelly models and (in his linked blog) showed exactly how to wire each of the different relays, because Shelly's own documentation is <em>not</em> very clear. I'm just a happy user.</p> <hr> <p>Oh, one last thing. When you finalize your wiring, <em>make sure</em> that you don't have any bare copper sticking out of the device like that! That's just asking for a fire-starting arc to happen between the two hot wires. For the Shellys, you do <em>not</em> have to strip very much insulation off, and it looks like it's the same for the Sonoff. Snip the ends of the wires a bit to ensure the insulation butts up against the device housing.</p>
|ac-power|sonoff|
Any devices that do what the Sonoff Mini R2 does, but is UL rated?
6047
<p>I have 2 Sonoff Mini R2's installed as a part of some remodeling work I'm doing on my house:</p> <p><a href="https://i.stack.imgur.com/dDtSZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dDtSZ.jpg" alt="sonoff mini r2" /></a></p> <p>What I love about these devices is that they allow you to turn any dumb toggle switch (what Sonoff refers to in their doc as an &quot;SPDT switch&quot;). I like this for 2 reasons:</p> <ol> <li>My wife and I love vintage aesthetics and want to stay as true as we can to the original aesthetic of our home built in 1920, so using a regular toggle is truer to that aesthetic.</li> <li>It's easier to flip a toggle switch without looking at it (than a decora style switch) and you <em>know</em> from its tactile and audible feedback that it was successfully toggled.</li> </ol> <p>HOWEVER - I found out in my electrical inspection today that Sonoff devices are not UL rated/certified - and for me to pass the electrical inspection, I have to remove them.</p> <p>I know that there are smart switches out there that <em>mimmic</em> a &quot;toggle-style&quot; switch. They stick straight out and don't have the same tactile experience. Such a switch is what I will fall back to if I cannot find what I'm looking for.</p> <p>So is there a device like the Sonoff Mini R2 that:</p> <ul> <li>Is small enough to fit in a switch box</li> <li>Has an &quot;SPDT&quot; switch circuit</li> <li>Is UL rated/certified?</li> </ul> <p>Note, the one drawback of the Sonoff Mini R2 (aside from its lack of UL certification) is that it doesn't report (/&quot;push&quot;) when the SPDT switch is toggled, which forced me to implement a polling strategy to catch physical switch flip events and act on them for my automations.</p> <p>Incidentally, I can tell why these devices don't have a UL rating. I had a heck of a time connecting my 12 gauge wires to them without them popping out. The wires for my second device as threaded 12-gauge and that seemed nearly impossible to connect securely.</p>
2021-11-13T18:49:43.760
<p>That could be interference of signals in your wifi/zigbee network that builds up with time, when new devices added or some devices select the same channel.</p> <p>I also experienced problems connecting to Chromecast and ended up connecting the Chromecast to my router by wire using Cat5 networking cable. Moving to the wired connection improved reliability a lot, I don't even remember when I reset the Chromecast after that.</p> <p>There's a special power supply for Chromecast sold by Google that has RG-45 socket and provides not just power but ethernet via USB <a href="https://store.google.com/us/product/chromecast_ethernet_adapter_gen_2" rel="nofollow noreferrer">https://store.google.com/us/product/chromecast_ethernet_adapter_gen_2</a></p>
|wifi|hardware|chromecast|
Can a device like chromecast degrade over time?
6054
<p>I'm having trouble connecting to my chromecast in any apps. Sometimes it works fine and sometimes it just won't work. I can see that it is connected to my WiFi network and I've read the very helpful answers at <a href="https://iot.stackexchange.com/questions/2044/chromecast-doesnt-show-up">chromecast-doesnt-show-up.</a> After many resets and hours of fighting with my chromecast, I am wondering, would buying a new chromecast help my problems? It is a few years old, but I can't think what parts would degrade over time in a chromecast.</p>
2021-11-29T12:52:20.203
<p>We solved this by edit the Mosquitto config file to either add a new listener port 8883 and to use the WebSocket protocol for that port.</p> <p>From Stack Overflow: <a href="https://stackoverflow.com/a/32309525/12166187">Seting mosquitto broker to listen on two ports?</a></p> <p>It was a config problem. Thanks @hardillb for the helping and at @kalyanswaroop for the replies.</p>
|mqtt|raspberry-pi|azure|paho|
Make connection between react native & raspberry & MQTT
6068
<p>I am currently making an IoT App that I'm trying to connect to a Raspberry Pi using MQTT. I use the react_native_mqtt package. The problem I have is that it doesn't connect. What I'm trying to achieve is to receive data from the rasp and use that with react native. But the connection doesn't work. Any help is appreciated.</p> <blockquote> <p>Error: Object { &quot;errorCode&quot;: 7, &quot;errorMessage&quot;: &quot;AMQJS0007E Socket error:undefined.&quot;, &quot;invocationContext&quot;: undefined, }</p> </blockquote> <pre class="lang-js prettyprint-override"><code>import init from 'react_native_mqtt' import AsyncStorage from '@react-native-async-storage/async-storage' init({ size: 10000, storageBackend: AsyncStorage, defaultExpires: 1000 * 3600 * 24, enableCache: true, reconnect: true, sync : { } }); const host = '52.11.11.11' const port = '8883' const connectUrl = `mqtt://${host}:${port}` clientID = &quot;clientID-&quot; + parseInt(Math.random() * 100); export default class TestScreen extends Component { constructor(){ super(); this.onConnectionLost = this.onConnectionLost.bind(this) this.onConnect = this.onConnect.bind(this) const client = new Paho.MQTT.Client(host, Number(port), clientID); client.onConnectionLost = this.onConnectionLost; client.connect({ onSuccess: this.onConnect, useSSL: true, userName: 'admin', password: 'admin', onFailure: (e) =&gt; {console.log(&quot;here is the error&quot; , e); } }); this.state = { message: [''], client, messageToSend:'', isConnected: false, }; } onConnect = () =&gt; { // const { client } = this.state; console.log(&quot;Connected!!!!&quot;); //client.subscribe('hello/world'); this.setState({isConnected: true, error: ''}) }; </code></pre> <p><strong>Nodejs.test:</strong></p> <pre class="lang-js prettyprint-override"><code>const mqtt = require('mqtt') const host = '52.xx.xx.xx' const port = '1883' const clientId = `id_${Math.random().toString(16).slice(3)}` const connectUrl = `mqtt://${host}:${port}` const client = mqtt.connect(connectUrl, { clientId, clean: true, connectTimeout: 4000, username: 'xxx', password: 'xxx', reconnectPeriod: 1000, }) module.exports = client; const topic = 'EnergyMonitoring/energy' client.on('connect', () =&gt; { console.log('Connected') client.subscribe([topic], () =&gt; { console.log(`Subscribe to topic '${topic}'`) }) }) client.on('message', (topic, payload) =&gt; { console.log('Received Message :', topic, payload.toString()) }) app.listen(1883, ()=&gt;{ console.log(&quot;server is running&quot;) }) </code></pre>
2021-12-21T22:58:42.313
<p>In a distributed system like this, the key questions are where the 'intelligence' for the system will reside, how it will communicate with the peripherals, and what interface you need to configure &amp; monitor the system.</p> <p>Personally I think the Async Webserver plus Websocket technique is an overly complex solution to this problem; you could just run an ordinary non-async Web server on each ESP32, which takes in requests for data, and also accepts settings, for example if you request the Web page &quot;status.csv&quot; you get a comma-delimited list of values of your sensors, and &quot;control.htm?output1=1&amp;output2=0&quot; would set the two outputs accordingly.</p> <p>When it comes to communication between the sensor boxes, it is generally not a good idea to distribute the intelligence amongst them, as programming and debugging 5 or more inter-communicating systems can be really hard work; it is much easier to have a single coordinator that controls everything. This would preferably be a disk-based system, so you can log all the data for diagnostic purposes.</p> <p>You will presumably need a way of displaying &amp; changing the system status and nowadays that is generally a Web page, which could be served up by the management system. When running on a browser, it would use javascript AJAX calls to fetch the data from the peripherals, and generate a pretty display; I've used this technique in an <a href="https://iosoft.blog/oscilloscope-display-pi-pico/" rel="nofollow noreferrer">ESP32 oscilloscope project</a></p> <p>The key advantage of having a Web-based system is that you can point your Web browser at any of the ESP32 units, and get it its raw data - this is very useful if something has gone wrong, and you want to check if it is due to a fault with one of the remote units, or a bug in the management software.</p>
|wifi|esp32|web-sockets|
How to connect several sensor boxes (ESP32) via WIFI/webserver/...?
6087
<p>I'm intending to create some (like 5-10) boxes with sensors and/or relays inside using ESP32's.</p> <p>For connection to a laptop and mobile phone I found a tutorial at <a href="https://randomnerdtutorials.com/esp32-websocket-server-arduino/" rel="nofollow noreferrer">ESP32 WebSocket Server: Control Outputs (Arduino IDE)</a> which uses an async webserver with sockets.</p> <p>However, I wonder if I would use multiple boxes, how to solve this. I thought of one of the following 'solutions&quot;</p> <p>I want to have the boxes work together (e.g. to make a web page that I can set that e.g. when sensor X has value Y than on another box relay 1 should be on).</p> <ul> <li>Making each a webserver. But having 5-10 webservers seem hard to handle as I don't want to visit 10 web pages for each server on my laptop/mobile phone.</li> <li>Make one of them the webserver. But this seems strange as they are all more or less equal (they will have different sensors but that's not relevant for the webserver functionality).</li> <li>Create a separate webserver (on an ESP32), that does nothing except handling all data.</li> </ul> <p>I guess the second or third solution is best. Than my next question would be what is the best way to have the boxes communicate to each other. Can I for example have a websocket for the HTML page(s) on the laptop/mobile phone to the server and next to that use HTTP messages to communicate with all other boxes?</p> <p>I hope this questions is not too generic, I'm just a newbie to webservers/sockets.</p> <p>Note, I prefer to use my router as this is in the middle of the house and all my boxes will be within vicinity of it (more or less close).</p>
2021-12-22T19:19:19.753
<p>Direction detection is one of the selling points for UWB (Ultra Wide Band) and Bluetooth 5.0 when combined with multiple antenna arrays.</p> <p>This allows for AoA (Angle Of Arrival) to be calculated which will give you a relative direction to another device.</p> <p>But given the form factor of the a phone it only really allows for the antenna separation in a single plan which means angle direction is similarly constrained (left/right, not up/down).</p>
|sensors|mobile-applications|positioning|
How to detect the relative direction of two mobile devices?
6089
<p><strong>How to detect the relative direction of two mobile devices?</strong></p> <p>When a mobile device (i.e. a modern smartphone) is taken near to a second mobile device, it is possible to detect inter-device proximity distance using proximity sensors, UWB or even NFC and so on. Now, how to detect the directions of the first mobile device relative to the second mobile device? I mean, how to detect which of the directions among left, right, up, down, front &amp; back the first device is located of the second device? Any paper work reference would be appreciated.</p>
2021-12-24T08:48:55.223
<p>These systems use multiple antenna, not multiple distinct radios to compute angle of arrival based on time of arrival at each antenna.</p> <p>It's probably worth noting that these radios tend to be SDR (software defined radios) which detect signals by doing frequency analysis on a whole chuck of spectrum, rather than running to a specific frequency. This makes ToA and AoA calcs relatively easier than trying to sync a high rate time source across multiple radios</p>
|sensors|hardware|mobile-applications|uwb|
Does iPhone 11 device contain multiple UWB receivers?
6092
<p><strong>Does iPhone 11 device contain multiple UWB receivers?</strong></p> <p><a href="https://en.wikipedia.org/wiki/Angle_of_arrival" rel="nofollow noreferrer">Angle of Arrival</a> (AoA) is often required for many applications for UWB enabled devices. I wonder if modern UWB enabled devices i.e. iPhone 11 contain multiple UWB receivers to support AoA or not?</p>
2021-12-24T15:36:08.113
<p>Both the smart plug and your phone connect to a sever somewhere on the Internet (“in the cloud”).</p> <p>When you use your phone to control the plug, it sends the command to the server, which then sends it to the plug. And vice-versa for the plug status.</p>
|smart-plugs|
I’m puzzled: Why can I control my Nedis Wi-Fi Smartplug even from a different city?
6094
<p>I bought a set of Nedis SmartLife Wi-Fi electric sockets. I connected them to my home Wi-Fi network and installed the control app on my phone. To my great surprise I can turn the plugs on even from very far away (different city). What makes this possible since I thought these devices are operating in my home Wi-Fi network? How can it be possible to control them from outside the range of this WiFi?</p>
2021-12-26T18:40:47.237
<p>There are quite a few ways to achieve this.</p> <p>First, many DHCP servers will hand out the same IP to the same device, even if it has been switched off for a while (and most certainly if the current DHCP lease has not expired).</p> <p>You may want to make sure in the settings of your DHCP server (usually your router) that you have enough addresses in your pool, and possibly increase lease duration if it’s something you can change.</p> <p>Of your current DHCP server does not cooperate, you may want to switch to another device (though it needs to be permanently on and connected to the network).</p> <p>Of course, you could do static DHCP assignments if the DHCP server allows it.</p> <p>Otherwise you can use static IP addresses (make sure you take those addresses out of the DHCP pool of course).</p> <p>All this would help having the same IP.</p> <p>Alternatively, you could use names which resolve to the dynamic IP. There are several methods to do that, depending on the combination of devices.</p> <p>One option is to use mDNS / DNS-SD. You can advertise a name like <code>rpi.local</code> from the Pi and then use that name from other computers. You could use the <code>dns-sd</code> tool on the Pi to do so. Some distributions may actually already advertise the host name that way.</p> <p>There are also alternatives based on uPnP/SSDP, Windows/SMB, and probably a few others.</p>
|raspberry-pi|networking|wifi|ip-address|
Named URLs on Local Network
6097
<p>How can I access my IoT peripheral device (raspberry pi B3+) on my local network in a reliable way? I want to use WiFi not BLE. I want to protect against the device getting a different IP when it is powered off and on again.</p> <p>Is there a way to set a domain name for my device that only works locally? Otherwise, is setting a static IP the best option?</p>
2022-01-01T14:59:17.453
<p>I would recommending just getting a small normally open (NO) relay with 230V AC coil and then run your ESP32 Vcc (3.3V) to one relay contact and back from the other contact to a GPIO pin.</p> <p>Alternatively check out <a href="https://www.electroschematics.com/detector-module/" rel="nofollow noreferrer">AC main detector module</a> for schematics on how to do it with an optocoupler.</p>
|esp8266|esp32|
ESP32 or ESP8266 220v button as input
6106
<p>As per title I'm, looking a way to detect the press of a button powered at 220v ac through a gpio pin of the ESP32.</p> <p>The simplest solution found seems to be an octocoupler, but are there devices that support such a high voltage difference? What could be a connection scheme?</p>
2022-01-17T13:48:07.897
<p>Currently, in addition to Phillips hue, WiZ (Phillips wifi) &amp; Lifx (wifi) have this feature. All tuya-devices that are custom-flashed with tasmota also have this feature. Finally, all zigbee bulbs turn on with 100% brightness every time. However, only hubitat allows customization of this (using a hub-based driver), all other hubs make it so that it MUST come on when turned on. Some regular tuya (not flashed) lights also have this feature, but it will be a gamble.</p> <p>WiZ is the most customizable overall, where it allows to change color, CT, and brightness on startup. LifX allows &quot;power on&quot; &amp; &quot;last state&quot;. Both of these bulbs have a dual-click function, where rapidly flicking the switch 2x gets you a different color/ct/brightness/on-or-off.</p> <p>I hope this helped! Feel free to ask me more questions so that you can make the right choice.</p>
|smart-lights|
Which smart bulbs support configurable power on bahaviour?
6125
<p>I just learned that Philips Hue now supports configurable power on behavior. The user can choose between off, on at default values or the last known setting.</p> <p>This sounds very good because my wife is less enthusiastic about home automation than me, so she would really like to be able to turn on any light, to bright white setting, by flipping the switch (twice if needed).</p> <p>Do any other bulbs also have this function?</p>
2022-01-18T09:10:35.987
<p>As stated in the page you linked to :) and as stencilled directly on the board, it’s connected to GPIO8.</p> <p>Note that it’s an “addressable” RGB LED, so samples which just toggle an output won’t work, it needs to use a library for addressable LEDs. I suppose this is a WS2812 or equivalent, also known as a Neopixel in the Adafruit world, but I haven’t checked further.</p>
|esp32|
How to use the onboard LED on the ESP32-C3-DevKitC-02
6127
<p>I just bought an <a href="https://www.adafruit.com/product/5337" rel="nofollow noreferrer">ESP32-C3-DevKitC-02</a> from Espressif, which features an onboard color LED. I'm a bit of a newbie in this space, so I thought I'd start by trying to get a simple &quot;blink&quot; program running. I've installed the Espressif VSCode extension, and I can successfully compile and load (flash) code. ...But the basic &quot;blink&quot; example doesn't blink the LED --- probably because the GPIO number is wrong. I did find a <a href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-reference/peripherals/ledc.html" rel="nofollow noreferrer">library for managing LEDs</a> for this board, but it is generic and also accepts a GPIO as input, and running its sample code didn't work either. (Both the generic blink and the library samples specified GPIO 5 as the connection.)</p> <p>Does anybody know what the right value is, or am I missing something else?</p>
2022-01-19T02:02:42.897
<p>There are multiple pieces here.</p> <ol> <li>You can make a HTTPS call and be sure of the server you're talking with, if you have the right valid root CA certificate. These are usually going to last 20 years. If you dont have one, you may still be able to make the call, but cannot be sure of the server.</li> <li>You could make such HTTPS call to get a new device specific certificate. The server then needs some way to know its a valid device that is calling the HTTPS service to get a certificate. You could use your old certificate to generate the secret or use some other device specific secret that you put in it when you made the device. Use a hash based on it. This is needed if it matters that it has to be your hardware. If not, this step can be relaxed a bit and a new certificate can be sent to the device without any device specific secret. Maybe its tied to a user account by generating a random number on the device, showing it to the user on the device UI and having the user put it into your web page. That way, the user is bringing in this device and you're trusting the user. The device then gets the certificate and works on behalf of the user from that point on.</li> </ol>
|security|
Certificate Management for IOT devices
6131
<p>What is the best practice for certificate management on an IOT device (bare metal microcontroller with GSM modem that communicates to a secured MQTT broker)?</p> <p>Looking at Let's Encrypt certbot, they have 90 day expiry, then the certs should be updated. Should the certs also be sent via the existing secured MQTT connection when it is time for update? How if the device was turned off for a long time and when opened, it is already past the cert expiry? I learned that self-signed certificate is a bad idea however using it will greatly simplify the certificate management as the expiry date could be lengthen to many years.</p> <p>I am wondering how the wifi cameras handle their certificate management.</p>
2022-01-20T13:06:21.787
<p>The solution was is if the button is pressed I stoped receiving data until the new one comes</p> <pre><code>onMessageArrived = (payload)=&gt; { if(this.state.isPressed) { this.setState({isPressed: false}) return; } </code></pre>
|mqtt|mosquitto|paho|publish-subscriber|actuators|
Determine state before publish
6138
<p>I have a mosquitto MQTT broker on a Raspberry Pi. I have some topics from a client in this format SolutionCommand/state as an array 110001.</p> <p>In other hand I can invoke some publish topics like SolutionControl/WP it can be on or off. So the MQTT client would subscribe to SolutionCommand/state first of all and publish to SolutionControl/WP after processing the value of what was received. But, Here while processing how can I hold on the value of switch until receiving the current value from SolutionCommand/state this process takes 7s to received the value.</p> <p>The question is how can I hold on the state after publish for 7s?</p> <p>Here is my code bellow:</p> <pre><code>const client = new Paho.MQTT.Client(process.REACT_APP_HOST, Number(process.REACT_APP_PORT), clientID); if(client){ client.connect({ cleanSession : false, onSuccess : .... }); } }, [client]) const onConnect = () =&gt; { client.subscribe(topic1, { qos: 1 }); }; const onMessageArrived = (payload)=&gt; { if(payload.payloadString[0] == 1) { setSolutionPump('ON') setIsEnabled(true) } else if(payload.payloadString[0] == 0){ setSolutionPump('OFF') setIsEnabled(false) } const toggleSwitch1 = () =&gt; { const topic = &quot;SolutionControl/WP&quot;; if(!isEnabled1) { setIsEnabled1(previousState =&gt; !previousState); client.publish(topic, &quot;on&quot;, 1); } else { setIsEnabled1(previousState =&gt; !previousState); client.publish(topic, &quot;off&quot;, 1); } } </code></pre>
2022-01-24T10:15:35.500
<p>Different bands may or may not be allowed in different countries, or not with the same rules (power, duty cycle, etc.). Also the exact band may vary (for instance the “900 MHz band” is actually the 868 MHz band in the EU but the 915 MHz band in the US). Some devices may support both, others only one (the RFM69HCW supports both).</p> <p>Lower frequency bands usually have better propagation through obstacles, but regulatory limits (bandwidth, duty cycle, max power..) may be different. IIRC the 433 MHz band is quite limited (even more than the 868 MHz band, which is already crippled).</p> <p>LoRa can have significantly higher range, at the cost of very very very slow transmission in some cases, with very limited duty cycles, which means in those conditions they are suitable for sending a few bytes here and there, not much more.</p> <p>Note however that the largest factor for distance is unobstructed line of sight between the two antennas.</p> <p>Not knowing your needs (distance, indoors or outdoors, line of sight, amount of data, intervals between transmissions, power consumption…) it is difficult to advise one device/tech/band over another.</p>
|smart-home|communication|lora|
Allowed RF frequencies in UK using RFM69
6143
<p>I am thinking of buying an RFM69HCW FSK module from Adafruit. However I am confused as to which module to buy, the 433 MHz or the 900MHz version. Are both allowed in the UK? If they are then why do they make two different versions? Does one transmit further than the other or does one use more power than the other? There is also the option of a RFM69X, which again has the option of two bands, but this time operates on LoRa instead of FSK. I understand that this one can transmit further than the FSK. Any help is much appreciated.</p>
2022-01-25T21:00:48.620
<p>I found the way to manage my Gosund SP1-C outlet via <code>Homa Assistant</code> server and/or <code>Home Assistant</code> app. I need:</p> <ol> <li><p>pairing with Gosund SP1-C outlet via Home App and iPhone</p> <pre><code> - this add my Gosund SP1-C outlet to 'local' network + iCloud (or HomeKit server) </code></pre> </li> <li><p>remove Gosund SP1-C outlet from Apple Home App</p> <pre><code> - this remove my Gosund SP1-C from iCloud (or HomeKit server) but it should stay paired to the 'local' network </code></pre> </li> <li><p>Now <code>Home Assistant</code> server able to found automatically <code>Gosund SP1-C</code> outlet and you just need to pairing with it via code that located on QR label that attached to the <code>Gosund SP1-C</code> outlet (or it's box).</p> <pre><code> - * both of them: `Home Assistant` server and `Gosund SP1-C` outlet need to be in same local network - * `HomeKit Controller` integration need to be installed already on `Home Assistant` server `http://ip_adress_of_your_server:8123/config/integrations` </code></pre> </li> </ol> <p>After this steps you can able to control your HomeKit compatible-only <code>Gosund SP1-C</code> outlet via Android phone or browser via <code>Home Assistant</code> server web-page</p> <p><a href="https://www.home-assistant.io/integrations/homekit_controller/" rel="nofollow noreferrer">https://www.home-assistant.io/integrations/homekit_controller/</a></p>
|web-sockets|lan|
Gosund (tuya) SP1-C managment via telnet
6148
<p>Can I turn on/off my electrical socket &quot;Gosund SP1-C&quot; from local network ? (via telnet, for example. Like it happened with Yeelight bulbs) I see that 80, 8080 and 5353 ports are opened but can't found any suggestion what command I can send to Gosand. (also, I failed with other tutorials, because this device don't use 'tuya app' and connect directly to Apple_cloud/homeKit/home_app and looks like can't be added/appear in 'tuya app'. And that why I can't get id/key that can be used for connecting to Gosund via cli)</p>
2022-01-31T12:43:46.647
<p>Configuring a UART for 8 bits plus even parity is a red flag. This configuration has been obsolete for decades. A lot of current hardware doesn't actually support it. Set to 8-bit no parity.</p>
|esp32|communication|
ESP32 UART reads garbage
6156
<p>Well, I have no experience with ESP32 UART, tried it and failed. In brief: I need to implement a data exchange between ESP32 and external module via UART. And at some point I need to read the data from the external module, but have a garbage instead.</p> <p>Details: I'm playing with KNX. I've made a simple setup with some devices. Also have made 2 completely identical devboards with NCN5120. NCN is configured to use UART 19200 8E1. One board is connected to the Rapsberry Pi, another to the ESP32 Wrover devkit (also tried bare Wrover with the same results). ESP32 UART is on the pins 21/22. On Pi I use java with NRSerial, and everything is working fine. The code is quite large, but MVE just inits the KNX transceiver, assigns address and reads frames (i. e. telegrams). Java init code:</p> <pre class="lang-cpp prettyprint-override"><code>int baudRate = 19200; NRSerialPort serial = new NRSerialPort(portName, baudRate); serial.setDataBits(8); serial.setParity(SerialPort.PARITY_EVEN); serial.setStopBits(SerialPort.STOPBITS_1); serial.connect(); </code></pre> <p>Then I init NCN, assign address and read frames. Everything is working fine, like, here's the readings when I read value from some of my KNX devices on the bus:</p> <pre><code>Using port /dev/ttyAMA0 Sent reset, got response 0x03 Sent address, got response 0x21 BC 11 07 00 06 E1 00 00 B2 </code></pre> <p>But with ESP32 I have some garbage input from the NCN. Init and address assignement both are working correctly, but bus readings are completely different for the same frame:</p> <pre><code>SDK version 4.3.2 init written ok init response read ok Assign address written ok Assign address response read ok 47 BC 11 07 00 46 F5 54 14 B2 57 </code></pre> <p>I tried to swap my KNX boards, but each of them is working fine with Pi, and does not work with ESP32. Probably there's an error in my code. Please help. MVE for ESP32 follows:</p> <pre class="lang-cpp prettyprint-override"><code>{ ets_printf(&quot;\nStarting\nSDK version %s\n&quot;, esp_get_idf_version()); uart_config_t uartConfig = { .baud_rate = 19200, .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_EVEN, .stop_bits = UART_STOP_BITS_1, .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, .rx_flow_ctrl_thresh = 122,// Tried also 0 .source_clk = UART_SCLK_APB // Tried also UART_SCLK_REF_TICK }; int uartPortNumber = 1; // Tried also 2 int pinTx = 21; int pinRx = 22; uart_driver_install(uartPortNumber, 1024, 0, 0, NULL, 0); uart_param_config(uartPortNumber, &amp;uartConfig); uart_set_pin(uartPortNumber, pinTx, pinRx, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); uart_set_baudrate(uartPortNumber, KNX_UART_SPEED); uart_set_word_length(uartPortNumber, UART_DATA_8_BITS); uart_set_parity(uartPortNumber, UART_PARITY_EVEN); uart_set_stop_bits(uartPortNumber, UART_STOP_BITS_1); uart_set_hw_flow_ctrl(uartPortNumber, UART_HW_FLOWCTRL_DISABLE, 0); uart_set_mode(uartPortNumber, UART_MODE_UART); uint8_t byte; byte = 1; if (uart_write_bytes(uartPortNumber, &amp;byte, 1) != 1) { ets_printf(&quot;Init writte error\n&quot;); } else { ets_printf(&quot;init written ok\n&quot;); } if (uart_read_bytes(uartPortNumber, &amp;byte, 1, 10000 / portTICK_RATE_MS) != 1 || byte != 3) { ets_printf(&quot;Init response read error\n&quot;); } else { ets_printf(&quot;init response read ok\n&quot;); } uint8_t address[4] = {0xf1, 0x41, 0x02, 0x00}; if (uart_write_bytes(uartPortNumber, &amp;address, 4) != 4) { ets_printf(&quot;Assign address writte error\n&quot;); } else { ets_printf(&quot;Assign address written ok\n&quot;); } if (uart_read_bytes(uartPortNumber, &amp;byte, 1, 10000 / portTICK_RATE_MS) != 1 || byte != 0x21) { ets_printf(&quot;Assign address response read error\n&quot;); } else { ets_printf(&quot;Assign address response read ok\n&quot;); } while (true) { int res; res = uart_read_bytes(uartPortNumber, (void *)&amp;byte, 1, 10000 / portTICK_RATE_MS); if (res == 1) { ets_printf(&quot;%2.2X &quot;, byte); } else { ets_printf(&quot;\n&quot;); } vTaskDelay(1); } } </code></pre> <p>Thank you!</p>
2022-02-04T00:16:44.773
<p>The problem seems to stem from using the <em>Configure Template</em> menu option in Tasmota. While it provides a nice user interface that displays all of the options, clicking save after making changes doesn't always result in those changes taking effect (either immediately or sometimes at all).</p> <p>It is much better to use the <em>Configure Other</em> menu option, and input the template manually, as a json string:</p> <pre><code>{&quot;NAME&quot;:&quot;ID Relays&quot;,&quot;GPIO&quot;:[0,0,0,0,224,225,0,0,226,227,228,229,230,0],&quot;FLAG&quot;:0,&quot;BASE&quot;:18} </code></pre> <p>Everything should be put in as a relay at first (because only relays will have the clickable buttons when the page reloads). Saving from the <em>Configure Other</em> page does seem to always activate the changes, though some configurations seem to be screwy enough that not much will work.</p> <p>The first json string to use should be:</p> <pre><code>{&quot;NAME&quot;:&quot;ID Relays&quot;,&quot;GPIO&quot;:[224,225,226,227,228,229,0,0,230,231,0,0,0,0],&quot;FLAG&quot;:0,&quot;BASE&quot;:18} </code></pre> <p>Toggle all 8 of the buttons, and see what happens. At least for my device, an LED will toggle as if a relay (but if you set it for the code number for LEDs, you get no button to test/debug with, so wait to do that for now).</p> <p>Some of your buttons will show as &quot;off&quot; or 0, when the device is on, and vice versa. These will have to be configured as relay_i, led_i, etc (the _i is for &quot;inverted). You can wait to do that for now. When you find a device, mark down which one it corresponds to.</p> <p>The 7th and 8th positions should be left as zero, as well as the last. So if you have to hunt for more devices, then use this json string next:</p> <pre><code>{&quot;NAME&quot;:&quot;ID Relays&quot;,&quot;GPIO&quot;:[0,0,0,0,0,0,0,0,0,0,224,225,226,0],&quot;FLAG&quot;:0,&quot;BASE&quot;:18} </code></pre> <p>Once saved and the page reloads, test all 3 buttons as before. Mark down which are inverted, what device they activate.</p> <p>When you have all the devices identified, use the <em>Configure Template</em> page to adjust each to inverted, or to LEDs, or whatever. All relays have to be sequential, so that the top one is 1, the next (no matter how many gpios are skipped) is 2, and so on. Same for LEDs. Inverted relays and LEDs still share the same sequence. Once saved, it might be necessary to go into <em>Configure Other</em> and save it there to activate it.</p> <p>For this level of device discovery, console commands seem unnecessary. Also, Tasmota seems to want to take over the first LED, such that you may not get to use it with console commands anyway... seems to automatically make it into a power status indicator.</p> <p>In summary:</p> <ol> <li>Only relays get virtual buttons on the main page/menu.</li> <li>The <em>Configure Template</em> page doesn't always activate changes you make.</li> <li>Tasmota is finicky about making similar devices sequential.</li> </ol>
|tasmota|
What tasmota commands (web console) will turn on an indicator LED that I suspect is at gpio3?
6162
<p>I've just used tuya-convert to flash a Soundance C198 powerstrip. This is my first time doing anything like that, and I'm a little lost. The web interface gives me a list of gpios 0-10, and 12-17. These can be configured as LEDs 1-4 (either with an led or led_i setting).</p> <p>At some point, I've set all of those to LED, and through the console I've ran the <code>LedPower1 1</code> and <code>LedPower 1</code> commands. These do not seem to produce any errors, but they also don't turn on any LEDs (2 on the device).</p> <p>Am I supposed to be using some other command to turn these on? Can I turn on more than one gpio at a time (so I can do a binary search)?</p> <p>The list of tasmota supported devices does not include this device, nor goes Google turn up much other than an Amazon UK page to buy more.</p>
2022-02-21T01:20:36.597
<p>Assume the answer to the question in the comments is &quot;no&quot;</p> <p>You need to also run:</p> <pre><code>mosquitto_sub -u steve -P Pass1234 -v -t '$CONTROL/#' </code></pre> <p>To subscribe to the correct response topic.</p> <p>The <code>mosquitto_pub</code> command will only ever publish messages, it will subscribe to any topics and print out messages.</p>
|mosquitto|
How to list mosquitto clients using dynamic security feature?
6180
<p>I got the Dynamic Security of mosquitto mostly working. However, I'm not sure how to use the <code>listClients</code> command through the <code>json</code> approach, as explained here:</p> <p><a href="https://github.com/eclipse/mosquitto/blob/master/plugins/dynamic-security/README.md#list-clients" rel="nofollow noreferrer">https://github.com/eclipse/mosquitto/blob/master/plugins/dynamic-security/README.md#list-clients</a></p> <p>For example, this command works perfectly for me and it lists all the users stored in my <code>/var/lib/mosquitto/dynamic-security.json</code> file:</p> <pre><code>mosquitto_ctrl -u steve -P Pass1234 dynsec listClients </code></pre> <p>However, when I use the JSON approach like this:</p> <pre><code>mosquitto_pub -u steve -P Pass1234 -t '$CONTROL/dynamic-security/v1' -m '{&quot;commands&quot;:[{&quot;command&quot;: &quot;listClients&quot;,&quot;verbose&quot;:false,&quot;count&quot;: -1,&quot;offset&quot;: 0}]}'; </code></pre> <p>The result is no output at all.</p> <p>How do I get the list of clients through the JSON approach as indicated in the <code>README.md</code> file above?</p>
2022-03-16T21:35:44.230
<p>Hi <a href="https://iot.stackexchange.com/users/16902/helmut-hissen">Helmut Hissen</a> and <a href="https://iot.stackexchange.com/users/16832/gregory-boutte">Gregory Boutte</a>, thanks a lot for sharing your experiences. I am using a cheap ESP32-CAM (ESP32-S Version) together with a ch341 UART converter on a Linux Mint machine and had to do things slightly different. First I tried to follow your suggestion, modifying the configuration.ini file, restarting Thonny, and flashing the firmware with Thonny. But Thonny removed the extra lines from the configuration file and Micropython would not run. Although the image was flashed perfectly, which i checked with <code>esptool.py verify_flash --diff yes 0x1000 firmware.bin</code> I had no success. So I did the following.</p> <ol> <li>First I flashed <a href="https://github.com/shariltumin/esp32-cam-micropython-2022" rel="nofollow noreferrer">this firmware built by shariltumin</a> not using Thonny but using esptool.py directly:</li> </ol> <pre><code>esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 WIFI+TLS/firmware.bin </code></pre> <ol start="2"> <li>Then I added the following lines to my Thonny configuration.ini file:</li> </ol> <pre><code>[ESP32] dtr = False rts = False </code></pre> <ol start="3"> <li>After this I was able to run Micropython using Thonny on my ESP32-CAM an run some commands. <a href="https://i.stack.imgur.com/XLDVA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XLDVA.png" alt="Micropython on ESP32-CAM using Thonny IDE" /></a></li> </ol>
|esp32|micropython|
ESP32 CAM unable to use micropython and connect to the esp
6220
<p>I am trying to install micropython on my esp32 cam.</p> <p>I tried 3 differents ways to do it.</p> <h1>First one command and putty</h1> <p>I installed python and esptool with <code>pip install esptool</code>.</p> <p>Then I looked wich COM was my esp32 (In my case COM5), then I ereased the flash with this command</p> <pre><code>esptool.py --chip esp32 --port COM5 erase_flash </code></pre> <p>Here is the result, it looks fine to me.</p> <pre><code>esptool.py v3.2 Serial port COM5 Connecting.... Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 58:bf:25:83:bd:64 Uploading stub... Running stub... Stub running... Erasing flash (this may take a while)... Chip erase completed successfully in 14.3s Hard resetting via RTS pin... </code></pre> <p>After that I flashed the firmeware that I got from <a href="https://github.com/lemariva/micropython-camera-driver" rel="nofollow noreferrer">github lemariva/micropython-camera-driver</a>, I also tried with the one from official website of <a href="https://micropython.org/download/esp32/" rel="nofollow noreferrer">micropython</a></p> <pre><code>esptool.py --chip esp32 --port COM5 --baud 460800 write_flash -z 0x1000 micropython_cmake_9fef1c0bd_esp32_idf4.x_ble_camera.bin </code></pre> <p>Each time I got a result like this:</p> <pre><code>0bd_esp32_idf4.x_ble_camera.bin esptool.py v3.2 Serial port COM5 Connecting.... Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 58:bf:25:83:bd:64 Uploading stub... Running stub... Stub running... Changing baud rate to 460800 Changed. Configuring flash size... Flash will be erased from 0x00001000 to 0x00181fff... Compressed 1575808 bytes to 1010481... Wrote 1575808 bytes (1010481 compressed) at 0x00001000 in 23.8 seconds (effective 529.5 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin... </code></pre> <p>After that I tried to connect to it with putty</p> <p><a href="https://i.stack.imgur.com/zlaKL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zlaKL.png" alt="enter image description here" /></a></p> <p>I tried to unplug the esp32, press the reset button, hit CTRL + enter / CTRL + D. But each times i got a black window and I'm unable to write something</p> <p><a href="https://i.stack.imgur.com/wdjmJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wdjmJ.png" alt="enter image description here" /></a></p> <h1>Using Thony</h1> <p>I tried to flash the firmeware with Thonny <strong>Click on bottom Right &quot;Micropython (ESP32)&quot; &gt; Configure Interpreter &gt; Install or update firmware</strong></p> <p>But after the installation I always have a error and cant type python</p> <p><a href="https://i.stack.imgur.com/l8lDU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l8lDU.png" alt="enter image description here" /></a></p> <h1>uPyCraft</h1> <p>I also tried to do it with uPyCraft, when I select the COM port, it asks me to flash the firmware, it seems to works, but when i select again the port it ask again.</p> <h1>Problem</h1> <p>I can't find a way to use micro python with my esp32 cam, every time it seems to flash the firmware but can't connect to the ESP32 after that.</p> <p>My esp card is: <a href="https://i.stack.imgur.com/ufnOq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ufnOq.png" alt="enter image description here" /></a></p> <p>And the usb converter is a CH340 serial converter</p> <h1>EDIT 20/03/2022</h1> <p>I found out that my problem is not about the firmware, but about the communication between my computer (Windows 10) and the esp 32 card.</p> <p>I tried to install the firmware from a other computer (Macbook pro) and this time I was able to execute python on the card.</p> <p>Later without any modifications I tried again to just plug my card on my original computer and connect to it, but still unable to execute python.</p> <p>So I think that it could be a dirver problem or anything else, but related to my computer. For now I still don't know what I could try.</p>
2022-03-19T14:23:16.910
<p>I have at least partially figured this out…</p> <p>I noticed that the heater would appear offline any time my phone wasn't connected to my home Wi-Fi.</p> <p>That made me suspect is was going to be a firewall issue. I have a corporate router [Sophos UTM] without UPnP, so often things that would appear to be fine actually get blocked. I'd already checked the firewall log entries &amp; not seen anything obvious that was hitting it.</p> <p>Long story short, I have now punched a hole straight through it in both directions, allowing any &amp; all comms to &amp; from that one MAC address.</p> <p>This does indicate that the local 'direct' setting from the Mylek plugin for the app runs directly over the local subnet, but that any Tuya-specific data, such as scheduling, goes via Tuya.com &amp; then has to be able to punch through from the outside world. This makes me think the Mylek device is not opening its own keep-alive from the inside, enabling a return message to come back down the same 'open line'.</p> <p>This is not an ideal long-term solution &amp; I shall add to this answer when I discover exactly what ports &amp; services I need to hone this down to, so I'm not effectively running it in a DMZ.</p>
|smart-home|networking|
Mylek heater on Tuya app - online/offline
6226
<p>I've been using the Tuya app on iPhone for a couple of months, first with a Devola heater which broke down in a month so I sent it back, now with a Mylek.<br /> I didn't realise until I got the Mylek that the UI for Tuya is driven by the device manufacturer not Tuya itself, so the UI for the Mylek is totally different to the Devola [which worked perfectly].</p> <p>The Mylek shows as online to the app, but offline to the Scene feature in Tuya, seemingly no matter what I do.</p> <p>The Mylek works fine if I'm addressing it directly from its own GUI. The Mylek weekly timer (the [7] icon in the pic below), however, is an atrocious implementation, making me click one box per hour, for all 7 days, to set periods at which it should heat &amp; to what temperature. It does actually work, though.<br /> I decided instead to try the Scenes in Tuya itself. Set an on &amp; off time, set a temperature [the rest I can figure out once I get this bit working].</p> <p>On and working, from the Mylek GUI…</p> <p><a href="https://i.stack.imgur.com/FxrUi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FxrUi.jpg" alt="enter image description here" /></a></p> <p>This communication works 2-way, if I change anything on the device's panel, it reflects here [so long as the child lock is off].</p> <p>However, if I try to interact with the device in even the simplest way from the scheduler, it fails as 'offline'</p> <p><a href="https://i.stack.imgur.com/l3EL2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l3EL2.jpg" alt="enter image description here" /></a> <a href="https://i.stack.imgur.com/yf24i.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yf24i.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/FVOjb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FVOjb.jpg" alt="enter image description here" /></a></p> <p>The device is quite clearly not offline. As far as I'm aware I have no firewalling at all inside this network subnet, only to the outside world.</p> <p>Any ideas as to where to look next? Or anyone aware of this as a 'known issue'?<br /> Tuya &amp; Mylek's online help structures are both pretty obtuse &amp; mainly written in Chinglish.</p> <hr /> <p>Since first writing this I have discovered, by accident, how to make 'stripes' for on/off periods in Mylek's own interface rather than having to tap in every single hour - something which had eluded me for days. I'd still prefer to be able to setup these as events instead, as they would provide finer granularity.</p> <p><a href="https://i.stack.imgur.com/basFP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/basFP.jpg" alt="enter image description here" /></a></p>
2022-04-05T09:11:54.927
<p>First of all, I'm pretty sure you are aware that LoRaWAN traffic is encrypted, so you wouldn't be able to actually read much of anything of the payloads.</p> <p>Depending on where you are and your setup (indoors/outdoors, antenna...) it could be quite easy to not see any LoRaWAN traffic at all. LoRaWAN can travel dozens of km with line of sight, but it can stop very suddenly indoors depending on the construction. And while some areas are quite busy with lots of devices, others are probably extremely quiet.</p> <p>Even if you are in range of some other devices, most are really quiet (that's the whole idea behind battery-powered LoRaWAN devices), and would send no more than one packet a day, possibly even less. Remember that contrary to WiFi or some BLE devices for instance, there are no constant broadcast/advertisements/beacons. Devices transmit only when they actually have something to transmit.</p> <p>You would also need to be listening with the right combination of frequency and data rate (SF+BW), which reduces your chances quite a bit.</p> <p>Your code only changes the frequency (and listens on frequencies which are not used for real channels, so you're losing some listening time), but does not change the data rate, so you're missing a good chunk of possible traffic.</p> <p>You would also have to check if the rest of the parameters (coding rate, IQ..) match those for LoRa.</p> <p>In addition, it seems you're switching frequency every second or so. At SF12, many packets will take longer than a second to transmit, so you're missing those as well.</p> <p>I'm not familiar with the Heltec libraries/APIs, but:</p> <ul> <li>You would have to check if changing the frequency or other parameters does not interfere with the listening mode (i.e. if you don't need to reactivate RX after that).</li> <li>You seem to mix low-level radio, LoRa and LoRaWAN library calls. You should probably stick to LoRa calls only using the <a href="https://github.com/HelTecAutomation/Heltec_ESP32/blob/master/src/lora/API.md" rel="nofollow noreferrer">LoRa library</a> for instance.</li> <li>You should probably avoid anything sleep-related.</li> <li>You should probably try to code next to known LoRaWAN transmitters to check that you actually catch that traffic.</li> </ul>
|esp32|lora|lorawan|
Heltec WiFi Lora32 - Can i received LoraWAN packets?
6238
<p>I bought this shield and trying to receive LoraWAN packets in my surrounding.</p> <p><a href="https://pl.aliexpress.com/item/32957042456.html?_randl_currency=PLN&amp;_randl_shipto=PL&amp;src=google&amp;src=google&amp;albch=shopping&amp;acnt=494-037-6276&amp;slnk=&amp;plac=&amp;mtctp=&amp;albbt=Google_7_shopping&amp;albagn=888888&amp;isSmbAutoCall=false&amp;needSmbHouyi=false&amp;albcp=12824521326&amp;albag=128205084664&amp;trgt=349475913039&amp;crea=pl32957042456&amp;netw=u&amp;device=c&amp;albpg=349475913039&amp;albpd=pl32957042456&amp;gclid=CjwKCAjw0a-SBhBkEiwApljU0id0arfPHKLthlcPzEee8EcLXma3ryaI5UkZdq9Y41r3m6OwPY3xdhoCJmYQAvD_BwE&amp;gclsrc=aw.ds&amp;aff_fcid=27d82c1289054c23951040af96d2ef1a-1649149590648-03955-UneMJZVf&amp;aff_fsk=UneMJZVf&amp;aff_platform=aaf&amp;sk=UneMJZVf&amp;aff_trace_key=27d82c1289054c23951040af96d2ef1a-1649149590648-03955-UneMJZVf&amp;terminal_id=0efc9a0004bb4d2f8bfb7c04f38d84c0&amp;afSmartRedirect=y" rel="nofollow noreferrer">ESP32 Heltec Lora</a></p> <p>Within their SDK there is examples of receiving data for Lora, joining LoraWAN, however i am interested in seeing data in the air for LoraWAN.</p> <p>Is this chip enough to be able to receive LoraWAN packets in the air? I have it running hopping frequencies since a week, and haven't seen any packet at all.</p> <p>The code i am using for this is a slight modification from their ping-pong example with channel hopping in place.</p> <pre><code>#include &lt;ESP32_LoRaWAN.h&gt; #include &quot;Arduino.h&quot; #define RF_FREQUENCY 868000000 // Hz #define TX_OUTPUT_POWER 15 // dBm #define LORA_BANDWIDTH 0 // [0: 125 kHz, // 1: 250 kHz, // 2: 500 kHz, // 3: Reserved] #define LORA_SPREADING_FACTOR 12 // [SF7..SF12] #define LORA_CODINGRATE 1 // [1: 4/5, // 2: 4/6, // 3: 4/7, // 4: 4/8] #define LORA_PREAMBLE_LENGTH 8 // Same for Tx and Rx #define LORA_SYMBOL_TIMEOUT 0 // Symbols #define LORA_FIX_LENGTH_PAYLOAD_ON false #define LORA_IQ_INVERSION_ON true #define LORA_IQ_INVERSION_OFF false #define LORA_FHSS_ENABLED false #define LORA_CRC_ENABLED false #define LORA_NB_SYMB_HOP 0 #define RX_TIMEOUT_VALUE 1000 #define BUFFER_SIZE 1024 // Define the payload size here std::vector&lt;uint32_t&gt; vFrequency; char txpacket[BUFFER_SIZE]; char rxpacket[BUFFER_SIZE]; static RadioEvents_t RadioEvents; void OnTxDone( void ); void OnTxTimeout( void ); void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ); typedef enum { STATUS_LOWPOWER, STATUS_RX, STATUS_TX } States_t; int32_t iTimer; int iFreq; int16_t txNumber; States_t state; bool sleepMode = false; int16_t Rssi, rxSize; uint32_t license[4] = {a, b, c, d}; // Add your initialization code here void setup() { Serial.begin(115200); while (!Serial); vFrequency.push_back(868000000); vFrequency.push_back(868100000); vFrequency.push_back(868300000); vFrequency.push_back(868500000); vFrequency.push_back(867100000); vFrequency.push_back(867300000); vFrequency.push_back(867500000); vFrequency.push_back(867700000); vFrequency.push_back(867900000); vFrequency.push_back(868800000); vFrequency.push_back(869525000); SPI.begin(SCK, MISO, MOSI, SS); Mcu.init(SS, RST_LoRa, DIO0, DIO1, license); iFreq = 0; txNumber = 0; Rssi = 0; RadioEvents.TxDone = OnTxDone; RadioEvents.TxTimeout = OnTxTimeout; RadioEvents.RxDone = OnRxDone; Radio.Init( &amp;RadioEvents ); Radio.SetChannel( RF_FREQUENCY ); // set radio parameter Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH, LORA_SPREADING_FACTOR, LORA_CODINGRATE, LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON, LORA_CRC_ENABLED, LORA_FHSS_ENABLED, LORA_NB_SYMB_HOP,LORA_IQ_INVERSION_OFF, 2000000 ); Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR, LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH, LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON, 0, LORA_CRC_ENABLED, LORA_FHSS_ENABLED, LORA_NB_SYMB_HOP,LORA_IQ_INVERSION_ON, true ); state = STATUS_TX; } void loop() { if (millis() - iTimer &gt; 1000) { iFreq++; if (iFreq &gt; vFrequency.size() - 1)iFreq = 0; Radio.SetChannel( vFrequency[iFreq] ); iTimer = millis(); } switch (state) { case STATUS_TX: delay(1000); txNumber++; Serial.printf(&quot;Resending packet , length %d, freq %li\r\n&quot;, rxSize, vFrequency[iFreq]); Radio.Send( (uint8_t *)rxpacket, rxSize ); state = STATUS_LOWPOWER; break; case STATUS_RX: Serial.println(&quot;into RX mode&quot;); Radio.Rx( 0 ); state = STATUS_LOWPOWER; break; case STATUS_LOWPOWER: LoRaWAN.sleep(CLASS_C, 0); break; default: break; } } void OnTxDone( void ) { Serial.print(&quot;TX done......&quot;); state = STATUS_RX; } void OnTxTimeout( void ) { Radio.Sleep( ); Serial.print(&quot;TX Timeout......&quot;); state = STATUS_TX; } void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ) { Rssi = rssi; rxSize = size; memcpy(rxpacket, payload, size ); //rxpacket[size]='\0'; Radio.Sleep( ); Serial.printf(&quot;Packet Received: %i\r\n&quot;, rxSize); for (int x = 0; x &lt; rxSize; x++) { Serial.printf(&quot;%02X &quot;, rxpacket[x]); } Serial.println(&quot;&quot;); iTimer += 1000; // stay on this channel state = STATUS_TX; } </code></pre>
2022-04-26T15:34:11.447
<pre><code> const client = new Paho.MQTT.Client(process.REACT_APP_HOST, Number(process.REACT_APP_PORT), clientID); client.onConnectionLost = this.onConnectionLost; client.onMessageArrived = this.onMessageArrived constuctor(){ client.connect({ onSuccess: this.onConnect, userName: process.REACT_APP_DB_NAME, password: process.REACT_APP_PASSWORD, onFailure: this.onConnectionLost, }); </code></pre> <p>You seem to define the handle to client.onConnect twice, which might account for connecting twice with the same client instance, hence the same client id and angry result.</p>
|mqtt|aws-iot|paho|publish-subscriber|
How to handle the connection in MQTT using Paho
6259
<p>I've managed to connect to my Mosquitto broker of Paho MQTT JS client. However, the client disconnects inmediately after completing the connection. Before it worked now I'm testing it doesn't work.</p> <p>This is my code for the main functions involved: constructor() {</p> <pre><code> super(); this.onConnectionLost = this.onConnectionLost.bind(this) this.onConnect = this.onConnect.bind(this) this.onMessageArrived = this.onMessageArrived.bind(this) const client = new Paho.MQTT.Client(process.REACT_APP_HOST, Number(process.REACT_APP_PORT), clientID); client.onConnectionLost = this.onConnectionLost; client.onConnect = this.onConnect; client.onMessageArrived = this.onMessageArrived constuctor(){ client.connect({ onSuccess: this.onConnect, userName: process.REACT_APP_DB_NAME, password: process.REACT_APP_PASSWORD, onFailure: this.onConnectionLost, }); this.state = { client, value: 0, } } componentDidMount() { this.onConnect = this.onConnect.bind(this); } onConnect = () =&gt; { const { client } = this.state; console.log(&quot;Connected!!!!&quot;); } onConnectionLost = (responseObject) =&gt; { if (responseObject.errorCode !== 0) { console.log(&quot;onConnectionLost : &quot; + responseObject.errorMessage); } } sendIntensity = () =&gt; { const { client } = this.state; client.publish(this.props.topic, this.state.value.toString(), 1) } </code></pre> <p><strong>console log:</strong></p> <pre><code>Connected!!!! Connected!!!! onConnectionLost : AMQJS0007E Socket error:undefined. onConnectionLost : AMQJS0007E Socket error:undefined. Connected!!!! </code></pre> <p><strong>Error :</strong></p> <blockquote> <p>Error: AMQJS0011E Invalid state not connected. at node_modules\react-native\Libraries\LogBox....</p> </blockquote>
2022-04-28T02:10:17.753
<p>You use one weak resistor (for instance, the data sheet shows a 4.7kΩ resistor) for all the devices in one chain.</p> <p>The devices use Maxim's &quot;1-Wire&quot; protocol - all devices share a single wire for transmitting and receiving data. To make this work, devices operate in a tri-state mode so that multiple devices don't try to power the wire at the same time. The pull-up resistor is necessary to provide a readable high signal to the CPU.</p> <p>You can learn more in the <a href="https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf" rel="nofollow noreferrer">DS18B20 data sheet</a>.</p>
|sensors|
How to wire multiple DS18B20 temperature sensors?
6263
<p>I want to wire up a few DS18B20 sensors to measure various points across a span of about 10 meters. (I intend to hook this up to an ESP8266 and use Tasmota, but I think that's not really relevant to my question).</p> <p>I am uncertain if I need to have 1 4k7 pull up resistor for the whole chain of devices, or a 4.7k pull-up resistor for each device (located close to the device).</p> <p>My google foo is weak, and I've seen both layouts. I could swear that when I worked with these sensors years ago I had 1 resistor per device, but the more I think about it, the less sense this seems to make to me.</p>
2022-05-02T16:17:02.660
<p>I was quite naive. I was using localhost on the LoPy instead of the broker IP. Replacing that fixed the issue. Thanks for all the answers!</p>
|mqtt|lora|
LoPy4 MQTT Example does not Work
6271
<p>I have two LoPy4 Dev boards. I am using this <a href="https://docs.pycom.io/tutorials/networks/lora/module-module/" rel="nofollow noreferrer">tutorial</a> in order to (successfully) communicate with the two boards. After receiving data in LoRa communication I am trying to also publish this data in an MQTT Broker. I have followed the related MQTT tutorial which is provided by Pycom, <a href="https://docs.pycom.io/tutorials/networkprotocols/mqtt/" rel="nofollow noreferrer">here</a> (also placed <a href="https://github.com/pycom/pycom-libraries/blob/master/lib/mqtt/mqtt.py" rel="nofollow noreferrer">mqqt.py file</a> under lib/ folder) but every time that I am trying to run the code I get OSError: [Errno 104] ECONNRESET.</p> <p>Has anyone faced any similar issues ?</p> <p>This is the main file that I am using on the LoPy:</p> <pre class="lang-python prettyprint-override"><code>from mqtt import MQTTClient # from mqtt import MQTTClient_lib as MQTTClient from network import WLAN import machine import time def sub_cb(topic, msg): print(msg) wlan = WLAN(mode=WLAN.STA) wlan.connect(&quot;XXXXX&quot;, auth=(WLAN.WPA2, &quot;XXXXXXXXXXXXXX&quot;), timeout=5000) while not wlan.isconnected(): machine.idle() print(&quot;Connected to WiFi\n&quot;) client_id = &quot;python-mqtt-1&quot; client = MQTTClient(client_id, '0.0.0.0', user=&quot;guest&quot;, password=&quot;guest&quot;, port=1883) client.set_callback(sub_cb) client.connect() client.subscribe(topic=&quot;python.mqtt&quot;) while True: x = 100 while x &gt; 0: client.publish(topic=&quot;python.mqtt&quot;, msg=str(x)) client.check_msg() x -= 1 time.sleep(2) time.sleep(100) </code></pre> <p>This is the docker compose for the rabbitmq</p> <pre><code>services: rabbitmq: image: rabbitmq:3.9-management container_name: rabbitmq ports: - 1883:1883 - 5672:5672 - 15672:15672 volumes: - ./conf/myrabbit.conf:/etc/rabbitmq/myrabbit.conf command: '/bin/bash -c &quot;rabbitmq-plugins enable rabbitmq_mqtt; rabbitmq-server&quot;' </code></pre> <p>I also created a python script that publishes MQTT messages to the same broker</p> <pre class="lang-python prettyprint-override"><code>import random import time from paho.mqtt import client as mqtt_client broker = '0.0.0.0' port = 1883 topic = &quot;python.mqtt&quot; # generate client ID with pub prefix randomly client_id = f'python-mqtt-{random.randint(0, 1000)}' def connect_mqtt(): def on_connect(client, userdata, flags, rc): if rc == 0: print(&quot;Connected to MQTT Broker!&quot;) else: print(&quot;Failed to connect, return code %d\n&quot;, rc) client = mqtt_client.Client(client_id) client.username_pw_set('guest', 'guest') client.on_connect = on_connect client.connect(broker, port) return client def publish(client): msg_count = 0 while True: if msg_count == 50 : break time.sleep(0.1) msg = f&quot;messages: {msg_count}&quot; result = client.publish(topic, msg) # result: [0, 1] status = result[0] if status == 0: print(f&quot;Send `{msg}` to topic `{topic}`&quot;) else: print(f&quot;Failed to send message to topic {topic}&quot;) msg_count += 1 def run(): client = connect_mqtt() client.loop_start() publish(client) if __name__ == '__main__': run() </code></pre> <p>When uploading the code to the LoPy I keep getting ECONNRESET, however the python script publishes successfully on the broker.</p>
2022-05-20T23:04:41.747
<p>Got it to work with Google Home and Google TV apps entirely. After I did the same thing... factory reset... no remote. I was stuck at the same screen of pairing the remote. If you press the button on the back of the Chromecast... just once... don't hold it down, it goes into a pairing mode. I then opened the Google TV app and selected the small TV icon in the lower right hand corner. It showed the Chromecaset as an available device. I selected it and it connected. Then, I just mashed the center button and got past the pairing screen. After that, I just walked through the rest of the startup procedure. It asked me to repair somewhere in the middle while downloading apps. Worked!</p>
|chromecast|
How to set up Google TV without remote
6288
<p>I have lost the remote for a Google TV device and after a factory reset I can't connect to it with the Google Home app on my phone. How do I make it work?</p>
2022-05-31T04:37:06.680
<p>Yes - there is a gatewayID which you receive on every uplionk message but I see two issues:</p> <ol> <li>Your node might be in the range of more than one gateway and you will receive an array of gateway objects</li> <li>I can not imagine that it would be feasable to do a downlink after <em>every</em> uplink</li> </ol> <p>BR Cademis</p>
|lorawan|
Can a LoRaWAN end device know an ID of the gateway to which it's connected?
6303
<p>Supposing I want the application firmware in my LoRaWAN end device to behave differently when it's in a given geolocation and that geolocation can be defined by the local Helium base station or cell (&quot;gateway&quot; in the LoRaWAN parlance?) that the end device is sitting in.</p> <p>Suppose also that I'm happy to send one uplink and receive one downlink message in order to determine the gateway ID.</p> <p>Section 3.2 of the LoRaWAN spec has only this to say about the downlink PHY frame:</p> <blockquote> <p>Downlink PHY: Preamble PHDR PHDR_CRC PHYPayload</p> </blockquote> <p>Is there also a gateway ID in there somewhere? Or is there in one of the other layers?</p> <p>If not, could the application server know this from the uplink message and send it back as part of the downlink message payload?</p>
2022-06-12T15:46:11.570
<p>This can be done using Home Assistant quite easily. If you haven't looked into it yet, you may want to <a href="https://www.home-assistant.io/" rel="nofollow noreferrer">here</a>.</p> <p>I find that geofencing in home assistant is a bit spotty, but it does seem to mostly work. I think a better way of doing this is by installing the Home Assistant app on each residents phone and have an automation trigger when the SSID of each phone changes to something other than your home wifi. I use this to make sure my lights are off when I leave home.</p>
|smart-home|ifttt|
How to start the Roomba when everyone leaves?
6318
<p>Roomba can use IFTTT to run the vacuum when a user's phone leaves a geofenced area. And you used to be able to use Life360 + IFTTT to trigger your smart vacuum to run when everyone has left the house (not just one person). However, Life360 ended their partnership with IFTTT, and since then there has been no obvious way to do this.</p> <p><strong>How can I trigger my Roomba to vacuum when everyone leaves the house?</strong></p> <p>Some things I've tried:</p> <ul> <li>Using Nest Home/Away and/or Assistant Home/Away, but <a href="https://www.reddit.com/r/Nest/comments/hv91y9/run_roomba_when_nest_is_away/" rel="nofollow noreferrer">they no longer integrate with iRobot</a>.</li> <li>iOS users may be able to get this to work with Shortcuts, but it will only work if everyone uses iOS phones</li> <li>IFTTT can't write to a shared google sheet, so it's hard to do with a google sheet. You can work around it by duplicating the sheets and adding more IFTTT applets, but it's quite messy</li> </ul>
2022-06-23T05:41:33.623
<p>Well it turns out that in versions after 9.1 Tasmota has changed the default value of MQTTWifiTimeout from 2000ms to 200ms and because ESP8266 is not a very fast MCU this low timeout value is too short. So setting:</p> <pre><code>MqttWifiTimeout 1000 </code></pre> <p>from console does the trick.</p>
|mqtt|tasmota|
tasmota on ESP8266 is not connecting to cloud mqtt server
6333
<p>I am trying to connect ESP8266 using tasmota, to a cloud mqtt broker and getting message</p> <pre><code> MQT: Connect failed to broker.hivemq.com:1883, rc -2. Retry in 10 sec </code></pre> <p>Any ideas?</p>
2022-07-01T00:24:42.630
<p>This worked for me local information every 5sec from X1 hybrid G4 with pocket WIFI to home assistant (if you use it). Not sure if it uses the API to get the info, but worth checking out</p> <p><a href="https://community.home-assistant.io/t/solax-x1-hybrid-g4-local-cloud-api/506172" rel="nofollow noreferrer">https://community.home-assistant.io/t/solax-x1-hybrid-g4-local-cloud-api/506172</a></p>
|protocols|
Getting telemetry from Solax Inverter Pocket WIFI
6339
<p>I'm trying to get telemetry from my Solax hybrid inverter which has a &quot;Pocket WIFI&quot; device installed without the information going across the internet (its my data, its sent unencrypted and stored in a country whose values I do not share, and also giving them the right to meddle with my device at my risk in the portal usage terms).</p> <p>I have been able to connect to the Solax AP and, by pretending to be the Solax App connected to &quot;local&quot; I can get a dump of raw data as a CSV which I think I will be able to decode. That said, I really don't want to have to set up a dedicated AP client just so I can get this information.</p> <p>I see that the device is also connected to my LAN, and port 80 is open, but this does not behave like a web server, and throwing the request I made to 5.8.8.8 (ie when connected to the Pocket WIFI AP) did not work.</p> <p>It also looks like it is sending telemetry unencrypted but not in an immediately recogniseable format to a specific IP address (47.254.152.103, port 2901) that it looks like I can change in the configuration, but I can't find details of the protocol.</p> <p>Does anyone know how I can access this data without connecting specifically to the Pocket WIFI AP, and without the data going to the cloud?</p>
2022-07-08T04:15:36.153
<p>I've figured it out. The module starts with default time of 1980-Jan-01 and AWS rejects the time mismatch while authenticating. I had to set the correct time with AT+CCLK and MQTT connected successfully or configure the module to pull the time over NTP using AT+CNTP=&quot;pool.ntp.org&quot;,-16,0,0 (this is for EST time zone).</p>
|mqtt|aws|
Connecting cellular module SIM7070G to AWS MQTT
6347
<p>I have troubles connecting SIM7070G (SIM7000 family) to AWS over built-in MQTT using AWS certificates. I've succeeded previously using the module only as a cellular gateway, but running FreeRTOS+mbedTLS on Windows simulator, however now trying to offload SSL to the cellular module and seems like I'm hitting a wall. I've followed the example flow log from <a href="https://github.com/botletics/SIM7000-LTE-Shield/blob/master/SIM7000%20Documentation/AT%20Command%20Logs/SIM7000_AWS_Log.txt" rel="nofollow noreferrer">here</a>, however no success.</p> <p>So my flow is:</p> <ul> <li>I've created a certificate in AWS (certificate.crt)</li> <li>I've created a private key from that certificate (private.key)</li> <li>I've downloaded a legacy VeriSign certificate (LegacyRoot.pem)</li> </ul> <p>In order to see if they work, I've used mosquitto_sub and sent a test message from AWS MQTT Test client:</p> <pre><code>mosquitto_sub.exe --cert certificate.crt --key private.key --cafile LegacyRoot.pem -h aaaaxi07e85ykv.iot.us-west-2.amazonaws.com -p 8883 -t &quot;test&quot; { &quot;message&quot;: &quot;Hello from AWS IoT console&quot; } </code></pre> <p>Seems like all goes well.</p> <p>I've uploaded the certificates to &quot;customer&quot; directory to the SIM7070G module using QPST EFS Explorer utility: <a href="https://i.stack.imgur.com/wuC2P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wuC2P.png" alt="enter image description here" /></a></p> <p>Then verified that the module can find the files:</p> <pre><code>7/7/2022 23:19:12.106 [TX] - AT+CFSINIT&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:19:12.118 [RX] - AT+CFSINIT&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:19:14.404 [TX] - AT+CFSGFIS=3,&quot;LegacyRoot.pem&quot;&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:19:14.415 [RX] - AT+CFSGFIS=3,&quot;LegacyRoot.pem&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; +CFSGFIS: 1758&lt;CR&gt;&lt;LF&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:20:00.773 [TX] - AT+CFSGFIS=3,&quot;certificate.crt&quot;&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:20:00.778 [RX] - AT+CFSGFIS=3,&quot;certificate.crt&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; +CFSGFIS: 1224&lt;CR&gt;&lt;LF&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:20:03.276 [TX] - AT+CFSGFIS=3,&quot;private.key&quot;&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:20:03.288 [RX] - AT+CFSGFIS=3,&quot;private.key&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; +CFSGFIS: 1679&lt;CR&gt;&lt;LF&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; </code></pre> <p>So the certificates are uploaded, lets now connect:</p> <pre><code>7/7/2022 22:55:19.304 [TX] - AT+CNACT=0,1&lt;CR&gt;&lt;LF&gt; 7/7/2022 22:55:19.317 [RX] - AT+CNACT=0,1&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; &lt;CR&gt;&lt;LF&gt; +APP PDP: 0,ACTIVE&lt;CR&gt;&lt;LF&gt; 7/7/2022 22:55:21.559 [TX] - AT+CNACT?&lt;CR&gt;&lt;LF&gt; 7/7/2022 22:55:21.571 [RX] - AT+CNACT?&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; +CNACT: 0,1,&quot;10.155.172.130&quot;&lt;CR&gt;&lt;LF&gt; +CNACT: 1,0,&quot;0.0.0.0&quot;&lt;CR&gt;&lt;LF&gt; +CNACT: 2,0,&quot;0.0.0.0&quot;&lt;CR&gt;&lt;LF&gt; +CNACT: 3,0,&quot;0.0.0.0&quot;&lt;CR&gt;&lt;LF&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; </code></pre> <p>Lets configure the certificates and connect to AWS:</p> <pre><code>7/7/2022 23:50:39.604 [TX] - AT+CSSLCFG=&quot;convert&quot;,2,&quot;LegacyRoot.pem&quot;&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:39.614 [RX] - AT+CSSLCFG=&quot;convert&quot;,2,&quot;LegacyRoot.pem&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:42.084 [TX] - AT+CSSLCFG=&quot;convert&quot;,1,&quot;certificate.crt&quot;,&quot;private.key&quot;&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:42.097 [RX] - AT+CSSLCFG=&quot;convert&quot;,1,&quot;certificate.crt&quot;,&quot;private.key&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:44.590 [TX] - AT+CSSLCFG=&quot;sslversion&quot;,0,3&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:44.603 [RX] - AT+CSSLCFG=&quot;sslversion&quot;,0,3&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:46.699 [TX] - AT+SMSSL=1,&quot;LegacyRoot.pem&quot;,&quot;certificate.crt&quot;&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:46.712 [RX] - AT+SMSSL=1,&quot;LegacyRoot.pem&quot;,&quot;certificate.crt&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:48.199 [TX] - AT+SMCONF=url,&quot;aaaaxi07e85ykv.iot.us-west-2.amazonaws.com&quot;,&quot;8883&quot;&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:48.211 [RX] - AT+SMCONF=url,&quot;aaaaxi07e85ykv.iot.us-west-2.amazonaws.com&quot;,&quot;8883&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:49.501 [TX] - AT+SMCONF=&quot;clientid&quot;,&quot;basicPubSub&quot;&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:49.514 [RX] - AT+SMCONF=&quot;clientid&quot;,&quot;basicPubSub&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:50.781 [TX] - AT+SMCONF=&quot;KEEPTIME&quot;,60&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:50.794 [RX] - AT+SMCONF=&quot;KEEPTIME&quot;,60&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:53.411 [TX] - AT+SMCONN&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:50:53.423 [RX] - AT+SMCONN&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; ERROR&lt;CR&gt;&lt;LF&gt; </code></pre> <p>And it's an error... I've tried a different certificate, but it did not work either.</p> <p>Some debug commands:</p> <pre><code>7/7/2022 23:52:34.933 [TX] - AT+SMCONF?&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:52:34.945 [RX] - AT+SMCONF?&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; +SMCONF: &lt;CR&gt; &lt;CR&gt;&lt;LF&gt; CLIENTID: &quot;basicPubSub&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; URL: &quot;aaaaxi07e85ykv.iot.us-west-2.amazonaws.com&quot;,8883&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; KEEPTIME: 60&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; USERNAME: &quot;&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; PASSWORD: &quot;&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; CLEANSS: 0&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; QOS: 0&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; TOPIC: &quot;&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; MESSAGE: &quot;&quot;&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; RETAIN: 0&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; SUBHEX: 0&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; ASYNCMODE: 0&lt;CR&gt;&lt;LF&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:52:41.506 [TX] - AT+SMSSL?&lt;CR&gt;&lt;LF&gt; 7/7/2022 23:52:41.518 [RX] - AT+SMSSL?&lt;CR&gt; &lt;CR&gt;&lt;LF&gt; +SMSSL: 1,&quot;LegacyRoot.pem&quot;,&quot;certificate.crt&quot;&lt;CR&gt;&lt;LF&gt; &lt;CR&gt;&lt;LF&gt; OK&lt;CR&gt;&lt;LF&gt; </code></pre> <p>I've also tried to pass AT+CSSLCFG parameters without quotes and that did not help. I've tried to follow the thread <a href="https://github.com/botletics/SIM7000-LTE-Shield/issues/58" rel="nofollow noreferrer">here</a>, but seems like I'm doing everything right. Note: AWS endpoint is on the AWS West server and <a href="https://docs.aws.amazon.com/general/latest/gr/greengrass.html" rel="nofollow noreferrer">certificate region is supported</a>.</p> <p>Any hints, please?</p> <p>Thanks!</p>
2022-07-26T05:29:33.490
<p>Have you registered your product ? <a href="https://www.lg.com/us/mylg/product-registration" rel="nofollow noreferrer">Product Registration</a><br /> Technically, if you have registered it, they should send you an email when there's updates (improvements) to that product - not just recalls.<br /> Now, if you're registered and they are still not sending you updates, you should send them feedback via <a href="https://www.lg.com/us/support/feedback?url=/us/support/contact&amp;omniture=us:support:contact" rel="nofollow noreferrer">Feedback link</a> or email their support and ask for this feature.<br /> Are you worried about leaving the connection open all the time ? That's understandable, I guess...</p>
|security|smart-tv|
Notifications for LG WebOS updates and security fixes (e.g. a mailing list)
6369
<p>I have a LG WebOS TV (2021) which has no connection to the internet. Every few months I activate the internet connection in the firewall (OpenWrt) and check if updates are available. A somewhat manual and unfortunate solution.</p> <p>Is there a mailing list or any other kind of notifications for WebOS release updates and security fixes?</p>