@Derek288719 - I’m a fan of Zigbee for Home Automation but sadly it’s not “super easy” but can be an excellent choice for low power devices.
The XIAO MG24 is great but not “super low power”, (due to the inclusion of a flash programmer and a few support devices like a battery charging circuit), but that is offset by the added the functionality.
The great thing however is that it’s very cheap for the performance and supports Matter (using Arduino or the Silabs SDK).
I’m currently developing a range of “Zigbee based devices” that can be programmed onto the XIAO MG24 and used in Home Automation installations and would welcome parties interested in testing some of my solutions. Just plug in the XIAO MG24 and run a batch command - takes about 10-15 seconds to program.
I’m currently testing a XIAO mmWave sensor with a XIAO MG24 on Home Assistant. I have also created the necessary firmware to run a Zigbee network on Home Assistant with the XIAO MG24 as a “dongle”, with either on board chip antenna or with a UFL dipole antenna.
Let me know if any of this is of interest to you.
Gary.
Thanks Dan.
I’ll be giving something like that a try. I have a guest WiFi but need toi check how I segregated it from the rest of the devices on wired network (my Pi 5 HA is wired).
Cheers, Dave
This may depend on the gear you have. I run vlans at home to keep things separate then simply map SSIDs to vlans (as apposed to a special “guest” wifi SSID. All my vlans end up at my firewall with rules of what can talk to what.
My local switch’s all support vlans so my HA could all be on one vlan (Layer 2). A lot of these IOT things tend to rely on mdns or broadcast which means they only really work if on the same vlan/layer 2 segment. If you can assign IP addresses (either via fixed DHCP allocations; preferred, or hard coded) and point things to IP address it should work. Even better run a local DNS server and map those IP address to some nice names.
Given the control you may end up giving the HA system, I would say this should be “more secure” then your every day user network segment and would not want guests getting access to it (?). i.e. If your computer gets some malware, should it have access to the HA devices.
At the end of the day, once you work out what you want to do you can then plan and build it. I’m firmly in the camp everything should only be allowed to access the least amount of things needed to do its job. And I would do my best to keep any HA off the internet. but that’s just me.
I haven’t set up separate vlans but I have a guest 2.4GHz-only WiFi SSID, which I tried last night with no change. Frustratingly, an ESP32-C6, with the same type of PIR sensor, works perfectly on both my normal 2.4 & 5GHz WiFi and the 2.4GHz-only WiFi, but the ESP32-C3 becomes ‘unavailable’ on both. This is also the second Waveshare ESP32-C3 board I’ve tried, so I’m guessing it’s not the hardware.
I also went though all of the mDNS and content blocking settings on my Unifi router and there’s nothing blocking that should block the ESPs and no special settings to make the C3 different to the C6. The C3 signal is also -63dB and the C6 is -67dB (further away). I’ll work my way through logs to see if my untrained eye can spot anything.
once again, thanks for your help and great ideas - much appreciated.
Cheers, Dave
Im still learning how it works and just playing. I have an C3 board fullsetup from within HA esphome plugins. Its there and I can see it, but still learning how to get the connection/disconnection logs from HA.
I have seen other devices like my TVs disconnect and reconnect and they are wired. even the switch port sees it go up and down, so I have just put that down to power saving sleep mode on the TV side.
My ESP32 C3 downloaded diag showed
“has_deep_sleep”: false,
But then again I have not noticed going down yet.
HA found and integrated my Sony TV automatically, and it disconnects and reconnects as someone uses the remote. It’s actually pretty cool but I’ve not experimented more than basic controls.
For the ESP32 I’ve tried ‘power_save_mode:" as both “none” and "light’ with no change.
I don’t think it should go into deep sleep immediately after start up, but that’s another rabbit hole to explore. At the moment, comparing logs of the C3 vs C6, the C3 seems to fail after logging “Using noise encryption: yes” … whatever that means, that’s the current rabbit hole!
that seems to be the some output I have, I just assumed that it has not done anything after that.
...
[20:44:18][C][api:140]: API Server:
[20:44:18][C][api:141]: Address: esphometest1.local:6053
[20:44:18][C][api:143]: Using noise encryption: YES
What i did notice is that I get the same page of logs every time but with the current time stamp, so this time I left the window own. The device is still online and has not disconnected from my wifi in 24hrs.
My Signal strength is about -50db so a good signal in both directions (i.e. reported in that log as well as from my AP).
I haven’t actually set or changed any encryption keys manually, only the WiFi password, so I’m trying to work out what, if anything, is set where.
The fault I’m getting is immediate. As soon as I press reset or flash the chip and it resets itself, as soon as it starts I get this in the logbook (ie, on the device page, where ‘presence’ is the entity name):
motion02 presence cleared (no motion detected)
9:09:02 PM - 14 minutes ago
motion02 presence became unavailable
9:09:02 PM - 14 minutes ago
The ‘became unavailable’ is technically written to the log before (but in the same second as) the ‘cleared’. However, ‘cleared’ or ‘off’ for a binary sensor is the default state (Developer tools → states) for the entity. So my guess is that the ‘cleared’ is being written by ESPHome on HA, not sent from the device itself.
What had you expected / asked it to do (e.g. sensors, other components) ? That segment of log file just shows that your yaml contains the api; component.
BTW, I assume you read the comments in ESPHome ESP32 Platform that the ESP32-C6 is not supported by ESPHome yet (even though there are posts in the forum about peoples experience using it); and that the framework: type: esp_idf is recommended for the ESP32-C3
It’s my Waveshare ESP32-C3-Zero board (two so far) that’s not playing. The crazy thing is that the ‘unsupported’ ESP32-C6 is working perfectly!
I have been looking through the ESPHome forum but my initial question was whether anyone had any similar issue with this particular board, since the C6 works and the C3 doesn’t. I have take n a few points form ESPHome, static IP, no dashes in names, etc, to no avail.
Yep, that’s an ESP32-C3. BTW, great to know that your C6 is working well … they look like terrific boards !
Problem is that you will need to add some more yaml code; particulary wifi: and reporting for some sort of sensor. My ESP32-S3 minimal test code is around 100 lines long.
… but I doubt that my code will help you much because it’s testing variables in deep_sleep; and i have found most errors are with the syntax, indentation, hyphens, etc.
I assume you have tried copying the working parts of the C6’s yaml code, and pasting into the C3’s yaml. Those syntax issues are a real bugger to see with the naked eye !
How about posting all of your current yaml code, and adding a more detailed description of the issue you are experiencing.
Just to avoid any confusion and people wasting time on me, I am just looking at this to learn and to see if I could make my ESP32 C3 board connect and disconnect as per the original issue. I would rather we focus on @David173576
issue as I am only a few hours in and will be sure to make many rookie mistakes as I read and learn.
As to the question “what did I expect” for something that is labeled “LOGS” on a device panel, I would expect logs, what comes back is more of a status then logs. In a device log I would expect to see time it started up, boot states over time, wifi connection data/times and repeat if more then once, connection to/from the parent system (if any). Since my wifi logs (at my wifi system) shows only 1 connection 24 hours before I looked at that log, I would expect the time stamps to show me boot up as 24 hrs ago, wifi connection was 24 hrs ago, i.e. Logs. What actually comes back seems to be a response of the current status check and settings… i.e. it shows wifi signal strength, but not when it connected.
While me expectations may be wrong, based on every other device and system I work on logs are time stamped events. If this is infact a log, then the time stamps should not be “now” when I requested, but when it happened.
That said, to answer the question, lets move back to the OP issue of his ESP32 C3 not staying connected.
Michael, there are definitely differences between devices and systems … some of which took me a paradigm shift from my 30 years of commercial programming.
The LOG you are looking at is coming to you over wi-fi - so the wi-fi is already connected.
Microcontrollers - especially the earlier models like ESP01 - have extremely limited memory, which is much more important to store program than a log history. The LOG you are seeing is (as you have surmised) what is happening as it is happening.
If you want to see a more complete log (still as it is happening), including the establishment of wi-fi connection, you should connect a serial cable to the ESP32’s UART (serial) port. I have done this with my ESP32-S3 so I can see the logger.log statements generated during the on_boot: and on_shutdown: phases. Unfortunately accessing the UART seems slightly different on different processors and boards, and I had to fiddle around to get mine working - so I won’t even try to give detailed instructions.
If you want to see status over time you should add sensors, such as the wifi_signal sensor. It was one of the first I added when I started with my ESP01, and I include it as standard in all my devices now (though I update it much less frequently now that I am confident with the wi-fi signal).
sensor:
- platform: wifi_signal
name: Wifi signal
update_interval: 5 min
note that in HA’s panel you can add secondary information, to tell you (for instance) when the sensor value was last updated.
BTW, the timestamps are added to the HA ESPHome Builder LOGS, but not on the UART logs - which can make it fun trying to match them up to see which is the additional information.
Please. I’ll go back and have a third read through … I got really confused trying to understand what the problem was that you were both having
thanks for the info I will have a play.
For me, I am not saying I have an issue (outside of learning what I am doing). I was only trying to see if I can connect an ESP32 C3 to HA and see if it was stable; more as a way of seeing if I had any issues or not.
Not issue with the serial logging, already done. I have many over my own projects on different ESP32 boards so very much up to speed on that.
thanks for the tips as it all helps me learn.
I think this was the fist post of @David173576 issue
That little code snippet for the wifi monitor worked perfect first time. So just for testing purposes, I have an ESP32 C3 with that wifi monitor running, so far with out any issues.
My first sensor was with a Pi Pico and MQTT broker on HA, and it took a bit of micro Python. The great attraction of ESPHome and the ESP32 was just how little coding was needed. I was not anticipating a block of code the size that you have shared! However, thank you, I will look through it as I find examples a great way to learn.
Hence, the .yaml for the ESP32 C3 is ‘beginner level’ simple:
esphome:
name: motion02
friendly_name: motion02
esp32:
board: esp32-c3-devkitm-1
flash_size: 4MB
variant: ESP32C3
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "<...>"
ota:
- platform: esphome
password: "<....>"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
# Set this to the IP of the ESP
static_ip: 192.168.1.132
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.1.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
power_save_mode: NONE
fast_connect: on
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Motion02 Fallback Hotspot"
password: "<.....>"
captive_portal:
binary_sensor:
- platform: gpio
pin:
number: 4
mode:
input: true
pullup: false
name: "presence"
The passwords are deleted.
Aside from identifying the files for the chipset and the WiFi setup - it’s amazing how little coding is needed for a binary sensor.
The ESP32 C6 yaml is mostly the same aside from passwords, IP settings, and a few trial settings (eg, fast connect, power save mode, for the C3 that did nothing). The main change is the esp-idf files:
It took a bit of fiddling to find versions and platform versions that worked. The ESP32 C6 has been working for about 3 weeks now with no hiccup.
Given the similarity of code, I was actually thinking it’s not a ESPHome thing, more likely something different with the hardware - the C6 is more advanced than the C3, but I’m only using basic WiFi. Hence, I am still looking through WiFi settings as Michael had a few good suggestions in that space, it could still be an encryption issue with the different chipset.
I can get logs over WiFi from the C3 but it remains online but unavailable.
If you can spot anything there, I’d love to hear it.