Typically, I boast about successful projects on this site. One could conclude incorrectly that I succeed in everything I undertake which is definitely not the case. Even projects that seemed successfully completed do not always work exactly as I would have liked. Here is a translation of a list of problems I drew up in mid-December.
Table of Contents
- lighttpd with Rasbian Stretch
- The Ghost in the Sonoff
- Power Outages and the Sonoffs
- mDNS and TASMOTA
- Chromecast Audio
- Dynamic DNS
lighttpd with Raspbian Stretch
On August 4th, I reported that I could not securely stream video from MPJG-Streamer a proxy server in Lighttpdin the latest version of Raspian StrecthRaspian Stretch. I still have not found the solution, but it could be found pursuing one of three tracks.
- The version of Lighttpd in the Debian Stretch package repository is
1.4.45-1
which is newer than the one that was installed from the Raspian Jessie repository (version 1.4.35-4+deb8u1). This information is confirmed either here or with theapt-cache policy
command.pi@domo:~ $ apt-cache policy lighttpd lighttpd: Installed: 1.4.35-4+deb8u1 Candidate: 1.4.35-4+deb8u1 Version table: *** 1.4.35-4+deb8u1 0 500 http://mirrordirector.raspbian.org/raspbian/ jessie/main armhf Packages 100 /var/lib/dpkg/statusI could install the older version of Lighttpd on Stretch to see if it works.
- At the same time that I installed the proxy server in Lighttpd
1.4.35-4
, I added the OpenVPN server (version2.3.4-5+deb8u2
) on the Raspberry Pi. This installation might include a necessary library or change the system configuration in such a way that Lighttpd could securely route the MPJG-Streamer video stream. It's not very likely, but you never know. - Finally, I could resume my search on the web to find out how to set up a proxy server with the new version of Lighttpd. It had required a lot of research to learn how to do it before. Over time, someone may have updated the information on this topic.
None of this is a priority right now. Indeed, I continue to use Raspian Jessie on the Raspberry Pi that houses my home automation system based on an old version of Domoticz as explained in the April 11, 2018, post updated on the 23: Secure Webcam streaming with MJPG-Streamer on a Raspberry Pi .
The Ghost in the Sonoff
I swear there are malevolent ghosts in some of the Sonoffs in use around the house. Accordingly, I decided to borrow the title from Arthur Koestler, The Ghost in the Machine, a book I read a long time ago. So long ago that I don't remember much about it except that I found the writing enjoyable. The web has informed me that the ghost in the machine refers to the dualism of the mind and body in Descartes. It comes from an English philosopher, Gilbert Ryle, whom I do not know. Never too late to learn a little.
My spooks randomly turn on and off either of two Sonoffs that control a pair of bedside lamps. This should not be too surprising, given the one metre phone cable between the buttons and each Sonoff which contain one four unshielded wires in parallel. These combined with the CAT5 cable of more than two metres connecting the two Sonoffs constitute a good antenna for any static coming from several nearby sources.
- There is obviously the mains (120 V to 60 Herz) that supply the current to the lamps and Sonoffs. In addition, one of the lamps has a very long wire that I simply coiled rather than shorten. In addition, it is close to one of the Sonoffs, and above mentionned cables.
- There is an alarm clock with LED display and built-in AM-FM radio on one of the bedside tables. It was the cheapest model that was available in a big-box store when I bought it; protection against radio interference is probably not one of the best qualities of the device.
- There is a digital cordless phone on the other bedside table. Since it complies with the DECT 6.0 standard, it operates at 1.9 GHz which should not interfere with Wi-Fi, but who knows?
- Occasionally a tablet connected to the 2.4 GHz Wi-Fi network is used near the Sonoffs that operate on the same frequency and which could be a source of interference.
It is not easy to pinpoint the exact source of the problem because both Wi-Fi switches can work properly for weeks. Only occasionally and for no apparent reason, a lamp will come on for a few seconds and then turn off and restart this circus two or three minutes later until I unplug the Sonoff.
It's far from being an unknown problem. Here are some similar situations Interference on my digital input - suggested fixes? and False trigger issue using GPIO input.
I had added a pull-up resistor to the 3.3 V line at the input at pin 14 of the ESP8266 in each of the Sonoff as suggested in several places, including Random input HIGH detect on GPIO.
tactile buttons Sonoff (in parallel) 3,3K Ω Header _| o---------, ____ | o------, | +--|____|-->o 5V | | | _| o------|--+-----//-----+---------->o GPIO14 | o------+--------//---------------->o 0V
My next step will probably be to add a low value capacitor between pin 14 of the ESP8266 and ground. Combined with the resistor, it would constitute a low-pass filter which attenuates the high frequency transient signals.
Several refer to the following article Protecting Inputs in Digital Electronics. It contains a
discussion about the protection of the microcontroller when [...] buttons
connected [...] via long wires [may] lead to inadvertent electronic failure.
Long wires can act as an inductor and when a button is opened or closed,
large voltage spikes can appear... I do not think the Sonoff is damaged
because it correctly responds to commands sent by Domoticz through the mqtt
server as well as
when the Sonoff push button or any of the remote buttons are pressed.
Nevertheless, the article is interesting.
Update: it does not work; the same Sonoff continues to act arbitrarily.
Power Outages and the Sonoffs
Injured and even dead Sonoffs are everywhere here. I exaggerate slightly, but there have been two major power outages lately, and some of the Sonoffs installed in the house have had a hard time of it, and two have broken down.
In one case, it is obvious that it is the power supply that is defective. It has been possible to upload the latest version of TASMOTA and to verify that it is possible to activate the relay via Wi-Fi as long as the device is powered through the header. However, nothing works when the Sonoff is plugged into the mains.
As for the other Sonoff, it looks like it can no longer store the local network address in the flash memory because it cannot reconnect to the local network when it is rebooted for some reason.
There is a third Sonoff, installed in the base of a lamp, is defective. Its push button is functional but the Sonoff does not connect to the Wi-Fi network. On the other hand, the button connected to pin 14 of the ESP8266 does not work. To get a better understanding of what's going on, the Sonoff will have to be retrieved to upload Mr. Arends' software again.
mqtt
sent with Domoticz, but whose web server is not online. Why?I do not know if these issues are related to the latest version (6.3.0) of TASMOTA that has been installed on all 9 Sonoff of home automation system. I have the impression that recovery from a Wi-Fi network failure or power failure is less robust than before. I wanted to change the source code by entering the network SSID and password to see if it would have an impact, but I failed to compile the source code in the Arduino IDE.
lib
to the .../sketchbook/librairies
directory as
instructed in For all versions. However, two of the copied
libraries already existed, but under different names. It was necessary to
eliminate these old versions otherwise the IDE used them rather than those
provided with Tasmota .
I had started using Platform.io as Theo Arends, but for some reason I can not upload new firmware to a Wemos D1 mini in this environment. There is no problem if the micro-controller is an ESP866 NodeMCU V3. This defies understanding. As long as this problem is not solved, I will use the Arduino IDE that works with the three types of devices based on the ESP8266 I own.
mDNS et TASMOTA
Theo Arends' TASMOTA has been using the ESP8266mDNS
library. Thus one can reach a Sonoff Web server with an address of the form
hostname.local
rather than with a numeric IP address such as
192.168.1.185
. This is great because the latter is likely to
change according to the whim of DHCP server on the router. To make it
even easier, I changed the host names of the Sonoffs, choosing more
memorable names such lampe-sofa, lampe-biblio and lampe-michel for my bedside
lamp.
What a disappointment when I could not find some Sonoffs at their
hostname.local
address after a power failure. I had to use Zenmap on the desktop and NetX on
the Android tablet to find the dynamic IP addresses
assigned to these Sonoffs. Unfortunately, neither of these utilities works
perfectly and it was necessary to more or less guess the IP address in some
cases.
Recently, I found the source of the problem. Just before the crash, I
uploaded the new version (v6.3.0) of Theo Arends firmware. There are several
variants of TASMOTA as can be seen in its Github
repository. I installed sonoff-classic.bin
on the first
three Sonoffs, then I decided to install sonoff-FR.bin
on the
others. But the ESP8266mDNS
library is not included in the
second variant which was clearly indicated. A considerable loss of time would
have been avoided if I had taken the trouble to read the documentation.
Since I replaced sonoff-FR.bin
with
sonoff-classic.bin
on all Sonoffs, they publish their web
service without fail.
The avahi library that supports
Zero-configuration networking or Zeroconf in Linux is
installed by default in Ubuntu. So I can reach the
Sonoff web server which controls indirect lighting hidden behind a heavy
bookshelf using the address http://lampe-biblio.local
with the
Firefox browser. One can do the same with Safari on Mac OS X or iOS where it is the Bonjour library
that supports the Zeroconf
protocols.
Unfortunately, the equivalent of Avahi or Bonjour is not available on the Android platform. This may explain why the Chromium browser can not resolve local names of the type
hostname.local
. So, when I want to
use Chromium in Ubuntu,
I get the IP address explicitly with Avahi before.
I use Zeroconf Browser on my Android tablets to display the list of
HTTP
services and the IP address of the servers published with the protocol
mDNS
. This application, which has not been updated for several years, is no
longer available on Google Play, but it can be found on
Aptoide. Caveat emptor , I do not know if
this site assiduously checks that the applications
found there are safe. Service Browser in Google Play seems
comparable.
It may be necessary to install Bonjour in Windows 10 to do the same on this platform. I cannot verify because I have already added CUPS for used network printers on my Windows 10 partition and I believe that Bonjour is automatically installed with CUPS. However, I am sure it is necessary to add Bonjour in Windows XP, if someone still uses this version.
There is no true failure here. However, I would like to modify the French
variant of Theo Arends' firmware of by adding mDNS
, eliminating
features that are not useful for simple basic Sonoff switches if necessary.
However, to get there, I would have to solve the problems with the Arduino IDE
and Platform.io that I mentioned in the previous section.
TASMOTA itself has changed
a lot since version 5.xx and it will take some time to find my way around.
Chromecast Audio
In mid-November, Google was selling Home mini at a discount. Only $ 34.95, but you had to spend at least $ 35.00 for free shipping. So I added a Chromecast, also on sale, to my order. I do not know how I did it, but it's actually a Chromecast Audio that I ordered.
The gadget comes with an audio cable with 3.5 mm connectors that is only 12 cm long. I could not place the unit within that short distance of the amplifier. So I used a 1 m audio cable to make the connection.
My preliminary tests showed that the device fulfills its function of transmitting audio over Bluetooth to active speakers. So I can play music, podcasts and internet radio from my Android tablet . However, it is not possible to transmit audio from a video synchronously. Watching a YouTube video on the tablet while listening to the sound being transmitted to the Chromecast Audio connected to a sound system is like watching an old 50s era Godzilla movie, speech and lips are off-beat. This is exactly the same problem I had encountered using a Raspberry Pi as the audio stream receiver rather than the Chromecast Audio. The problem is inherent in the technology. All this is confirmed JeremyTM in the discussion surrounding the issue: Chromecast Audio delay when watching video.
The 1 m audio cable I used to test the device is long enough to connect to my tablet when I'm comfortably ensconced in my sofa. This gadget is completely unnecessary. It was a mistake to get it.
Unlike me, my nephews and nieces commonly use smart phones. In a few days, Chromecast Audio will go to the one whose phone does not have a 3.5 mm audio connector.
Dynamic DNS
About a year ago, I created a dynamic domain name at FreeDNS. Combined with port forwarding on the router, I could access my home automation server and the video stream from the USB webcam connected to the Raspberry Pi host from anywhere through the Web. It was also a necessary step to use a Google Home Mini to control IoT devices in my house. Everything was secured using only TLS connections (i.e. HTTPS). All this is explained in two posts: Google Home Mini with Domoticz using IFTTT and Secure Webcam streaming with MJPG-Streamer on a Raspberry Pi
Over the New Year holidays, we were away for a short while. Just before I turned on the conditional timers in Domoticz. I was disappointed, I could not get into the home automation server and I did not get e-mail notifications from it when IoT devices were turned on or off simulating our presence at home. I could not view the video stream from the Webcam. Finally, I also could not connect to the OpenVPN server I had installed not too long ago.
This missing e-mail notifications are easily explained. I got tired of all those messages when I was at home and knew when things were being turned on or off, so I had disabled the service in Domoticz.
I will have to look into changing this in the Away
script;
enabling e-mail notification when timers are enabled and disabling it when
device timers are disabled.
All the other problems are clearly linked. The cause presented itself somewhat by accident when I opened a Web site that told me I was in Toronto which is 1,600 km away from my house. How could that be, when before Moncton, about 20 km away, used to be identified as my location? I checked my IP and realized that it was now different. After at least a couple of years of being assigned the same IP, my ISP decided for reasons unknown to change it. So why hadn't the DDNS entry at FreeDNS been updated?
I logged into my router and re-entered the values in the DDNS
configuration. It reported it failed to update the DDNS entry. I removed
the user name and password values and changed them to guest
as suggested in Step 2, Router stuff in Automatic DNS changes via your router!
at FreeDNS. Eventually, the router said it was able to update the IP address.
Unfortunately, it was not possible for me to check that. I had manually
updated the IP address in my sud-domain entry at FreeDNS, and my ISP
seems to be perfectly happy to assign the new IP systematically since the
last change.
It could very well be a couple of years again before I get assigned a new IP address. Until then, I will not know if the automatic DNS updating is performed correctly by the router.