Shoving a quick edit in here. You can read the troubleshooting process below, but long story short, select your i2c pins with care on Pico.
Hi, so, this is a weird one.
Sonoff Dual is doing weird things and wants to be replaced, so, I decided to build something instead, as you do.
I’m basing this device on a Raspberry Pi Pico, because in my country, you can’t get cheap ESP32s, but you can get Picos cheaply without having to import. Pico is looking sexier to me than ESP8266, but anyway.
So it has 2 relays, 2 touch sensors (for the relays), a lux sensor, a temp sensor, a PIR sensor, and a small strip of WS8something LEDs to be night lights (not yet connected).
The YAML validates fine, and so then I installed via OTA update. It said successful, but weirdness has occurred. I cannot get logs from it. ESPHome is showing it as online, but I can’t connect to it to see if it’s reading the sensors correctly or not.
Luckily I still had the uf2 file from the initial installation (no sensors, just basic setup), and when I reinstalled that, it all worked again.
… I’m going to try commenting out sensors and recompiling. Hmm. I’ll be back.
EDIT the first: I commented out everything except the basics. Validated fine. Installed via OTA. During the compile, it threw a weird error, I’ll just post the relevant bit:
Compiling /data/pico001-test/.pioenvs/pico001-test/src/esphome/components/api/user_services.cpp.o
In file included from /data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/vector:72,
from /data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/functional:62,
from src/esphome/core/component.h:4,
from src/esphome/components/api/proto.h:3,
from src/esphome/components/api/api_pb2.h:5,
from src/esphome/components/api/api_pb2.cpp:3:
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {long long unsigned int}; _Tp = long long unsigned int; _Alloc = std::allocator<long long unsigned int>]':
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc:426:7: note: parameter passing for argument of type 'std::vector<long long unsigned int>::iterator' changed in GCC 7.1
426 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc: In member function 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {long long unsigned int}; _Tp = long long unsigned int; _Alloc = std::allocator<long long unsigned int>]':
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc:121:21: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> >' changed in GCC 7.1
121 | _M_realloc_insert(end(), std::forward<_Args>(__args)...);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling /data/pico001-test/.pioenvs/pico001-test/src/esphome/components/logger/logger.cpp.o
However, the compile completed, and the device updated successfully and I can access it. So I guess … enable the next bit and see what happens.
One moment.
EDIT the second: So, I enabled just i2c, and the compiler threw a new error:
Compiling /data/pico001-test/.pioenvs/pico001-test/src/esphome/components/api/user_services.cpp.o
In file included from /data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/vector:72,
from /data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/functional:62,
from src/esphome/core/component.h:4,
from src/esphome/components/api/proto.h:3,
from src/esphome/components/api/api_pb2.h:5,
from src/esphome/components/api/api_pb2.cpp:3:
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {long long unsigned int}; _Tp = long long unsigned int; _Alloc = std::allocator<long long unsigned int>]':
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc:426:7: note: parameter passing for argument of type 'std::vector<long long unsigned int>::iterator' changed in GCC 7.1
426 | vector<_Tp, _Alloc>::
Compiling /data/pico001-test/.pioenvs/pico001-test/src/esphome/components/i2c/i2c.cpp.o
| ^~~~~~~~~~~~~~~~~~~
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc: In member function 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {long long unsigned int}; _Tp = long long unsigned int; _Alloc = std::allocator<long long unsigned int>]':
/data/cache/platformio/packages/toolchain-rp2040-earlephilhower/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc:121:21: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> >' changed in GCC 7.1
121 | _M_realloc_insert(end(), std::forward<_Args>(__args)...);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling /data/pico001-test/.pioenvs/pico001-test/src/esphome/components/i2c/i2c_bus_arduino.cpp.o
The compile completes successfully, and uploads via OTA. And now the device is dead again. Power cycling does not bring it back, I’ll need to manually flash it again.
After that, I’m going to comment out i2c again and see if it’ll compile with other sensors.
I’ll be back.