Fix typos/missing info in the latest article

This commit is contained in:
Gergely Polonkai 2021-02-01 14:38:49 +01:00
parent 959c614a1d
commit 67eeac2d0a
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
1 changed files with 13 additions and 12 deletions

View File

@ -30,11 +30,11 @@ battery; i had to install the station near a mains socket, which is in a place i
providing less accurate temperature readings. It also takes away a precious wall socket, of which
i have only two outside.
I got a little stuck in an X-Y problem, and started looking for another solution, based on a
Prometheus Push Gateway. While browsing documentation and generally hanging around the Interwebz,
i stumbled upon the Home Assistant project (which is on my ToDo list for a looong time). Without
hesitating, i quickly backed up the SD card of my Raspberry Pi and installed Hassio on it. I
never looked back since.
I got a little stuck in an `X-Y problem <https://en.wikipedia.org/wiki/XY_problem>`_, and started
looking for another solution, based on a Prometheus Push Gateway. While browsing documentation
and generally hanging around the Interwebz, i stumbled upon the Home Assistant project (which was
on my ToDo list for a looong time anyway). Without hesitating, i quickly backed up the SD card of
my Raspberry Pi and installed Hassio on it. I never looked back since.
With Home Assistant installed and configured, i installed and configured the Mosquitto add-on and
started tinkering with my ESP boards.
@ -62,7 +62,7 @@ they dont do that if its raining, and since my smartphone rebooted for som
delivery guy could not reach me and left; he will try to deliver the package again on Monday. All
this happened because i dont have a doorbell.
So while at it, i quicly installed a push button on our gate, led the wire to my office (a good 5
So while at it, i quickly installed a push button on our gate, led the wire to my office (a good 5
meters or so), and did some more soldering:
- Connect the GND pin of the ESP board to D4 through a 10kΩ resistor
@ -235,7 +235,7 @@ Now guess what the unique ID of the device will be. Ill wait…
Was your answer “the MAC address of the ESP boards WiFi chip”? Yeah, mine too. Except it will
be ``000000000000``. If you want to install one station in your house, thats not a big deal.
But i want one outside, one in my office, in the kitchen, the bedroom, bathroom, and so one.
Having the same unique ID makes it not-so-unique in this case. So I dag deeper in the code of ``HADevice``.
Having the same unique ID makes it not-so-unique in this case. So I dug deeper in the code of ``HADevice``.
It has the following constructors:
@ -254,10 +254,9 @@ It has the following constructors:
Meanwhile, the ``WiFi.macAddress(mac)`` line calls a function that *gets* the MAC address of the
WiFi chip, and stores the bytes in the ``mac`` array.
So what happens? How does the unique ID become a string of zeroes?
The example code calls the second constructor, effectively converting the ``mac`` array (full of
zeroes) to a character string full of zeroes.
So what happens? How does the unique ID become a string of zeroes? Well, the example code calls
the second constructor, effectively converting the ``mac`` array (full of zeroes) to a character
string full of zeroes.
The solution
============
@ -328,4 +327,6 @@ mangling. So lets update our code a bit:
mqtt.loop();
}
And now you have a unique(ish) ID (well, unless you start tinkering with MAC addresses on you network, but then you are on your own).
And now you have a unique(ish) ID (well, unless you start tinkering with MAC addresses on you
network, but then you are on your own). And if you want to update the unique ID while the
software is still running, you can do that, too. But i wont help you with such perversions.