I forgot to note, that a MySensors network can handle a lot of devices, just how many is up for debate. My Asus router, which I think is typical, can only handle about 25 WiFi connections. This would be a limiter for and extensive ESP network.
Posts made by OldSurferDude
-
RE: Gateway without a radio
-
Gateway without a radio
Unwittingly I have been migrating away from MySensors. Partly because of the dwindling users and partly because I can find cheaper, more robust solutions. For about USD$2.50 one can have an ESP8266 with 80-260VAC power supply. I use both Tasmota and the Arduino IDE for programming.
But, I can't see giving up my RPi Zero 2W gateway because it's running my irrigation system. The irrigation control is Integrated into the gateway as "sensors"
The irrigation is gravity fed. I have 10 levels and five microclimates, which works out to 20+ zones. This would be a challenge to do on an Arduino Nano.
I only have one other sensor left in my radio network and I will eventually replace it. Which leaves me with a gateway with no need for a radio.
I haven't tried it yet, but can the RPi gateway code run without a radio? I ask because the RPi can handle a lot of tasks and the communication with home automation controllers work well. Seems like a good way to go for complex sensors.
(I may try again with my battery powered mosture sensors which would utilize MySensors )
OSD
-
RE: Long time test done with soil sensor!
I am duly impressed! I tried something similar. I knew that the environment into which I was putting the sensors was pretty harsh ... I only got about a year. I used an 82650 battery, 5W solar cell and a charge controller. Worked well for a short while.
I think you inspired me to try again.
OSD
-
RE: LAN8720A - will mysensors work with this module
@Marcin I googled KC868-A12 and came up with only KC868-A128. If this is not your board, please provide a link. Did you mean KC868-A16? AliExpress Note that these are relay driver boards. If you do indeed use relays, you would need a daughter board.
My link states that this can be programmed with the Arduino IDE which implies that the LAN drivers are not going to be a problem.
MySensors REQUIRES a radio. I use nRF24; there are others. It would be tricky, if even possible, to connect a radio to this board because there are only 3 free GPIO pins. Thus, this is not technically a MySensors question.
But you could send and received messages to/from an MQTT broker and have the controller of your choice.
The real question here is the complexity (size) of the program. My recommendation is just try it yourself. I would recommend Tasmota and do your logic in your controller. If you need very fast response times, then consider programming with the Arduino IDE.
Cool project! Let us know how it turns out.
OSD
-
Water Meter or "How to get Home Assistant to send saved data to an Arduino"
This is a pretty basic project except that the trick was to get Home Assistant (HA) to store the cumulative water usage and then send it back after an Arduino (re)boot.
Here is a link to my documentation, such as it is.
And a link to the Arduino code. (the HA side is in the previous document)
-
How I delete a node from HA and start over.
If you're here, I'm not going to preach to the choir about HA's arcane ways. This works for me
- Stop mysgw
- Using MQTT Explorer, remove from the topics mysensors_out and mysensors_in all vestiges of the node that is to be deleted
- In Home Assistant (HA) delete the device
-
- Settings
-
- Devices and Services
-
- Under MySensor, click on n Devices
-
- Click on the device you want to delete.
-
- Click DELETE
-
-
- One can use use Studio Code Server to note that the device has been deleted
-
-
- IMPORTANT! reboot Home Assistant
- While HA is rebooting, make the changes to the code of your device
- When you are satisfied with the changes and after HA has completely rebooted, disconnect your device from power.
- Start mysgw
- Apply power to your device
-
RE: Running out of nodeId's
@TheoL Not only did I put in delays, too, but I put in delays that were based upon the ID (which was stored in NVRAM)! This helped.
caveat: This is probably not accurate be helps to explain the challenges with a large network.
My initial experience with Arduino/nRF24 was using the libraries from TMRh20. Those libraries allowed a node to be a repeater, but only for 6 nodes. The primary node 0, master, only allowed 6 nodes to connect to it. The nodes connected to it also allowed 6 nodes. Subsequent nodes had to go through one of these repeating nodes. But the depth was only 4 deep. The master assigned node IDs if the node didn't already have one; similar to a MAC address.
The master also kept track of the addresses (ARP table?). Addresses were 4 octets (base in the form of D/C/B/A. A node connected directly to the master had an address of 0/0/0/a (where 0/0/0/0 was reserved for the master). A node connected through another node had an address of 0/0/b/a, and so forth.
But what happens is that a parent node has to mange the data from all its child nodes and their child nodes and their child nodes. Thus a node would get so bogged down dealing with this traffic that it din't do its sensor task very well.
It is my belief that MySensors either uses TMRh20's libraries or has developed some aspects based on his initial work. I see that that TMRh20 has a version 2 and I have not experimented with it. I did find that MySensors worked better than version 1.
Thus, my curiosity.
I am also duly impressed at the magnitude of hardware. Currently a nano like device from Aliexperss is US$2-3, nRF24 ~ US$1, power supply ~ US$1.50, power cord ?, case?, sensors!? While the hardware cost is daunting, even with a PCB it's a lot of work building those up. So, yeah, I'm impressed!
-OSD
-
RE: Running out of nodeId's
I, too, am duly impressed that you have so many nodes! Please share more.
I run a "test" and "production" gateways, too. I have a compiler directive in the sensor software that allows me to easily switch from test to production.
At one time I was running about 10 Nano nodes and it appeared to me that they were colliding with one another, symptom being slow response times As I remember, that occurred mostly on power up after power loss. Often I'd get two nodes with the same ID. I have since put my ID in NVRAM and that helped.
So I am very interested seeing what you have done.
--OSD
-
RE: Anybody got one / a few spare minimalist rfm69hw shields for wemos d1 mini?
Thanks for the offer @TheoL ! I have moved on to a differenct project. Also, a lesson that I have learned many times, "If it works, don't fix it!"
-OSD
-
RE: Anybody got one / a few spare minimalist rfm69hw shields for wemos d1 mini?
You highlight a problem, @kiesel. Considering that each board is effectively US$2.50, it will cost about US$2 to send one and will take a week, if not two or three, to get to you. Not to mention the time spent on handling.
I am in the same situation as you, I just ended up wire wrapping and judicious use of double stick tape. Not beautiful, but it works.
Best of luck
OSD
-
RE: [mysensors] Not a valid message: invalid literal for int() with base 10: '\x00\x000'
@kiesel
The first thing I would try is to plug the Arduino into a serial port and see if there is output. This would have to be on a different port from the one the HA expects. You can use the Arduino IDE to view the out put. It probably will appear to be gibberish, as the BAUD rate must be right. And it will probably be gibberish anyway because it is probably binary. What you will know, though, is that your Arduino isn't bad.You may have to reprogram your Arduino.
Good Luck
OSD
-
RE: Water Filtering and Sterilization and Hot Water Recirculation
Do you do gizmos for open heart surgery, too? I love all the valves!
OSD
-
RE: 2x BME 280 on 2x arduino nano hangs in HomeAssistant
@HJ_SK said in 2x BME 280 on 2x arduino nano hangs in HomeAssistant:
BME280
I had a similar situation. First you have to delete all the MySensors devices in HA. This is aggravated by HA wanting the devices to be on line before you delete them. You may have to delete the MySensors data in the HA config directory. You may even have to uninstall MySensors from HA. Then shutdown HA. Next, turn off your gateway. Are you using MQTT for messaging? You'll have delete the MySensors data from there, too. (MQTT Explorer is good for doing this)
Then start HA. Did your MySensors devices come back as zombies? That's the problem. Try deleting them again. Are they data still in MQTT?
OK, now start again.
I had documented how to do all this deleting in HA Forum, HA/Discord and here, but I can't find that documentation now. grrrr
OSD
-
RE: Arduino nano and Uno in same My sensors network with NRF24L01+
As a matter of fact, I have. But I haven't had a problem. I found that wiring the Uno was a bother, though. Keep your wires between the Uno and radio as short as possible. Try braiding the wires. (sort of like twisted pairs but in this case, "twisted septet". Don't connect IRQ. I solder a male connector on my radios and the twisted septet is soldered to the board and the female connector. This works well when I have to swap radios around. I have even had success with a cat 5 cable, with connector, as long as 30cm.
Did you try putting the same program in the Uno as the one in nano 2?
What controller are you using? I use Home Assistant (HA) and it can be a pain, especially when it comes to the not-well-supported MySensors. Sometimes you have to completely uninstall MySensors (delete all devices first) from HA and then reboot HA. Sometimes, even this doesn't work. (Somewhere I documented how to do this, maybe here or HA forum, but I can't find it now)
Let us know how it goes.
OSD
-
RE: A low cost energy meter
I like the work you've done! Making a schematic which can be made into a PCB is a skill that I have yet to acquire.
I appreciate that you have shown me (us) this design, for it gave me serious pause to think. While I point out some areas that would suggest review, I would encourage you fully document what you've done and put it on git.
I checked out the ACS714ELCTR device and, if I understand it correctly, it has to be in series with the heat pump. The wire to the heat pump is 6AWG (50A). So, yes, the current sensor would have to have it's own PCB with suitable trace widths and separation and high current connectors. The resistance of the sensor is negligible (1.2 mโฆ) compared to that of the connectors. (20 mโฆ); Even 5mโฆ @30A is 4.5W and the sensor is cooking away at 1W!
One of the concerns I pointed out was that my design probably would nullify one's homeowner's insurance. An in-line with a 50A circuit, would be a greater concern.
Is the current output the instantaneous current? "5 ยตs output rise time in response to step input current" Implies that it is, compared to the ~100ยตs that it takes for the Arduino to read the analog port.
The sensor reports the current as proportional to an positive analog voltage. This means that the output would look like a full wave rectified AC signal. Determining phase angle ฮฆ would involve noting the time of lowest current comparted to the time of lowest voltage as opposed to zero crossing. In this case, one wouldn't know if that was leading a lot or lagging a little (or vice versa), though practical assumptions could be made.
One of the things that the people at Open Energy are troubled with is distortion. The energy AC sign wave is not truly a sign wave, typically there is a flattening at the top. Pumps can cause a very distorted signal! But the concern here is, "How much distortion does your measuring device introduce?" In my device, and this would be true of yours, too. there is the ~100ยตs between voltage and current readings and an additional ~70ยตs computational time. But chasing down those problems are not the concern of the low cost meters you and I designed.
Good work!
OSD
-
RE: Where to change settings?
@eiten I believe the IP of the gateway is the same as the computer on which the gateway is running. In my case, I am running the gateway on an RPi.
As a side note, that very same program is also a sensor (an array of relays to control my garden irrigation).
When I think about it, I don't know of any other hardware that can usefully run the TCP gateway. Orange Pi?
-osd
-
RE: Where to change settings?
Hi @eiten
If you just want to find the IP address of HA you can use the command line (in windows)
ping -4 homeassistant.local
Find the version of HA is found by: settings-->about
I use my router to set the IP address of HA.
At the router you should be able to determine the MAC (media access control) address of HA. This address is six, two digit hex numbers eg E5:16:A7:92:87:BB. If your HA is online, you'll find the MAC associated with the current IP of HA.
Your router should have a section for DHCP (dynamic host control protocol) When a device requests and IP address from the router, the DHCP routine provides it. The nomenclature seems to be different for every router, but somewhere in the DHCP configuration settings you'll be able to manually associate the MAC to the desired IP address. Save and exit.
Next time you restart HA it should have the address you specified.
Note on HA running in virtual machines: The MAC is a random number selected when the virtual machine is created. I believe it may be able to be set when the virtual machine is created. It's very bad to have two devices on the same network with the same MAC.
I'm not sure one can change the version number. I would not advise doing that.
-
RE: MQTT GW on ESP8266 supporting SSL/TLS?
@bgunnarb I like @eiten 's solution for you.
Personally, I am not a fan of using cloud/public brokers. Thus I am curious about your system and there is something about it from which I can learn. I would like to understand why you cannot deploy your own mosquitto broker.
I see your set up as 3 sensor groups defined by the channel used
#define MY_RF24_CHANNEL ChannelOfSensorGroup
Each sensor group has some number of sensors and one MQTT GW on ESP8266. On the MQTT side, do you distinguish between gateways by using a different host name?
Something like:
#define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway-nOf3-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway-nOf3-in" #define MY_MQTT_CLIENT_ID "mysensors-nOf3" #define MY_HOSTNAME "ESP8266_MQTT_GW_nOf3" //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68 #define MY_CONTROLLER_URL_ADDRESS "test.mosquitto.org" #define MY_PORT 1883
I must assume your controller (aka Home Assistant) discriminates between through which gateway the data is to flow by way of the different topic names.
If my "something like" is correct, then changing brokers is changing the IPaddress/URL in your gateways and in your controller (though if the controller is Home Assistant, it may be a bother because the device-id's may change which will make a mess of all the work you've done in HA. This is why I like @eiten 's solution.)
I hope it's all working for you again.
OSD
-
RE: ๐ฌ AC-DC double solid state relay module
What I didn't quite figure out was how it operates independently as a regular light switch.
What I find most interesting is that this is 8 years old. There have been some incredible advances in the IoT world in that time. I was about to do a similar thing which morphed into an ESP-12F then added a touch screen. I call it the Universal Light Switch
Imagine this: All the switches are identical. Any switch can easily be configured to control up to five devices ... and then changed, on-the-fly, to control a different set of devices.
My design is part of a system that would require a controller (eg. Home Assistant), an MQTT broker, and receiving modules in the devices being switched. It's WiFI which assumes an access point.
The DIY ULS is under $20 and the off-the-shelf receiving modules are under $10. (About the cost of a non-networked dimmer switch) If one doesn't have the controller and MQTT broker, they can run on an old (5 years?) computer (which is cheaper than an old RasberryPi).
This project is a good one!
OSD
-
RE: Old hardware migration
@dbemowsk
I will share my limited MySensors experience with you.I'm pretty sure that your old hardware will be compatible 2.3.2 gateway.
I don't think you can have two MQTT gateways. First, I don't think Home Assistant (HA) will allow you to do that. I would suggest you try it, though, but, obviously, back everything up before you try.
Now that said, I'm pretty sure you can have add a serial and/or ethernet gateway. Each gateway would run on a different channel.
I run HA in a Virtual Box (see HA docs for installing it) and the virtual machine is running in an Ubuntu computer.
On that computer I am running my MQTT broker.
It's a little tricky poking a hole for a serial connection into the virtual machine. You have to do this if you are going to have a serial gateway. And you'll have to this if you have a z-wave dongle. (I have a Zooz module and have found the documentation at Zooz for doing this)
I see that you're pretty experienced and I'd advise you to have a development machine on which you would do your experimenting. This has saved me untold grief when things start to get funky. I even developed a script for recreating my development virtual machine because I've buggered it so many times or I want to have a clean install when I'm trying to learn something new. (Latest was ESPHome)
It's a good project and you, because of your experience, won't have any significant problems. Well, if you're not a yaml or python guy, HA is going to drive you nuts.
-OSD
ps, I sent you an email on you switch -O
-
RE: GatawayESP8266 - Compile error
@eiten That's good to hear! Obvisouly I misunderstood the meaning of
// How many clients should be able to connect to this gateway (default 1) #define MY_GATEWAY_MAX_CLIENTS 2
thinking it meant nodes, but as you say, it means controllers.
Considering that one can get and ESP12F, a power supply, and an nRF24l01+ radio for it for about US$3 makes the ESP8266 much more desireable than an RPi at US$56.
There is one thing that is troubling and that is support. Already noted is that the current revision of the ESP8266 board in the Arduino IDE does not support the ESP8266 gateway. It appears that MySensors, too, is losing adherents.
-OSD
-
Gateways
I've been experimenting with gateways. I've been using an MQTT gateway running on an RPI zero. I like this because of the fast (relatively) processor with a lot of I/O (I'm running a 25 zone irrigation system).
I am developing a low cost energy meter and to test it out on my developments system I tried to use a Serial gateway. no joy, see Serial Gateway woes
Then I tried the TCP gateway running on an ESP8266 (NodeMCU 1.0). To get that working I had to reload the ESP8266 library and the MySensors library. It works great! ... but the example is limited to 2 devices connected to it. Has anyone tried more devices? My experience with an ESP8266 access point (which is limited to 4 clients and pathetically slow) tells me that not many nodes can connected to it.
I use Home Assistant as a controller. I did discover that the MySensors integration can run the MQTT gateway and the TCP gateway. I wonder if it is possible to have multiple TCP gateways?
OSD
-
RE: GatawayESP8266 - Compile error
I removed both the ESP8266 library and the MySensors library, then re-installed the MySensors Library and then the 2.7.4 ESP8266 library. Works!
I did see that the default number of nodes is 2. I suspect that as a gateway, it can't handle many nodes.
OSD
-
RE: GatawayESP8266 - Compile error
@ferro Thanks for checking for me. I'll do that.
OSD
-
Serial Gateway woes
I'm working on an energy meter using an Arduino Nano. My prototype works well. It ships its data off to a MySensors Gateway running on a Raspberry Pi (RPi) which forwards the data to an MQTT broker. Home Assistant picks up the data from the broker. (Home Assistant is running in Virtual Box.) Virtual box is running on an x86 computer with Ubuntu OS) This works
But if I use a MySensors Serial Gateway I can eliminate the RPi and the MQTT broker. I can put the MySensors Serial Gateway on an Arduino Nano.
What happens, though, is that Home assistant recognizes the serial gateway, and the device is recognized but no data is accepted. When I put a serial monitor on the serial port, I see that the serial gateway is sending the data.
Has anyone successully run this configuration: Nano<-->(Nano?) Serial Gateway<-->Virtual Box<-->Home Assistant? (Note, official Uno R3 doesn't work, either.)The MySensors Serial Gateway example is only modified with my pecularities: nRF24l01 CE and CS are connected to Pins 9 and 10 and the radio channel I use is 86. Also, I comment out the #define MY_DEBUG line
Virtual Box is set up per the Home Assistant instructions In addition, a serial port must be configured (enable, Port Mode [Host Device] Path/Address [/dev/ttyUSB0]). the same thing can be done from the command line
VBoxManage modifyvm $VM --usbehci on --usb on --uart1 0x3F8 4 --uartmode1 /dev/ttyUSB0
Where $VM is the name of the virtual machine
)
Here's the steps,- I remove power from the Arduino Nana device
- I must leave the Nano running the Gateway in the USB port becase the Virtual Machine won't start without it.
In Home Assistant - Delete all MySensors devices: settings-->Devices and Services-->Devices(tab)
- Delete the MySensors Integration: settings-->Devices and Services-->MySensors-->Integration Entries (three vertical dots)-->delete
- Using Studio Code Server, delete the mysensors persistence file (it should be empty at this point)
- Reboot Home Assistant. Development tools-->[RESTART]-->Restart Home Assistant (I have also tried the option is uder a
Advanced, including powering off the computer and even re-installing Virtual Box and re-installing Home Assistant in Virtual box) - After Home Assistant returns, I configure the MySensors integration for a serial gateway. One quirk, the serial port is /dev/ttyS0, not ttyUSB0
- I restart MySensors
- I wait a minute
- I press the reset button on the Nano running the MySensors Gateway.
- I wait a minute
- At this point I can (usually) see the gateway in devices, under the MySensors integration, and, using Studio Code Server, in the MySensors persistant file.
- I power of the Nano that is the sensor device.
- I wait a minute
- I ensure that data is sent from the sensor device.
- I wait a minute
- I see the sensor device in the same places as the gateway, BUT none of those places show the data that has been sent.
Yes, it appears to be a Home Assistant issue, but I suspect a MySensors person wrote the integration.
-
RE: GatawayESP8266 - Compile error
@ajongen et. al.
2024 and alll is not well. The unmodified GatewayESP8266 does not compile now
MySensors 2.3.2
ESP8266 by ESP8266 (community) 2.7.4In file included from c:\Users\gferry\Documents\Arduino\libraries\MySensors/MySensors.h:441:0, from C:\Users\gferry\AppData\Local\Temp\.arduinoIDE-unsaved202412-16144-b9g35b.q5il\GatewayESP8266\GatewayESP8266.ino:114: c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp: In function 'bool can_yield()': c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp:96:26: error: too many arguments to function 'bool can_yield()' return can_yield(g_pcont); ^ c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp:93:17: note: declared here extern "C" bool can_yield() ^ exit status 1 Compilation error: exit status 1
ESP8266 by ESP8266 (community) 3.1.2
In file included from c:\Users\gferry\Documents\Arduino\libraries\MySensors/MySensors.h:441, from C:\Users\gferry\AppData\Local\Temp\.arduinoIDE-unsaved202412-16144-b9g35b.q5il\GatewayESP8266\GatewayESP8266.ino:114: c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp: In function 'bool can_yield()': c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp:96:26: error: too many arguments to function 'bool can_yield()' 96 | return can_yield(g_pcont); | ^ c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp:93:17: note: declared here 93 | extern "C" bool can_yield() | ^~~~~~~~~ c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp: In function 'void esp_yield_within_cont()': c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp:102:2: error: 'cont_yield' was not declared in this scope; did you mean 'can_yield'? 102 | cont_yield(g_pcont); | ^~~~~~~~~~ | can_yield c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp: In function 'void loop_task(ETSEvent*)': c:\Users\gferry\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp:200:26: error: invalid operands of types 'void' and 'int' to binary 'operator!=' 200 | if (cont_check(g_pcont) != 0) { | ~~~~~~~~~~~~~~~~~~~ ^~ ~ | | | | void int exit status 1 Compilation error: exit status 1
-
RE: Saving last known good state, but not in EEPROM
@eiten said in Saving last known good state, but not in EEPROM:
This is exactly what I am seeking! Thank you!
PS I truly enjoy reverse translating! It teaches me how to better understand my first language and it gives me alternate words to use in searches. So a second thank you!
"Regelmรคssiges Zurรผcksetzen" would be best translated to English in this context as "Periodic Reset". In the English version of Home Assistant it is called "Meter reset cycle" (I remember seeing "keep dry" translated as "do not take in shower with you"
-
RE: Saving last known good state, but not in EEPROM
I have considered this @karlheinz2000. In a typical case, both lose power at the same time. Then both do not know the count.
Thanks for the input!
OSD
-
Saving last known good state, but not in EEPROM
I'm working on a low cost energy meter for my heat pump. This meter would be similar to the meter on one's house, but for one device only.
Currently my problem is storing the cummulative kWh in the likely event of a power outage. A quick search yields a heat pump can consume 2,000kWh a month. I don't wnat to live in such a place, but this is worst case. If I store each integer change in EEPROM, and the EEPROM is good for 100,000 writes, would mean about every 5 years and I have to replace the Arduino. At half that, I'd have to remember to replace the Arduino when the heat pump is replaced. This is not acceptable to me.
I also have a water meter that suffers from this same challenge.
My controller is Home Assistant (HA) and I am looking to see how I would have HA store this data and then the Arduino request it upon boot.
I have experimented with storing the data on the MQTT broker, but have not done so sufficiently to determine if this method is viable. The mosquitto MQTT broker will restore retained data upon reboot, but, apparently not subscriptions. (I hope I am wrong on this.)
OK, MySensors Universe, "Is there someone out there that has resolved this issue?|"
OSD
-
A low cost energy meter
I am curious to know if my heat pump is actually saving energy. To know this, I would need an energy meter. So I designed and built one. You can see my projoect and I believe it is sufficiently documented for you to build your own. See Energy Meter
My nephew has done the same and is as curious as I. But he knows nothing of MySensors, and how to get the data presented in a reasonable way. I explained to him it is a small matter. This turns out to be not so. Beyond the aforementioned energy meter, it involves an Arduino MySensors Gateway (hardware and software), Home Assistant (software), Virtual Box (Software), and an i86 computer (hardware) which is running linux (software). Just writing that makes the project sound intimidating. It is not, if you break it down to its constituent parts.
The Arduino Serial Gateway (GatewaySerial) can be found as an example in the Arduino IDE, once the Arduino library is loaded. This probrammed Arduino will be connected to the target computer vie the same USB cable used to program the arduino. For my environment, I have some modifications. The wiring of the radio to the Arduino Nano is slightly different. CE is wired to D10 and CS is wired to D9. Also, I am using radio channel 86. These changes are reflected in the following three lines which are added after the line
#define MY_RADIO_RF24
#define MY_RF24_CS_PIN 9 // for compatibility with RF-Nano #define MY_RF24_CE_PIN 10 // for compatibility with RF-Nano #define MY_RF24_CHANNEL 86 // 86 is the development channel 121 is the production channel
Acquiring an adequate computer for the task can be as simple ordering one from Amazon for around UD$85. Discarded laptops can be found for as little $10 sans battery and power supply. The only important requirement is more than 2GB RAM.
See information about SSH below
Installing Ubuntu on the computer is tedious but easily done. These instructions are for the server version of the operating system (OS). This version has no graphical user interface (GUI). You will need a monitor and a keyboard. If network manager is not installed (nmcli d doesnโt work) or nmcli d doesnโt indicate a wireless network, the internet port will have to be used. If there is only WiFi, a network client device, which connects to the internet port, will have to be used. Official instructions
Installing Virtual Box is also a tedious task. By this time youโre pretty used to using the command line.
Finally, installing Home Assistant will be the training session for working with Home Assistant.
Information about SSH
SSH is programs running on your usual desktop computer and the target computer. When you installed the operating system on the target computer, you entered a username and and password. Once the target computer is up and running, and youโve found itโs IP address (ip address) you can โsshโ from your usual desktop with โssh username@xxx.xxx.xxx.xxx (the IP address you just found) You will be prompted for the password.This is just like being at the keyboard and monitor of your target computer. EXCEPT, you can now copy and paste from your usual desktop computer into the window of the target computer. That is, you donโt have to fret about typing in all those commands.
Challenge yourself! It's all do-able and you can do it!
OSD
The answer to your first question is, "Yes, you can do it!"
-
RE: RS485 to custom PCB - comms working, relay not clicking - need helps
I see that every relay has an LED associated with it and that the LED should illuminate when the relay is energized.
Are all the LEDs functioning as expected? Is the I/O that is driving the opt-isolator working as expected?
Also, you could short pins 3 & 4 of the opt-isolator to see if the relay is working.
I see 7 relays in the schematic IO-A4, IO-A5, IO-A46, IO-A7 connected to IO-MCU and AL-2, AL-D12, AL-D13 connected to Alarm MCU mini-328. The former four are the relays that are not energizing, right?
Let's assume the LED and the diode of the opto-isolator have a forward bias of 1.5V, The transistor in the MCU will have 0.1v . This means that the voltage across the 1k resistor is about 2V which means there's 2mA flowing when the output of the MCU is low. Is this sufficient to illuminate the two aforementioned LEDs? I'm pretty sure the forward bias is less. The max current would be 5mA.
I don't see where in the software that the state of the relays are being initialized because loadState is commented out. You may have to write another program to initialize the EEPROM before first use and then load this code or plan of forcing them as part of your bring up procedure.
Let us know how the shorting of those pins go.
OSD
-
RE: Gateway on Raspberry pi 1
@mimaret Here are my options for an MQTT gateway:
./configure --spi-driver=SPIDEV --my-gateway=mqtt --my-controller-ip-address=192.168.sss.sss --my-port=1883 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-transport=rf24 --my-rf24-channel=ccc --my-rf24-pa-level=RF24_PA_MAX
I see that you don't have the SPI driver nor the pubilsh and subscribe topics. Check to see to what they default. I do not use the default channel for my production system (the one that actually runs the house). I don't use the IRQ and have seen no problems not having it.
You have a lot of warnings. I'd ignore those for now. The issue appears to b the library stropts.h
Try this: In the file
~/MySensors/hal/architecture/Linux/drivers/core/interrupt.cpp
comment out the line#include stropts.h
I think that's what I had to do.
Let susknow if that works.
OSD
-
RE: Does MySensors require Arduino Timer 2?
I have success!
(oops, that's suppose to be Timer1)
I only sample for 1/60 of a second. What I did was to back up all the timer registered I used and then resorted them after I was done sampling. (As opposed to initializing the registers in setup and then starting the timer when needed.)
Now I have a Nano sampling the data and sending it to a MySensors Gateway on an RPi3B+ which then sends it to an MQTT broker runing on an old laptop. Also running on the laptop is Home Assistant running inside of VirtualBox.
If MySensors does use Timer1, it appears that restoring the registers allows it to be shared.
//------------------------------------------------------ISR ISR(TIMER1_OVF_vect){ // interrupt service routine for overflow TCNT1 = TimerPreloadValue; // must be first line! starts the timer counting again digitalWrite(TRIGGER_START_SAMPLE_PIN,HIGH); samplesVolts[--sample]=analogRead(VOLTS_IN_PIN); // decrement before capturing samplesCurrent[sample]=analogRead(CURRENT_IN_PIN); digitalWrite(TRIGGER_START_SAMPLE_PIN,LOW); if (!sample){ // count down to zero digitalWrite(TRIGGER_START_SAMPLE_PERIOD_PIN,LOW); // indicate that sampling is complete samplingEnd = micros(); TCCR1B &= 248; // turns off timer } } //------------------------------------------------------sampleOneCycle void sampleOneCycle(){ // back up timer registers uint8_t TCNT1_b = TCNT1; uint8_t TCCR1B_b = TCCR1B; uint8_t TCCR1A_b = TCCR1A; uint8_t TIMSK1_b = TIMSK1; // configure timer which starts the sampling noInterrupts(); // disable all interrupts TCCR1A = 0; TCCR1B = 0; TCNT1 = TimerPreloadValue; // preload timer //TCCR1B |= (1 << CS10)|(1 << CS12); // 1024 prescaler TCCR1B &= 248; // turns off timer? TIMSK1 |= (1 << TOIE1); // enable timer overflow interrupt ISR // demark sampling sample = NUMBER_OF_SAMPLES; // count down to zero digitalWrite(TRIGGER_START_SAMPLE_PERIOD_PIN,HIGH); samplingStart = micros(); TCNT1 = 65535; // first trigger right away! TCCR1B |= 1; // turns on timer interrupts(); // enable all interrupts // wait for sampling to be complete while(digitalRead(TRIGGER_START_SAMPLE_PERIOD_PIN)){}; samplingEnd = micros(); // restore timer registers TCNT1 = TCNT1_b; TCCR1B = TCCR1B_b; TCCR1A = TCCR1A_b; TIMSK1 = TIMSK1_b; }
-
Does MySensors require Arduino Timer 2?
I've been working on a low cost AC Energy Sensor. It consists of a 1:1 isolation transformer, a current transformer (CT), an Arduino Nano, some resistors and capacitors and a 90-to-260VAC to 5VDC power supply.
In order to make ~70 energy samples per cycle I use Timer 2 to initiate when to sample. One energy sample (one voltage, one current) takes about 0.2mSec. I have been succesful in doing this.
But when I integrate MySensors, my output stops just after the MySensors banner. I suspect that MySensors also uses Timer 2
I treat MySensors as a black box. For me, fiddling with libraries and what not is a deep, dark rabbit hole. I will be concentrating on "isolating" my use of Timer 2 by restoring the registers when I'm done taking samples.
Another alternative is to hang an ESP-1S off the serial port and let it pass the data to Home Assistant via my MQTT broker (or directly using ESPHome). Thus avoiding the use of MySensors. The cost of the nRf24 is almost the same as an ESP-1S
The ESP8266 has only one ADC limited to 1V and I need two. I could use two ESP-01S which cost less than a Nano?
So much for musing, what about IRQ's in MySensors?
OSD
-
Gateway stops communicating (again)
Re: RPI MQTT gateway stops communicating
My problem is similar, if not the same. Over some period of time, a week or so, the actuators that are part of the gateway stop receiving commands. The aforementioned topic indicates an unstable network, yet I ssh into the RPi and use systemctl to restart mysgw and the gateway starts acting on the sent commands. The RPi zero W does not have an ethernet port.
Because I can still ssh into the RPi, I don't think it's a network problem. At the moment, all is fine. What can I do to debug this problem next time it happens?
Thanks for your help,
OSD
My system is:
Raspberry Pi Zero W Rev 1.1
MySensors Library v2.4.0-alpha
configuration: --spi-driver=SPIDEV --my-gateway=mqtt --my-controller-ip-address=192.168.1.142 --my-port=1883 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-transport=rf24 --my-rf24-channel=121 --my-rf24-pa-level=RF24_PA_MAX -
RE: HVAC Controller
We are of like minds, Don't like the cloud based controls (that's another discussion).
In my case I have a Bryant/Connex system, heat pump, variable speed fan and 4 zones. There's a lot going on: the 4 zones creates 16 profiles. The fan speed for a profile will depend on the indoor and outdoor temperature. The thermal fluid pump also has to be controlled. A profile will have an optimal air pressure, so there's a sensor there.
The controller works just fine not being connected to the cloud. But I want to set the parameters remotely, Bryant/Connex can do this. I also wnat the status of the various actuators and sensors to show up in Home Assistant.
The signals sent over the RS422 are proprietary. My plan was to reverse-engineer the signals. After doing this I'll have to experiment to get the right mix of air pressue, fan speed and thermal fluid flow for each profile.
I'd like to do the same for my AO Smith heat pump water heater.
I'd like to follow your progress.
OSD
-
RE: Arduino Nano Every problem
I bought the Every because it implied it was backward compatible with the nano. No, it's not, as we found out.
Be that as it may, any word on a getting the Every working with mySensors?
-
RE: nano & E01-ML01SP4 gateway
I believe that what @monte is saying that there will probably be little future support for the nRF24 at MySensors. Having tried a different solution using the nano and the RF24 I am very impressed at the MySensors implementation.
I am uncertain if MySensors utilizes the IRQ capability of the nano/RF24. I assume not and I have found no need for it. That said, you do not want to connect the IRQ because doing so draws an extra 10-20mA! Doesn't sound like much, but in battery operations, people go to great effort to get rid of unnecessary circuitry (remove power LED, and 5V regulator, etc.)
@monte is saying to use both capacitors 4.7ฮผF electrolytic and 0.1ฮผF ceramic. I use only a 10ฮผF and am having good success, though if I were doing a circuit board, and going for robustness, I'd used both. Put them as close as you can to the radio. I would also seriously consider a ground plane layer.
I would recommend a socket for the radio. There is some variability in the RF24, mostly depending on manufacturer (particularly if you're getting them from AliExpress!) If your application is extreme, you'll want to sort through to find the one that works the best. (look for the one with the fewest NAKs),
I have tried put the nano in a socket and have had zero real success at having the radio work with it. I put shielding around it and had some pathetic improvement. I suspect that if you did put a socket for the nano on your board, you would need a ground plane.
You might want to bring out RX & TX which is handy in looking at the output when you're running off of a battery. I use this and connect the grounds and then nano RX to adapter TX.
Good luck with your project
OSD
-
Home Assistant "The notify.mysensors service will be removed"
OK fine (grrrrr) below you'll my implementation of an HA work around
But I find that the data is sent to a slightly different topic
mysensorsor-in/0/1/1/0/47
vs
mysensorsor-in/0/1/1/1/47
The data is still received because the code is looking for the sensor, but what's the difference?
MySensors device code (snippet)
#define CHILD_ID_ZONE 1 . . . void presentation(){ present(CHILD_ID_ZONE,S_INFO,"Zone"); } . . . void receive(const MyMessage &message){ if (message.getSender() == 0 ) { // Only listen to messages for device on gateway if (message.getSensor() == 1 ) { ZoneToWater = (int8_t)(message.getLong()); } } . . .}
Home Assistant script
alias: SendCustomToArduino description: >- notify.mysensors is deprecated Sends to topic mysensorsor-in/0/1/1/0/47 How to do the same thing using text.set_value service Sends to topic mysensorsor-in/0/1/1/1/47 sequence: - service: text.set_value target: entity_id: text.zone data: value: "12" - service: notify.mysensors data: message: 13 target: Zone mode: single
-
RE: ESP32 with LoRa
I am unfamiliar with an ESP32 as a MySensors sensor; though it certainly looks do-able.
Only because you won't be using the WiFi of the ESP32, I'd recommend an Arduino. The ESP32 requires 600mA.
Your radio will use up to 120mA (range of about 2km).
Of course, these power consideration aren't important if you have power at this remote location.
There are a couple of well documented hoops in getting the ESP32 board into the Arduino IDE.
On your RPi, I recommend using the MQTT interface with the MySensors Gateway. This will require an MQTT broker. You could use a public one (not recommended) or set up one on the computer that will be receiving the data into the database.
I use Home Assistant to receive data. MySensors integrates well into it. I admit that I don't know how to extract data from its database, but it provides an easy way to graph the data.
So it goes like this
-
Get the Arduino IDE
Load the ESP32 board
Select the ESP32 board
Using the library manager, download the MySensors library
Start with the example EnergyMeterPulseSensor because your wind speed sensor probably uses pulses. -
On the RPi you'll download the gateway files. The instructions here are pretty good
There are three steps,
configuration (which takes some thought)
compiling (make) (you can run the gateway at this point)
installing (make install) This makes the program run on boot -
Instructions for getting the MQTT broker installed and running are found by searching for "install MQTT broker" You'll need to know the the machine name and/or the IP address of the broker for both MySensors and Home Assistant
-
The learning curve for Home Assistant is tough. Don't be intimidated, you can do it.
Come back here if you need more help.
-
-
RE: make erring out on raspberry pi 2 b
@mrhutchinsonmn I'm not an expert on this code and when I get into a situation like yours, I suspect a corrupted file. So I download the MySensors code again.
Yeah it's a pain because you have it all configured. To minimize that pain, I create shell script to run the the configure program. I also keep my source files in a different directory from MySensors. When I go to compile the code, I copy the source(s) to the directory(ies) to where "make" expects it(them).
Sometimes, for me, I've bolluxed things so badly that I reimage the RPi and really start over! I try to document exactly how to start over.
I admit, it's not efficient nor elegant, but I eventually I get a configuration with which I can live. Documenting what I do is key!
-
testing with different controllers (mqtt brokers)
I run mysensors (ms) to an MQTT broker to Home Assistant (HA). My experience with MQTT has been great; it's simple and it's a easy way (using MQTT Explorer) to see the communication between ms and HA. ms has a reasonable way to watch the data flow. HA is another story, steep in necromancy, YAML, double secret persistence files, etc.
So once I get an HA configuration working, I don't want to mess with it. I have a "production" version of HA running devices and a "lab" version when I'm trying to integrate a new device. When I'm satisfied with how the device works in "the lab", I switch it over to "production".
Right now, what I do to change the MQTT broker for ms is to run the configure program, then "make" mysgw, just to change the MQTT broker. Is there an easier way, like changing an entry in a file?
-
RE: RFM95W sleep() directly after send() often doesn't sleep radio
@prawnpie This does not surprise me. I was losing data doing multiple sends in a row (node has multiple sensors). Putting a 500mS wait after each send() allowed the data to get through.
Also, 5mA for 1mS is not a significant draw on any battery (5mA * 1mS = 0.000002 mAh).
You could experiment with shorter wait times with
for (unsigned n = 1000;n>0;n--);
then keep lowering n until you find the threshold
And finally, assuming that the radio does have a flag to indicate that it is not ready to be put to sleep, it would be a real effort to put that into the libraries of all radios and the sleep command.
Waiting a milliSecond is actually the best solution and I am duly impressed you found it!
OSD
-
RE: Need a Guide to debug MySensor and Home Assistant
@esa1966
Sounds similar to the problems I was having. See if what I did works for you.Also, I think I remember seeing a variable that limits the number of connections to the gateway. MY_GATEWAY_MAX_CLIENTS ?
OSD
-
RE: Send/update Value from HA to Node
@esa1966 I make the assumption you're node is an Arduino
Are you using an interrupt to capture pulses? With this code, you might lose a count from time to time but that would be insignificant:
volatile uint32_t timeOfPulse = 0; volatile uint32_t pulseCount = 0; // a 32 bit number is good for about 70 years uint32_t pulseCountCurrent = 0; // for flow rate calculation uint32_t pulsePeriodThreshholdForFlowing = 150; // pulse period greater than 150 mSec is not flowing. #define FLOW_SAMPLING_TIME 1000 unsigned long flowSampleTimeStart = 0; bool flowing = true; volatile double flow = 0; volatile uint32_t flowCountStart = 0; volatile unsigned long flowPeriodStart = 0; #define DIGITAL_INPUT_SENSOR 3 // The digital input to which you attached your sensor. (Only 2 and 3 generates interrupt!) double countsPerLiter = 400.0; // double and float are the same on most arduinos /* DIGITEN G3/4" Brass Water Flow Sensor, Hall Effect Liquid Flow Meter Flowmeter Counter 1-30L/min * n = 6.6 * F=nQ L/M (from meter specs) * n * 60 is pulses (counts) per liter yeilds 400 pulse per leter * * flow rate 1-30 L/min (from specs) * * if time between pulses is greater than 0.15 seconds, there is no flow * * // Pulses per liter //-----------------------------------------------------------------------------------ISR onPulse void IRQ_HANDLER_ATTR onPulse(){ timeOfPulse=millis(); pulseCount++; } // make ISR as short as possible. //-----------------------------------------------------------------------------------setup void setup(){ pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, FALLING); } //-----------------------------------------------------------------------------------loop void loop() { uint32_t currentTime = millis(); // determine if water is flowing // if the time at this moment less than the spec threshhold, water is flowing flowing = (currentTime-timeOfPulse < pulsePeriodThreshholdForFlowing) ; // determine flow during this period and set maximum flow for all periods if ((currentTime - flowPeriodStart > FLOW_SAMPLING_TIME) && flowing ){ pulseCountCurrent = pulseCount; flow = double(pulseCountCurrent - flowCountStart)*1000.0/double(currentTime-flowPeriodStart)/countsPerLiter; flowCountStart = pulseCountCurrent; flowPeriodStart = currentTime; if (flow > maxFlow) maxFlow = flow; } if (SLEEP_MODE || (currentTime - previousSendTime > SEND_FREQUENCY)) { previousSendTime = currentTime; pulseCountCurrent = pulseCount; // MySensors sends here if (flowing) Serial.print(" "); else Serial.print("NOT"); Serial.print(F("Flowing")); Serial.print(F(" Pulse Count: ")); Serial.print(pulseCountCurrent); Serial.print(F(" volume:")); Serial.print(volume, 3); Serial.print(F(" Maxium flow: ")); Serial.print(maxFlow); maxFlow = 0.0; // reset max flow. Serial.println(); } }
Having HA send data is not so trivial
On your Arduino you'll have something like this code:
#define CHILD_ID1 1 MyMessage msgCustom(CHILD_ID1, V_TEXT); #define DELAY_AFTER_SENDS 500 bool initialValueSent = false; int msgCount =0; //--------------------------------------------------------------------------------setup void setup(void) { } //--------------------------------------------------------------------------------presentation void presentation() { // Send the sketch version information to the gateway sendSketchInfo( "PROGRAM_NAME",1.0 ); delay(DELAY_AFTER_SENDS); present(CHILD_ID1, S_INFO, "CustomSensor1"); /* TextSensor1 will be used as the target. YAML script sends "Data from script" to actuator alias: SendToArduino sequence: - service: notify.mysensors data: message: Data from script target: CustomSensor1 mode: single */ } //--------------------------------------------------------------------------------loop void loop() { if (!initialValueSent) { Serial.println("Sending initial value"); // Send initial message as per Home Assistant docs. send(msgCustom.set(0)); delay(DELAY_AFTER_SENDS); } } //--------------------------------------------------------------------------------receive void receive(const MyMessage &message) { if (message.type == V_TEXT) { if (!initialValueSent) { Serial.println("Receiving initial value from controller"); initialValueSent = true; } // Dummy print Serial.print("Message: "); Serial.print(message.sensor); Serial.print(", Message: "); Serial.println(message.getString()); // Send message to controller send(msgText.set(message.getString())); delay(DELAY_AFTER_SENDS); } Serial.print(F("count: "));Serial.println(++msgCount); Serial.print(F("Type: "));Serial.println(message.getType()); Serial.print(F("Data: "));Serial.println(message.data); Serial.print(F("Long: "));Serial.println(message.getLong()); Serial.print(F("Float: "));Serial.println(message.getFloat()); Serial.print(F("Sensor: "));Serial.println(message.getSensor()); Serial.print(F("isAck: "));Serial.println(message.isAck()); }
The commented out code starting with "alias" is the YAML script that will be used to send your data. Note that in this example, "Data from script" is the data that will be sent.
One annoying thing is that the service "notify.mysensors" can't be found until after you've run the Arduino code. But then, now that you know what the service is, you can probably just put it in your code and see what happens.
Good luck
OSD
-
RE: Local Sensors on Raspberry Pi Gateway
I finally got it to work. Look at my post on the Home Assistant forum.
There is an amazing thing that someone in the MySensors world did that makes RPi I/O very easy! Just like the Arduino, one uses the code:
pinMode(MphysicalPin, OUTPUT);
I couldn't believe my eyes when I saw that. And then got double flabbergasted when I discovered that pin is the physical pin of the RPi! No mapping of GPIOi to the pins.
Whew!So the I/O was easier than both of us could have imagined! @mfalkvidd if you know who did this, send them praise and thanks.
OSD
-
RE: completely remove MySensors integration for HA and start over
@OldSurferDude I posted this question in the Home Assistant forum, too. I figured it out! See my post in HA
OSD
-
completely remove MySensors integration for HA and start over
I am trying to completely redo the integration. The current integration works, but I am unable to have nodes as part of the gateway. I hoping that starting over from scratch might work. 1st I stop the MySgw. then I delete the integration. This does not delete the persistent data; using Studio Code Server, I delete MySensors data. Next I delete the MySensors topics from the MQTT broker. Finally, I reboot Home Assistant. (In terminal execute reboot) when the reboot is complete, I re-integrate MySensors, ensuring that the version, "in" topics and "out" topics are identical to the MySgw. Then I restart the gateway. The data is getting the MQTT broker, but not to HA. Of course I backed up before doing this and when I do the full restore, all is working as it was before. I expect I should be able to start from scratch. What am I doing wrong?
-
RE: Did HA just give up on MySensors?
@Dbagioni Interesting. I'm having similar symptoms, but I can still connect new nodes.
I found that if a node somehow disappears from the Overview, it may still be in the persistent file. In HA, using "Studio Code Server", one will see an entry "mysensors123423e3q132" (or something like that. the first line will be
"0": {
and a few lines down a closing
}
which is the information for the gateway.
Look for your node: "node_id": { My experience has been if it is not found, one can add a node with that node_idBut if you do find it and the node is not one of the devices in under the my sensors integration (SettingsโDevices & ServicesโMySensors/5 devicesโSoilMoistSensor node_id), get ready to jump through some hoops.
Here's what I do. I have an Arduino with a radio already wired. First, I program address 0 of the EEPROM with the errant node_id. See addressUnit.ino below. Then I load the MySensors example SoilMoistSensor onto the Arduino. and run it. At this point, I can see the node in HA under the mysensors integration as SoilMoistSensor node_id. (This node is going to be deleted, but before this is to be done, one must reprogram the Arduino so the it doesn't recreate the node. addressUnit.ino would be a good program to use to over write the SoilMoistSensor program.) Ok, now Click on it. Right below Device info you'll see DELETE in red. Click on that. For me this also removes the code from the persistent file. Then a new device with node_id can be created.
You can try, but I have not been successful at deleting the code in the persistent file. It seems that there is a persistent, persistent file which repopulates the persistent file.
addressUnit.ino
#define Ver 1.0 #include <EEPROM.h> // ------------------------------------------------------------------------------------clearSerialBuffer void clearSerialBuffer(){ while(Serial.available()){ Serial.read(); delay(50); } } // ------------------------------------------------------------------------------------header void header(){ uint8_t EEpromInt = EEPROM.read(0); Serial.print(F("Current value at address (0) is ")); Serial.println(EEpromInt); clearSerialBuffer(); Serial.print(F("Enter a an unsigned integer >0 and <254: ")); } // ------------------------------------------------------------------------------------setup void setup() { Serial.begin(115200); Serial.print(F("\n\rAddress As uint8_t ver ")); Serial.println(Ver); clearSerialBuffer(); header(); } // ------------------------------------------------------------------------------------loop void loop() { if (Serial.available()){ long inInt = Serial.parseInt(); if (inInt <= 0 || inInt >=254){ Serial.print(F(" I don't like '")); Serial.print(inInt); Serial.println(F("'")); } else { EEPROM.write(0,uint8_t(inInt)); } header(); } }
This is what I posted on HA Discord under "installation"
HA with MySensors integration (MQTT). I am trying to completely redo the integration. The current integration works, but I am unable to have nodes as part of the gateway. I hoping that starting over from scratch might work. 1st I stop the MySgw. then I delete the integration. This does not delete the persistent data; using Studio Code Server, I delete MySensors data. Next I delete the MySensors topics from the MQTT broker. Finally, I reboot Home Assistant. (In terminal execute reboot) when the reboot is complete, I re-integrate MySensors, ensuring that the version, "in" topics and "out" topics are identical to the MySgw. Then I restart the gateway. The data is getting the MQTT broker, but not to HA. Of course I backed up before doing this and when I do the full restore, all is working as it was before. I expect I should be able to start from scratch. What am I doing wrong?
When you ask your question, you have to remember that these programs are maintained by volunteers like you and me. The more complicated the change, the longer it will take to have a working change in place.
If this is problem for you, then you should look at Universal-Devices Polisy. It's a good device and holds a lot of promise and is much better supported.
For me, I'm holding my breath. Hopefully someone at HA or MySensors knows the trick.
-
RE: ๐ฌ Building a Orange Pi Gateway
I saw this page and thought I give it a go. So I bought two OrangePi Zero 2. There's a lot of potential (WiFi) as a dedicated gateway. Currently the price is about US$20 on AliExpress (caveat emptor) There are a few flavors of Linux for it. I've dabbled with Armbian, Ubuntu and Debian
Another upside is that it doesn't draw a lot of current ~0.5A, though I haven't been successful in getting the radio to run (the reason for me being here) This is also a downside as I suspect the power supply needs to be very close to 5V. Thinking it was a power hog like the RPi, I used a 5V-3A supply. This supply operates on the principle that the load will pull down the voltage. There are dire warnings on the orangepi page about using cheap SD cards, but failed to mention that power supplies have to be matched, too.
It has a different CPU than the Orange Pi Zero non-2, the board that is used here.
Use the serial interface to configure the board. You're going to be doing all your configuration in a terminal, anyway, so you don't need a monitor or a keyboard. https://www.instructables.com/Setup-Orange-Pi-Using-Serial-Port/
The big downside is that the SPI interface is not supported. My research indicates that in order to get it to work one must jump through some serious hoops and being low on the learning curve, those hoops are probably out of my reach. https://forum.armbian.com/topic/21688-tips-on-configuring-double-spi-through-two-chipselects-on-orange-pi-zero-2/
The armbian OS has another big downside, WiFi is not supported. Putting a TP-Link nano router configured as a client works, but it's another $30! Why did they even release the OS?
So! Was anyone successful in getting the Orange Pi Zero 2 configured as a gateway?
-
RE: No LAN connection ESP8266 gateway
When I saw 2.6.2 I was thinking the MySensors Library (2.3.2)! It never occurred to me it was the board manager.
So, yes! it works for me.
I just checked to see if Domoticz has an MQTT interface and it appears that it does. @Bramz, look into that. Once you have that, then it may be easy to connect other devices, like Tasmota devices, to Domoticz. MQTT requires an always-on computer connected to your network.
I have a headless (needs dummy monitor plug or 3x 75ฮฉ resistors to boot), refurbished computer on which I run Linux OS, then both MQTT and Home Assistant running in Virtual Box.
Thanks everyone!
OSD
-
RE: No LAN connection ESP8266 gateway
@Bramz I'm fairly new to MySensors. As it is supported by volunteers, like you and me and @mfalkvidd, some code doesn't get updated when there's a version change, the code update often happens when someone notices that the code needs to be updated. I suspect that this is the case here.
I'd be glad to help out, but not knowing the in's and out's of things, I can pretty much only verify code for which I have hardware.
OSD
-
RE: No LAN connection ESP8266 gateway
@Bramz I am not an expert, but I can verify your findings. This looks like a serious bug in the MySensors code.
OSD
-
RE: No LAN connection ESP8266 gateway
@Bramz @mfalkvidd I was curious about this and tried to see if it worked for me. I have the same results as @Bramz ! I can only see the output, though, when I set the monitor baud rate to 74880
This is the same for the ESP8266Gateway and the ESP8266GatewayMQTTclient examples
I tried it with the radio connected and without.
On the Building a WiFi Gateway using ESP8266 one is instructed to "Install CP2102 drivers from here" but "here" is a dead link This is the driver for Windows in order for the nodeMCU to be seen as a serial port. So this is not the problem.
I tried another example file-->examples-->ESP8266-->interactive and it worked as described. But this is not a MySensors example.
-
RE: HassOS + Serial Gateway OR Docker + RPI Ethernet Gateway
Thanks @mfalkvidd! I just automatically made the assumption the any app on a phone is cloud based. A personal myth busted, for which I express my appreciation!
OSD
-
RE: Please I need some help
Doing a google search I found this. I have been down that road and it is totally cool. But time consuming and arcane. My problem was connecting to databases, and making the data useful for other devices.
So for a lot less headache, debugging and tweaking, I chose MySensors, MQTT, VirtualBox and Home Assistant. Don't get me wrong, my choice is still a lot of H,D&T, but less. And I have connectivity.
You will learn a lot. Embrace.
OSD
-
RE: HassOS + Serial Gateway OR Docker + RPI Ethernet Gateway
I had a similar conundrum, though it was Z-Wave instead of Zigbee.
I have a concern that an RPI is not sufficiently robust. This may be unfounded because there are a lot of amazing things that people do with it. Be that as it may, I found a refurbished PC on Amazon for under $100, well under the current price of an RPi! (I bought the $10, 2 year warrantee, too) On this I installed Virtualbox and installed Home Assistant OS on it. I allocated a USB port for the virtual machine and plugged in a Z-Wave dongle.
The downside of the computer is that the video is VGA, so one needs a VGA monitor (and mouse and keyboard) to set it up. The computer is run headless and I remote into it with VNC, thus the VNC server process is also running on it. The free version of RealVNC allows five server licenses, and unlimited viewers.
I like the concept of using MQTT and chose that over serial. Also because because the computer is located in the garage and the gateway needs to be on the other side of the house near my sensors and actuators which are in the back yard. So, I run the gateway on my RPi (the one I bought for $35). My MQTT broker runs as a separate process on this computer, "next" to Virtualbox.
Note that the gateway can run on an Arduino Nano which could be plugged into this computer which would be, not only a cost effective solution, but IMHO, more robust. (I just had a thought, run HAOS on the RPi and plug the Nano into the RPi ... would this work?)
So when I'm working out in my yard, I VNC into this computer with my phone, pull up Firefox to bring up the HA interface and view and control my devices in the yard. (Think HA has an app, but I haven't tried it ... I don't like cloud based apps.)
Just some thoughts for you.
Good luck on your project!
OSD
-
RE: Send configuration (numbers) from HA to Arduino
@electrik Thanks, I think I can do the same with the MQTT integration (not MySensors MQTT)
OSD
-
RE: Send configuration (numbers) from HA to Arduino
@mfalkvidd
I still don't see how to send a 4 byte value.If I have an LED, the message variable type is V_STATUS, the presentation variable is S_BINARY and the request variable is V_STATUS, and the receive variable is V_STATUS. This will set up a nice toggle switch under Controls in Home Automation. (Home Assistant-->Settings-->Devices & Services-->Devices-->"(my device name [node id])"--> )
What V_variable/S_variable combination yields a control in Home Assistant?
Let us suppose my node ID is 71, and my child id is 5. There will appear as a toggle control in Home Assistant. If I publish to the MQTT broker the topic mysensors-in/71/5/1/1/2 (2 being the number associated with V_STATUS) with a payload of 1, my LED turns on. Yeah!
Now I set up a V_CUSTOM/S_CUSTOM device at child ID 3. This appears as a Sensor in Home Assistant, not as a control. If I publish to the MQTT broker the topic mysensors-in/71/3/1/1/48 (48 being the number associated with V_CUSTOM) the payload 1280, it arrives at my device and it deals with it as expected.
Thus my question: "What V_variable/S_variable combination that yields a control in Home Assistant?" Oh, and have Home Assistant be able to send an unsigned long?
I suspect that that capability has yet to be developed for the MySensors Integration in Home Assistant. I'd like to know if this is the case. Perhaps I can figure out how to have Home Assistant send the MQTT message for me?
Thanks for your consideration!
OSD
-
RE: Send configuration (numbers) from HA to Arduino
@mfalkvidd Thanks for the tip! It led me to the Home Assistant page that explains how to do it. I'll be having a look at that and report back what I find.
-
Send configuration (numbers) from HA to Arduino
I would like to make changes to my Arduino sensor after it is deployed. I have developed an autocalibration scheme, but it needs its zero point set, which can't be done until it's in its final location. Yes, I suppose I could, with long wires, connect a push button to an input. But that doesn't completely solve the problem because I need to send a number that can be interpreted to be the interval between sending data to HA.
This is my receive routine:
//-------------------------------------------------------------------------receive void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.getType()==V_VAR1) { ConfigurationFromMySensors = message.getLong(); } }
In HA, I would pack the information in a 4 byte integer (long) and unpack it in the loop where I would operate on it as needed.
But how do I send the 4 byte integer from HA?
Thanks for your consideration and hopefully, help!
OSD
-
RE: Sensor to measure amount of dripping water?
A small flow meter with a solenoid valve. Daily, open the valve and count the counts coming from the flow meter (400 counts/L).
A series of level sensors (~$2 ea) might work, too. Again, a solenoid valve.
I have to admit, a tipping bucket would be cost effective because it doesn't require a solenoid valve. but it wouldn't have the accuracy of the flow meter. The level sensors is kind of kludgy.
OSD
-
RE: MySensors --> MQTT --X Home Assistant
Changing the node number did it!
New question! How do I remove a used node number from HA? (seriously!)
OSD
Code used to change node number:
#define Ver 1.0 #include <EEPROM.h> char inChar; // ------------------------------------------------------------------------------------clearSerialBuffer void clearSerialBuffer(){ while(Serial.available()){ Serial.read(); delay(200); } } // ------------------------------------------------------------------------------------expressChar void expressChar(){ Serial.print(inChar); Serial.print(F("'("));Serial.print(uint8_t(inChar));Serial.println(F(")")); } // ------------------------------------------------------------------------------------header void header(){ inChar = EEPROM.read(0); Serial.print(F("Current character at address (0) is '")); expressChar(); clearSerialBuffer(); Serial.print("Enter a character: "); } // ------------------------------------------------------------------------------------setup void setup() { Serial.begin(115200); Serial.print("\n\rAddress As Character ver "); Serial.println(Ver); header(); } // ------------------------------------------------------------------------------------loop void loop() { if (Serial.available()){ inChar = Serial.read(); if (inChar <= 32 || inChar >=127){ Serial.print(F("I don't like '")); expressChar(); } else { EEPROM.write(0,uint8_t(inChar)); } header(); } }
-
RE: MySensors --> MQTT --X Home Assistant
Yes, I did. The data has been sent many times.
I did think of something. This Arduino Uno formerly was another sensor and did connect to HA. I will try changing the node number by writing a different number in the first memory location of the Uno's EEPROM.
Meanwhile:
Here is my presentation code:
void presentation() { char VERstr[10]; dtostrf(VER,9,2,VERstr); // Send the sketch version information to the gateway and Controller sendSketchInfo("Solar Monitor", VERstr); // Register this device as Water flow sensor present(CHILD_ID, S_POWER); }
This partial image of MQTT Explorer shows that the data did arrive on the broker
Your link suggest to turn on the debug logger.
"
If you experience dropped messages or that a device is not added to Home Assistant, please turn on debug logging for the mysensors integration and the mysensors package. This will help you see what is going on. Make sure you use these logging settings to collect a log sample if you report an issue about the mysensors integration in our GitHub issue tracker.logger: default: info logs: homeassistant.components.mysensors: debug mysensors: debug
"
I find this typical of HA, in its assumption that everyone knows everything about HA. I know very little of the in's and out's of HA. Where do I find this file that needs to be modified? Does HA have to be rebooted once the file is modified? Once the code is operational, where do I find the log file that will be generated when these commands are invoked? How do I get to the github issue tracker to report the issue?
Thanks for the help!
OSD
-
MySensors --> MQTT --X Home Assistant
- The source of the data is a PVPowered Inverter
- The PVM1010 MODULE in the inverter can send the data as UDP datagrams.
- A TP-link micro router connects the module to a network
- The network router provides module with an IP address via DHCP
- An Arduino Uno with an W5100 ethernet shield and nRF24 Radio with MySensors and custom software acts as a go-between to an MQTT broker on the network.
- Once the data is on the MQTT broker, Home Assistant picks up the data
It is this last step that is not working. HA is just not seeing the new sensors, like they are not there. Has anyone else seen this? How do I get HA to see the new sensors?
(Yes, this seems to be an HA issue, and I have the question asked there. I am in hopes that someone that has experienced this problem came up with a solution.)
-
RE: Is Ethernet shield for Nano usable in any way?
I use a Nano, Ethernet, LCD display, and GPS for an NTP server on my isolated network to provide the time for [suspect] cameras.
#define VER 12.2 bool debug = false; // must be true to have debug statements go to serial /* NTP Time Server: Modified by Gregg Ferry using softwareserial instead of Serial1 using GY-GPS6MV2 This code is in the public domain. ver 12 time server gets time from Arduino clock instead of from gps */ #define enableEthernet false #define enableGPS true #define enableDisplay true #define minimizeSerialTraffic true #if enableEthernet // ethernet #include <SPI.h> // needed for Arduino versions later than 0018 #include <Ethernet.h> #include <EthernetUdp.h> // UDP library from: bjoern@cs.stanford.edu 12/30/2008 // Time Server MAC address byte mac[] = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; // NTP Server public IP Address IPAddress ip(192, 168, 2, 130); // Time Server Port #define NTP_PORT 123 unsigned int localPort = 123; static const int NTP_PACKET_SIZE = 48; // buffers for receiving and sending data byte packetBuffer[NTP_PACKET_SIZE]; // An Ethernet UDP instance EthernetUDP Udp; int packetSize; // NTP since 1900/01/01 //#include <PGMWrap.h> //const uint8_t daysInMonth [] PROGMEM = { 31,28,31,30,31,30,31,31,30,31,30,31 }; //const or compiler complains const uint8_t daysInMonth [] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; //const or compiler complains const unsigned long seventyYears = 2208988800UL; // to convert unix time to epoch #endif #if enableGPS // GPS #include <TinyGPS++.h> //GPS instance TinyGPSPlus tinyGPS; #include <NeoSWSerial.h> //#include <SoftwareSerial.h> #define rxPin 5 #define txPin 4 NeoSWSerial GPSSerial(rxPin, txPin); // CONNECT BT RX PIN TO ARDUINO txPin | CONNECT BT TX PIN TO ARDUINO rxPin char incharBefore=255; char inchar=255; #endif #if enableDisplay // Display #include "SSD1306Ascii.h" #include "SSD1306AsciiAvrI2c.h" #define I2C_ADDRESS 0x3C SSD1306AsciiAvrI2c oled; #endif bool TimeHasBeenSet = false; bool firstPass = true; //Time #include <Timezone.h> //#include "Time.h" TimeChangeRule myDST = {"PDT", Second, Sun, Mar, 2, -420}; // Daylight time = UTC - 7 hours TimeChangeRule mySTD = {"PST", First, Sun, Nov, 2, -480}; // Standard time = UTC - 8 hours Timezone myTZ(myDST, mySTD); TimeChangeRule *tcr; // pointer to the time change rule, use to get TZ abbrev time_t local; String timeString = "hh:mm:ss"; String dateString = "yyyy MMM dd"; const String localDaysOfWeek[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" }; const String localMonthsOfYear[] = {"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"}; uint8_t localDayOfWeek; uint8_t previousHour = 0; uint8_t previousMinute = 0; uint8_t previousSecond = 0; unsigned long timestamp1970; //-----------------------------------------------------------------------------------printTimes void printTimes(){ Serial.print(F("GPS ")); Serial.print(tinyGPS.date.year());Serial.print(F("/")); Serial.print(tinyGPS.date.month());Serial.print(F("/")); Serial.print(tinyGPS.date.day());Serial.print(F(" ")); Serial.print(tinyGPS.time.hour());Serial.print(F(":")); Serial.print(tinyGPS.time.minute());Serial.print(F(":")); Serial.println(tinyGPS.time.second()); Serial.print(F("UTC ")); Serial.print(year());Serial.print(F("/")); Serial.print(month());Serial.print(F("/")); Serial.print(day());Serial.print(F(" ")); Serial.print(hour());Serial.print(F(":")); Serial.print(minute());Serial.print(F(":")); Serial.println(second()); Serial.print(F("local ")); Serial.print(year(local));Serial.print(F("/")); Serial.print(month(local));Serial.print(F("/")); Serial.print(day(local));Serial.print(F(" ")); Serial.print(hour(local));Serial.print(F(":")); Serial.print(minute(local));Serial.print(F(":")); Serial.println(second(local)); Serial.print(F(" ")); Serial.print(dateString);Serial.print(F(" ")); Serial.println(timeString); } //-----------------------------------------------------------------------------------setTimeAndDateStrings void setTimeAndDateStrings(){ local = myTZ.toLocal(now(), &tcr); // two days ago -172800 char buf[32]; sprintf(buf, "%.2d:%.2d:%.2d",hour(local), minute(local), second(local)); timeString = String(buf); // char m[4]; // temporary storage for month string (DateStrings.cpp uses shared buffer) // strcpy(m, monthShortStr(month(local))); // sprintf(buf, "%.2d %s %d",day(local), m, year(local)); // dateString = String(buf); sprintf(buf, "%.2d ",day(local)); dateString = String(buf); dateString += localMonthsOfYear[month(local)-1]; sprintf(buf," %d",year(local)); dateString += String(buf); localDayOfWeek = weekday(local)-1; } #if enableGPS //-----------------------------------------------------------------------------------getgps static bool getgps() { // and update arduino time if (GPSSerial.available()==0) return false; // while (GPSSerial.available()) { incharBefore = inchar; inchar = GPSSerial.read(); tinyGPS.encode(inchar); if (!TimeHasBeenSet) Serial.print(inchar); // } if ((inchar != 10) || (incharBefore != 13)) return false; // make sure to full NMEA statement was received inchar = 0; incharBefore = 0; // NMEA statement received, reset terminators if(tinyGPS.time.isValid()){ /* * setTime( tinyGPS.time.hour(), tinyGPS.time.minute(), tinyGPS.time.second(), tinyGPS.date.day(), tinyGPS.date.month(), tinyGPS.date.year() ); */ int hh=tinyGPS.time.hour(); int mm=tinyGPS.time.minute(); int ss=tinyGPS.time.second(); int DD=tinyGPS.date.day(); int MM=tinyGPS.date.month(); int YY=tinyGPS.date.year(); setTime(hh,mm,ss,DD,MM,YY); local = myTZ.toLocal(now(), &tcr); //get the local time setTimeAndDateStrings(); if (!TimeHasBeenSet) printTimes(); TimeHasBeenSet = true; return true; } else { return false; } } #endif #if enableDisplay //-----------------------------------------------------------------------------------displayGPStimeSetTheTime void displayGPStimeSetTheTime(bool TimeSetByGPS){ oled.setCursor(0,0); // Start at top-left corner if (TimeSetByGPS) oled.print(F(" ")); else oled.print(F("!")); } //-----------------------------------------------------------------------------------displayAwaitingGPS void displayAwaitingGPS() { oled.clear(); oled.setCursor(0,0); // Start at top-left corner oled.println(F("NTP Server")); oled.println(F(" Awating")); oled.println(F(" GPS Lock ")); Serial.println(F(" Awating GPS Lock ")); } //-----------------------------------------------------------------------------------displayNewDay void displayNewDay(){ previousHour = hour(local); previousMinute= minute(local); previousSecond = second(local); oled.clear(); oled.setCursor(12,0); // center time string oled.print(timeString); uint8_t s = (10-localDaysOfWeek[localDayOfWeek].length())*6; oled.setCursor(s,3); oled.print(localDaysOfWeek[localDayOfWeek]); oled.setCursor(0,6); oled.print(dateString); } //-----------------------------------------------------------------------------------displayTime void displayTime(){ // digital clock display of the time if ((second(local)==0 && minute(local)==0 && hour(local)==0) || firstPass){ // new day firstPass = false; displayNewDay(); } else { if (hour(local) != previousHour){ previousHour = hour(local); oled.setCursor(12,0); oled.print(timeString); } else { if (minute(local) != previousMinute){ previousMinute= minute(local); oled.setCursor(48,0); oled.print(timeString.substring(3)); } else { if (second(local) != previousSecond){ previousSecond = second(local); oled.setCursor(84,0); oled.print(timeString.substring(6)); } } } } } // send to serial monitor #else void displayGPStimeSetTheTime(bool TimeSetByGPS){ } void displayAwaitingGPS() { Serial.println(F(" Awating GPS Lock ")); } void displayTime(){ #if !minimizeSerialTraffic Serial.println(); printTimes(); #endif } #endif //-----------------------------------------------------------------------------------setup #if enableEthernet void setupEthernet(){ // start the Ethernet and UDP: Ethernet.begin(mac,ip); Udp.begin(localPort); Serial.print(Ethernet.localIP()); Serial.print(F(" "));Serial.println(NTP_PORT); } #endif #if enableGPS void setupGPS(){ GPSSerial.begin(9600); // start GPS module UART // Disable everything but $GPRMC // Note the following sentences are for UBLOX NEO6MV2 GPS GPSSerial.write("$PUBX,40,GLL,0,0,0,0,0,0*5C\r\n"); GPSSerial.write("$PUBX,40,VTG,0,0,0,0,0,0*5E\r\n"); GPSSerial.write("$PUBX,40,GSV,0,0,0,0,0,0*59\r\n"); GPSSerial.write("$PUBX,40,GGA,0,0,0,0,0,0*5A\r\n"); GPSSerial.write("$PUBX,40,GSA,0,0,0,0,0,0*4E\r\n"); } #endif #if enableDisplay void setupDisplay(){ oled.begin(&Adafruit128x64, I2C_ADDRESS); oled.setFont(System5x7); oled.set2X(); } #endif void setup() { Serial.begin(115200); Serial.print("NTP Server with display version ");Serial.println(VER); #if enableDisplay setupDisplay(); #endif displayAwaitingGPS(); #if enableEthernet setupEthernet(); #endif #if enableGPS setupGPS(); #endif } //-----------------------------------------------------------------------------------loop void loop() { /* while (Serial.available()){ char inChar = Serial.read(); if (inChar == 'd' || inChar == 'D') { debug = !debug; if (debug) Serial.println(F("debug is ON"));else Serial.println(F("debug is off")); } } */ #if enableGPS if (getgps()){ if(TimeHasBeenSet) displayTime(); } #endif #if enableEthernet // if there's data available, read a packet packetSize = Udp.parsePacket(); if(packetSize) processNTP(); #endif } #if enableEthernet //-----------------------------------------------------------------------------------numberOfSecondsSince1900Epoch unsigned long int numberOfSecondsSince1900Epoch(uint16_t y, uint8_t m, uint8_t d, uint8_t h, uint8_t mm, uint8_t s) { if (y >= 1970) y -= 1970; uint16_t daysLocal = d; for (uint8_t i = 1; i < m; ++i) daysLocal += daysInMonth[i - 1]; // for (uint8_t i = 1; i < m; ++i) // daysLocal += pgm_read_byte(daysInMonth + i - 1); if (m > 2 && y % 4 == 0) ++daysLocal; daysLocal += 365 * y + (y + 3) / 4 - 1; return daysLocal*24L*3600L + h*3600L + mm*60L + s + seventyYears; } //-----------------------------------------------------------------------------------processNTP void processNTP() { Udp.read(packetBuffer,NTP_PACKET_SIZE); IPAddress Remote = Udp.remoteIP(); int PortNum = Udp.remotePort(); /* if (debug) { Serial.println(); Serial.print("Received UDP packet size "); Serial.println(packetSize); Serial.print("From "); for (int i =0; i < 4; i++) { Serial.print(Remote[i], DEC); if (i < 3) { Serial.print("."); } } Serial.print(", port "); Serial.print(PortNum); byte LIVNMODE = packetBuffer[0]; Serial.print(" LI, Vers, Mode :"); Serial.print(packetBuffer[0],HEX); byte STRATUM = packetBuffer[1]; Serial.print(" Stratum :"); Serial.print(packetBuffer[1],HEX); byte POLLING = packetBuffer[2]; Serial.print(" Polling :"); Serial.print(packetBuffer[2],HEX); byte PRECISION = packetBuffer[3]; Serial.print(" Precision :"); Serial.println(packetBuffer[3],HEX); for (int z = 0; z < NTP_PACKET_SIZE; z++) { Serial.print(packetBuffer[z],HEX); if (((z+1) % 4) == 0) { Serial.println(); } } Serial.println(); } // end of debug statements */ packetBuffer[0] = 0b00100100; // LI, Version, Mode packetBuffer[1] = 1 ; // stratum packetBuffer[2] = 6 ; // polling minimum packetBuffer[3] = 0xFA; // precision packetBuffer[7] = 0; // root delay packetBuffer[8] = 0; packetBuffer[9] = 8; packetBuffer[10] = 0; packetBuffer[11] = 0; // root dispersion packetBuffer[12] = 0; packetBuffer[13] = 0xC; packetBuffer[14] = 0; /* uint16_t y=year(); uint8_t m=month(); uint8_t d=day(); uint8_t h=hour(); uint8_t mm=minute(); uint8_t s=second(); if (y >= 1970) y -= 1970; uint16_t daysLocal = d; for (uint8_t i = 1; i < m; ++i) daysLocal += daysInMonth[i - 1]; if (m > 2 && y % 4 == 0) ++daysLocal; daysLocal += 365 * y + (y + 3) / 4 - 1; timestamp1970 = daysLocal*24L*3600L + h*3600L + mm*60L + s + seventyYears; */ // uint16_t utcYY=year(); // uint8_t utcMM=month(); // uint8_t utcDD=day(); // uint8_t utchh=hour(); // uint8_t utcmm=minute(); // uint8_t utcss=second(); // timestamp1970 = numberOfSecondsSince1900Epoch(utcYY,utcMM,utcDD,utchh,utcmm,utcss); // timestamp1970 = numberOfSecondsSince1900Epoch(2022,4,30,10,10,10); timestamp1970 = numberOfSecondsSince1900Epoch(year(),month(),day(),hour(),minute(),second()); /* * timestamp1970 = numberOfSecondsSince1900Epoch( tinyGPS.date.year(), tinyGPS.date.month(), tinyGPS.date.day(), tinyGPS.time.hour(), tinyGPS.time.minute(), tinyGPS.time.second() ); */ unsigned long tempval = timestamp1970; packetBuffer[12] = 71; //"G"; packetBuffer[13] = 80; //"P"; packetBuffer[14] = 83; //"S"; packetBuffer[15] = 0; //"0"; // reference timestamp1970 packetBuffer[16] = (tempval >> 24) & 0XFF; tempval = timestamp1970; packetBuffer[17] = (tempval >> 16) & 0xFF; tempval = timestamp1970; packetBuffer[18] = (tempval >> 8) & 0xFF; tempval = timestamp1970; packetBuffer[19] = (tempval) & 0xFF; packetBuffer[20] = 0; packetBuffer[21] = 0; packetBuffer[22] = 0; packetBuffer[23] = 0; //copy originate timestamp from incoming UDP transmit timestamp packetBuffer[24] = packetBuffer[40]; packetBuffer[25] = packetBuffer[41]; packetBuffer[26] = packetBuffer[42]; packetBuffer[27] = packetBuffer[43]; packetBuffer[28] = packetBuffer[44]; packetBuffer[29] = packetBuffer[45]; packetBuffer[30] = packetBuffer[46]; packetBuffer[31] = packetBuffer[47]; //receive timestamp packetBuffer[32] = (tempval >> 24) & 0XFF; tempval = timestamp1970; packetBuffer[33] = (tempval >> 16) & 0xFF; tempval = timestamp1970; packetBuffer[34] = (tempval >> 8) & 0xFF; tempval = timestamp1970; packetBuffer[35] = (tempval) & 0xFF; packetBuffer[36] = 0; packetBuffer[37] = 0; packetBuffer[38] = 0; packetBuffer[39] = 0; //transmitt timestamp packetBuffer[40] = (tempval >> 24) & 0XFF; tempval = timestamp1970; packetBuffer[41] = (tempval >> 16) & 0xFF; tempval = timestamp1970; packetBuffer[42] = (tempval >> 8) & 0xFF; tempval = timestamp1970; packetBuffer[43] = (tempval) & 0xFF; packetBuffer[44] = 0; packetBuffer[45] = 0; packetBuffer[46] = 0; packetBuffer[47] = 0; // Reply to the IP address and port that sent the NTP request Udp.beginPacket(Remote, PortNum); Udp.write(packetBuffer,NTP_PACKET_SIZE); Udp.endPacket(); } #else void processNTP() {} #endif
-
RE: Find Parent (yeah, I know)
I plugged a Nano into a nano carrier and connected an nRF24l01 to the carrier. I never got it to work well, but had some improvement when I surrounded all the leads with aluminum foil.
I soldered a 30cm section of cat 5 cable to the nano, put a connector on the other end soldered a connector. On the radio I soldered right angle pins and a 10ฮผ electrolytic cap between GND and VCC and that worked great! Also, used 10cm of ribbon cable between an RPi and the same radio and that worked great, too!
You might consider making one side of your PCB a ground plane. And/or the other side a 5V or 3.3V plane.
-
RE: ๐ฌ Building a MQTT Gateway
I don't have a solution, but I, too, may run into that problem. So I'm curious how it can be resolved.
Perhaps post in the Hardware or Development sections. Fortunately, some really knowledgeable people (eg. @mfalkvidd and @NeverDie ) monitor pretty much all of the forum subjects.
OSD
-
RE: Need help for yacht lighting wireless switch
Eclettis looks proprietary and digging into it could be quite the challenge. They also look like they operate on AC. If that's the case, you might consider replacing them with Sonoff devices which have much of what you need: radio or wifi and a relay. You may not need a central controller if your clever with programming.
Otherwise, Home Assistant running in a container along side mosquitto on an RPi (program once and run headless?) and "Tasmota-ize" the Sonoff devices. An "ad-hoc" network (ip addresses are hard coded) Once that's done, programming the switches to to the lights in HA is very simple.
Downside is that RPis are about US$175! Each switch and each light would need a Sonoff device (>$10 each)
Just a thought.
Good luck
OSD
-
RE: Error decoding message from gateway, bad data received
@mfalkvidd That's really good information! Thanks!
The bug to which I refer is the fact that the default BAUD rate setting should be the same in all examples. The documentation you present shows what the default should be.
OSD
-
RE: Error decoding message from gateway, bad data received
@adamk The data looks like different serial BAUD rates in Home Automation (HA) and your Arduino. The default for HA is 115200. The default in the Arduino GatewaySerial example is 38400. (line 58) You must change one or the other to match. (I'd call this a bug) I'd opt on the safe side and make them both 38400, though 115200 would minimize over running the serial buffer.
Alternately, you could try the MySensors MQTT gateway running on the RPi. Home Assistant, mosquitto (MQTT broker) and MySensors gateway might be a bit much for an RPi. Daunting task, Let's hope it's the BAUD
OSD
-
RE: MySensors gateway running as a service
I think I got it working.
note: I use UNAME here. Usually its pi
create directory ~/.config
create the file ~/.config/autostart.sh with the contents:# # must use full path because at this point in the # process, the user is not logged in # log the time of boot date -R >/home/UNAME/lastboot # wait a little bit to ensure network is up sleep 5 # Start the gateway # pipe stdout and stderr to the null file so that loose characters are not flying about # end with an & to the boot to complete and let the gateway run /home/UNAME/MySensors/bin/mysgw >>/dev/null 2>>/dev/null &
make this file executable
sudo chmod +x ~/.config/autostart.sh
Get the autostart program to run at boot by modifying
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi # add this line # ampersand is very important! /home/UNAME/.config/autostart.sh & exit 0
ensure that rc.local is executable
sudo chmod +x /etc/rc.local
-
RE: Site down?
When I go to this page https://www.mysensors.org/build/select_gateway, I get:
I'm using Chrome 105
Similar for Firefox:
-
MySensors gateway running as a service
I have an RPi Zerwo 2w that I am running headless. It is running the minimal version of RaspberryPi OS (no GUI). I can run MySensors Gateway (mysgw) in a ssh sesstion. I would like to run mysgw as a service.
Granted, I would get no output, but it is running well.
Well, community, have you ever done this?
-
RE: Temperature and humidity room sensor
@martin1234567 There are devices called DHT (digital humidity temperature). A cheap one that is hardly accurate is the DHT11. If you want accuracy, the cost goes up exponentially.
-
RE: Raspberry Pi 3 (RPI 3) + MQTT gateway NACK and triple messages
@Oumuamua I have a non-MySensors nRF24 network and I discovered that a significant number of ACKs don't get received and is more so on child and child-of-child nodes. It is my understanding that ACKs are a programable part of the nRF24 and not part of your code nor of the MySensors code.
More often than not, the message has been received, even though the ACK didn't make it back. Thus, I added an acknowledge to my code.
For a reason I don't understand, the MySensors code is more robust when it comes to ACKs
Perhaps the MySensor code employ a messageID strategy to avoid duplicate messages?
I concur with @mfalkvidd that noise and/or overdriving the antenna and/or bad connections are a source of many problems.
-
RE: Help! Is there *any* way to squelch either robocalls or India call center telephone attacks to my phone?
@NeverDie Now there's an idea for a service! A call screening service. You forward your calls to them. They have a data base of scam numbers which automatically connects them to a "chatter box" (audio random words and touch tones). The rest of the calls get passed through. When you get a robo-call, you have a way to add it to the data base. If our customers have thousands of subscribers, the database grows as fast as the robo-callers can get numbers.
Or we could have a robo-caller database in the cloud and one could send updates and periodically download it into a personal black list. (This might already exist?) fraught with potential abuse.
OSD
-
RE: Some"ting" interesting...
@NeverDie Non-internet connected networks still need NTP. I built an NTP server from a $5 gps module, a $3 Arduino nano, a $6 ethernet shield, network cable and a USB cable. A neighbor 3D printed an enclosure for me in exchange for 4 home baked cookies (they're awesome). Just for fun, I put in software for an under $2 display to make a clock.
Should we re-title this thread, "Be Afraid, and here's how to ameliorate your fear. "
-
RE: Help! Is there *any* way to squelch either robocalls or India call center telephone attacks to my phone?
@NeverDie I feel your pain. I use google voice. My strategy is that I never answer a number that is not in my contacts. Google voice has a calls screening feature.
The second part is whack-a-mole. If the caller does not leave a message, I block it, then mark it as spam. Most legitimate callers will leave a message. At first there are lots of moles to whack. I've been at this for years and I get ~10 robo-calls a week. My blocked list must be huge!
When a realtor leaves a message, I text back with, "Thank you for the interest in my property. I am currently entertaining offers in the mid 11 digits. Please be respectful of your time and mine."
Remember, every time you enter your phone number on a form, you will get at least 10 robo-calls.
good luck to us all
OSD
-
RE: Some"ting" interesting...
@Larson @NeverDie @ejlane @Yveaux @mfalkvidd I used to work for the electric utility company, the one that charges the highest rates in the nation. I do not trust them and I am of the opinion that they have committed and are conspiring to commit crimes against humanity. Also I admire the Chinese for their long term thinking, but I believe they put spyware in many of their products. Why? Because I also used to work at a major computer company where we discussed doing just that (circa 1998). I also worked briefly in network security. Feel free to consider me paranoid.
Consider the cost to manufacture this device: Sonoff Basic R2, $8 delivered. But these things aren't "free". Don't get me wrong, this one is really cool and has social benefits, but the utility and insurance companies benefit much more. For example, SDG&E has partnered with OhmConnect. This device will allow SDG&E to shutoff the connected electrical device, ostensibly when load needs to be shed (demand cannot be met). This is a good thing. But this pilot program is just a small step towards programs that shut off your rooftop solar when there's too much production. Unfortunately, SDG&E cannot be trusted to shut off production equitably.
These are tough ethical decisions, one that I fail all the time (I buy cheap Chinese nRF24L01's, etc.) Like @ejlane said, "Or maybe that's just what I tell myself to help justify it?" Do we need a support group to help us wean ourselves off AliExpress?
Thanks for listening
OSD
-
RE: Raspberry Pi 3 (RPI 3) gateway initialization loop
@Oumuamua said in Raspberry Pi 3 (RPI 3) gateway initialization loop:
This is a clue (or a red herring) because there is a ? in the message.Aug 28 07:39:12 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
Hopefully @mfalkvidd can tell us what it means
-
RE: Raspberry Pi 3 (RPI 3) gateway initialization loop
@Oumuamua When you set
--my-controller-ip-address=127.0.0.1
you are saying your MQTT broker is on the same machine as your gateway. If, on your RPi you installed your broker with (what I do)
sudo apt install mosquitto
you will have to add the lines to /etc/mosquitto/mosquitto.conf
allow_anonymous true listener 1883 0.0.0.0
After that, reboot.
Alas, this may not fix your problem. I see you're looping on connecting/connected/sent. I make the assumption that the debug message aren't quite accurate because ... well ... sometimes they aren't.
Let us know if this works
OSD
-
RE: What did you build today (Pictures) ?
@NeverDie That isn't what I was thinking but after a bit of research, that's better than what I was thinking.
PCB antennae work better at > 868MHz(pg 7). A 2.4GHz signal should have an antenna length of 3.1cm The nRFl01 spec shows a PCB with an antenna that is about that length but I measure the board I have and the antenna is about 4.6cm(?) Here(pg 10) you'll find a design, though I'm not sure for what frequency as the length adds up to 4.03cm. As you can see, you must not have the ground plane near the antenna.
Here, RonM9 modifies an nRF24l01 making the antenna a dipole. I tried this and did show some improvement, but not the success he had. His wires were ~5.0cm, but bends them in the opposite directions at the edge of the pcb. Does that make the antenna length about 4cm?
The antenna for a longer wave length (lower frequency) will be proportionally longer.
I'd like to do the same testing as RonM9, but I've got some other pressing projects.
I hope this helps your research.
OSD
-
RE: What did you build today (Pictures) ?
@NeverDie It is my understanding, though I can't wrap my head around it, that it is the length of the conductor that makes the antenna tuned to a certain frequency. If this is the case, you could run your antenna around the edge of your circular pcb which would make the effective radius only slightly bigger.
-
RE: Gateway on RPi zero config.h:39: first defined here
I found the answer here.
In config.c two lines have to be added and in config.h, one line is modified and two added
-
Gateway on RPi zero config.h:39: first defined here
I'm building a gateway on an RPi zero. First I got a complaint about stropts.h which was fixed by creating an empty file of that name in the MySensors/core directory.
Now I'm getting:
/usr/bin/ld: build/examples_linux/mysgw.o:/home/appian3344/MySensors/./hal/architecture/Linux/drivers/core/config.h:39: multiple definition of `conf'; build/hal/architecture/Linux/drivers/core/config.o:/home/appian3344/MySensors/hal/architecture/Linux/drivers/core/config.h:39: first defined here
I found a post that stated that the poster fixed, but not how it was fixed. Does someone know the trick?
OSD
-
RE: ESP8266Wifi Gateway won't connect
@mfalkvidd Yes, totally forgot about that link you put there. Thanks for reminding me.
-
RE: ESP8266Wifi Gateway won't connect
@mfalkvidd Because I see that the example has a presentation() routine with the comment "// Present locally attached sensors here" I made the assumption that the gateway could have local sensors. I described a local sensor
// local sensor information #define MY_NODE_ID 3 #define CHILD_ID_GATEWAY_FAUX_SENSOR 0 MyMessage msgFauxSensor(CHILD_ID_GATEWAY_FAUX_SENSOR, V_LEVEL); int fauxSensorValue = 0;
and put the data acquisition code in the loop:
// Send locally attached sensors data here send(msgFauxSensor.set(fauxSensorValue++)); Serial.print("Value sent: ");Serial.println(fauxSensorValue); delay(30000);
Lo and Behold! This data was being found on the MQTT broker! Albeit the NODE_ID was not 3 as defined, but 0. This makes sense because the NODE_ID of the gateway is zero.
Previously, I had my gateway running on an RPi. My question is, can I put a presentation() routine and data acquisition of the gateway running on my RPi?
-
RE: ESP8266Wifi Gateway won't connect
@mfalkvidd said in ESP8266Wifi Gateway won't connect:
#define MY_GATEWAY_MQTT_CLIENT
That was it! Thank you!
OSD
-
RE: ESP8266Wifi Gateway won't connect
@hard-shovel I created a faux nano sensor and used nRF24L01 channel 121 to communicate to the gateway. Here is my NodeMCU ESP8266 code with all comments taken out:
#define VER 0.4 #define MY_DEBUG true #define MY_BAUD_RATE 9600 #define MY_RADIO_RF24 #define MY_RF24_CHANNEL 121 #define MY_GATEWAY_ESP8266 "Test" #define MY_WIFI_SSID "SSID" #define MY_WIFI_PASSWORD "pass" #define MY_HOSTNAME "ESP8266_GW" #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mysensors-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mysensors-in" #define MY_PORT 1883 #define MY_GATEWAY_MAX_CLIENTS 8 #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 142 #include <MySensors.h> void setup() {Serial.print("ESP8266MySensorsGateway version: ");Serial.println(VER); } void presentation(){} void loop(){}
On boot, the gateway generates the following debug output:
60 MCO:BGN:INIT GW,CP=RNNGE---,FQ=80,REL=255,VER=2.3.2 118 TSF:LRT:OK 133 TSM:INIT 147 TSF:WUR:MS=0 170 TSM:INIT:TSP OK 191 TSM:INIT:GW MODE 213 TSM:READY:ID=0,PAR=0,DIS=0 246 MCO:REG:NOT NEEDED scandone 1322 GWT:TIN:CONNECTING... 2350 GWT:TIN:CONNECTING... scandone state: 0 -> 2 (b0) 4097 GWT:TIN:CONNECTING... state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt connected with Automation, channel 9 dhcp client start... ip:192.168.1.30,mask:255.255.255.0,gw:192.168.1.193 4316 GWT:TIN:IP: 192.168.1.30 4354 GWT:TIN:ETH OK 4376 MCO:BGN:STP ESP8266MySensorsGateway version: 0.40 4394 MCO:BGN:INIT OK,TSP=1 4463 TSM:READY:NWD REQ 4490 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: 6865 TSF:MSG:READ,2-2-0,s=0,c=1,t=37,pt=2,l=2,sg=0:208 6933 GWT:TSA:ETH OK
The faux node connects to the gateway indicated by this debug code from the gateway (which is repeated for each "reading" (eg. 204):
1047590 TSF:MSG:READ,2-2-0,s=0,c=1,t=37,pt=2,l=2,sg=0:204 1047656 GWT:TSA:ETH OK
Nothing arrives at the MQTT broker. From another machine, I can publish to the broker:
mosquitto_pub -h 192.168.1.139 -t test/mztake -m "did it arrive?"
and it does arrive at the broker.
What am I missing?
OSD
-
RE: ESP8266Wifi Gateway won't connect
@hard-shovel This is what I'm getting (with no nodes connecting to gateway)
MCO:BGN:INIT GW,CP=RNNGE---,FQ=80,REL=255,VER=2.3.2 117 TSF:LRT:OK 133 TSM:INIT 147 TSF:WUR:MS=0 170 TSM:INIT:TSP OK 191 TSM:INIT:GW MODE 213 TSM:READY:ID=0,PAR=0,DIS=0 245 MCO:REG:NOT NEEDED scandone 1322 GWT:TIN:CONNECTING... 2351 GWT:TIN:CONNECTING... scandone state: 0 -> 2 (b0) 4097 GWT:TIN:CONNECTING... state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt connected with Automation, channel 9 dhcp client start... ip:192.168.1.30,mask:255.255.255.0,gw:192.168.1.193 4316 GWT:TIN:IP: 192.168.1.30 4355 GWT:TIN:ETH OK 4378 MCO:BGN:STP 4396 MCO:BGN:INIT OK,TSP=1 4424 TSM:READY:NWD REQ 4451 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: pm open,type:2 0
And this comes when a node connects:
197868 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 197928 TSF:MSG:BC 197947 TSF:MSG:FPAR REQ,ID=2 197977 TSF:PNG:SEND,TO=0 198003 TSF:CKU:OK 198022 TSF:MSG:GWL OK 198460 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 200006 TSF:MSG:READ,2-2-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 200065 TSF:MSG:PINGED,ID=2,HP=1 200106 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 200244 TSF:MSG:READ,2-2-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 200309 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 200385 TSF:MSG:READ,2-2-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.3.2 200456 GWT:TSA:ETH OK 200481 TSF:MSG:READ,2-2-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 200545 GWT:TSA:ETH OK 202529 TSF:MSG:READ,2-2-0,s=255,c=3,t=11,pt=0,l=15,sg=0:BatMoistHumTemp 202611 GWT:TSA:ETH OK 202636 TSF:MSG:READ,2-2-0,s=255,c=3,t=12,pt=0,l=9,sg=0: 0.01 202710 GWT:TSA:ETH OK 202885 TSF:MSG:READ,2-2-0,s=0,c=0,t=35,pt=0,l=0,sg=0: 202948 GWT:TSA:ETH OK 203141 TSF:MSG:READ,2-2-0,s=1,c=0,t=7,pt=0,l=0,sg=0: 203203 GWT:TSA:ETH OK 203396 TSF:MSG:READ,2-2-0,s=2,c=0,t=6,pt=0,l=0,sg=0: 203458 GWT:TSA:ETH OK 203651 TSF:MSG:READ,2-2-0,s=3,c=0,t=30,pt=0,l=0,sg=0: 203713 GWT:TSA:ETH OK 203925 TSF:MSG:READ,2-2-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 203992 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 204128 TSF:MSG:READ,2-2-0,s=255,c=3,t=0,pt=1,l=1,sg=0:100 204199 GWT:TSA:ETH OK 204407 TSF:MSG:READ,2-2-0,s=3,c=1,t=38,pt=7,l=5,sg=0:6.52 204475 GWT:TSA:ETH OK 204542 TSF:MSG:READ,2-2-0,s=0,c=1,t=37,pt=2,l=2,sg=0:1023 204610 GWT:TSA:ETH OK
-
RE: ESP8266Wifi Gateway won't connect
@hard-shovel My MQTT broker does not require them. Should I uncomment and leave them blank?
-
RE: ESP8266Wifi Gateway won't connect
@hard-shovel I tried the client and it did indeed send the MySensors version message. But it does not pass along the messages from the Arduino nodes.
-
RE: ESP8266Wifi Gateway won't connect
@hard-shovel client worked for me, too. That is, it sent the message "2.3.2" to topic "mygateway1-outx/0/255/0/0/18"
-
RE: ESP8266Wifi Gateway won't connect
@hard-shovel While it all seemed to be working, it appears that the ESP8266 MySensors Gateway was not passing the data onto the MQTT broker. Working, meaning that data from the Arduino sensors were getting to the Gateway, but that data was not getting to the broker. Here are some lines of the debug output:
6217818 TSF:MSG:READ,133-133-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 6217883 TSF:MSG:BC 6217903 TSF:MSG:FPAR REQ,ID=133 6217936 TSF:CKU:OK,FCTRL 6217962 TSF:MSG:GWL OK 6218281 !TSF:MSG:SEND,0-0-133-133,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
Also, as an indication that data was not being passed from the Gateway to the broker, I had reset my MQTT Broker and subsequently monitored it with MQTT explorer. The topic "mysensors-out" was not created.
I shut down the ESP8266 MySensors Gateway and restarted the my original one that is running on an RPi. Everything started running as expected.
Thus, my conclusion.
OK, so why isn't the ESP8266 MySensors Gateway passing on the data?
-
RE: ESP8266Wifi Gateway won't connect
The port was set to 5003 and setting it to 1883 (the default MQTT broker port) it now seems to work
-
RE: ESP8266Wifi Gateway won't connect
@hard-shovel Thanks! Now I'm getting output to the monitor. I think I need to set up the IP address and the port 1883 for the MQTT broker. How is that done? I am also getting data from my Arduino node sensors I see "controller" but when I change that to my broker's address I get streaming ETH FAIL