Project

General

Profile

Actions

Feature #1193

open

Integrate pwscan/pwremote as single sensor device on Xiao ESP32C3

Added by Hammel 24 days ago. Updated 4 days ago.

Status:
In Progress
Priority:
Immediate
Assignee:
Category:
Software
Target version:
Start date:
28 Mar 2025
Due date:
% Done:

20%

Estimated time:
Severity:
01 - Critical

Description

This implies the following software modifications, based on existing pwremote/pwscan stubs and the original imlightsw sensor code.
  1. Three modes of operation
    1. Pairing
    2. Scanning for remotes
    3. Remote Control of outlets
  2. Mode can be set programmatically via web interface.
  3. Web interface should provide output from scans
  4. 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 issues

Related to Sensors - Feature #1192: Create enclosure for pwremote/pwscan deviceNewHammel28 Mar 2025

Actions
Actions #1

Updated by Hammel 24 days ago

  • Related to Feature #1192: Create enclosure for pwremote/pwscan device added
Actions #2

Updated by Hammel 7 days ago

  • 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.

Actions #3

Updated by Hammel 6 days ago

Things I need to port for Xiao ESP32C3.

Actions #4

Updated by Hammel 4 days ago

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
Actions #5

Updated by Hammel 4 days ago

  • % Done changed from 10 to 20

Build completes successfully.

Now I need to integrate button support for pairing, reset, etc.

Actions #6

Updated by Hammel 4 days ago

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.
Actions

Also available in: Atom PDF