Feature #1193
open
Integrate pwscan/pwremote as single sensor device on Xiao ESP32C3
Added by Hammel about 1 month ago.
Updated 22 days ago.
Description
This implies the following software modifications, based on existing pwremote/pwscan stubs and the original imlightsw sensor code.
- Three modes of operation
- Pairing
- Scanning for remotes
- Remote Control of outlets
- Mode can be set programmatically via web interface.
- Web interface should provide output from scans
- Web interface should allow selecting buttons to enable/disable.
This device must be built for an ESP32C3 in order to support WiFi.
This also needs to be mounted in an enclosure. That will be tracked in RM #1192.
- Related to Feature #1192: Create enclosure for pwremote/pwscan device added
- Subject changed from Integrate pwscan/pwremote as single sensor device on Arduino Uno to Integrate pwscan/pwremote as single sensor device on Xiao ESP32C3
- Status changed from New to In Progress
- % Done changed from 0 to 10
Note: this was for Arduino Uno but that board doesn't have WiFi. So I'm switching to the Seeed Studio Xiao ESP32C3.
pwremote now configures the correct family for the Xiao ESP32C3: esp32:esp32:XIAO_ESP32C3
You can find this with
arduino-cli board listall | grep ESP32C3
Now the build gets farther but fails with
Alternatives for ESP8266WiFi.h: []
ResolveLibrary(ESP8266WiFi.h)
-> candidates: []
/home/mjhammel/src/ximba/xarduino/lightsw/src/pwrmgmt/pwremote/pwremote.ino:17:10: fatal error: ESP8266WiFi.h: No such file or directory
17 | #include <ESP8266WiFi.h>
So this library doesn't work with the ESP32C3. I need to port it to whatever library works with the ESP32.
Looks like it's Wifi.h, as in this example.
Things I need to port for Xiao ESP32C3.
Most of the porting is done, simply by using the correct headers for ESP32.
I'm left with the following.
- UDP.beginPacketMulticast(): This may be the NetworkUDP support in the Network library.
- Dir dir = ...: This seems to be deprecated in favor of SPIFFS support, such as the listdir() function in the SPIFFS Test example
- % Done changed from 10 to 20
Build completes successfully.
Now I need to integrate button support for pairing, reset, etc.
The pinout shows there is no GPIO0 on the Xiao board. But there are extra GPIO pins so I can test for both Reset (which would be converted to a function like pairEnabled) and the pairEnabled GPIO. Note that Reset would be handled first before pairEnabled is turned on, though pairEnabled doesn't make sense if Reset was on.
So if Reset is enabled, it clears memory first and then goes into config mode.
But maybe this can all be done with a single button.
- Hold button and power on: Reset mode, then config mode.
- Hold button after power on: config mode (without reset)
- Press button twice after power one: pairEnabled
- Press once after to go into operational mode.
Also available in: Atom
PDF