Open djacid opened 8 months ago
Sure,
do you have the full logs when the esp connects? Screenshot would also be fine. What mqtt tool do you use?
Thank you for your fast response. First of all I used a wemos d1 mini v3 (ESP8266), so I edited my env to this:
[env:d1_mini] platform = espressif8266
framework = arduino lib_deps = knolleary/PubSubClient@^2.8 nickgammon/Regexp@^0.1.0 smfsw/Queue@^1.9.1 bblanchon/ArduinoJson@^6.17.3
board = d1_mini board_build.filesystem = littlefs build_flags = -DDEBUG_ESP_PORT=Serial monitor_speed = 115200
My config.json file is this:
{
"wifiSsid" : "WifiHomeNetwork",
"wifiPassword" : "wifipass",
"mqttServer" : "192.168.1.179",
"mqttPort" : "1883",
"mqttUser" : "admin",
"mqttPassword" : "mqttpass",
"mqttClientID" : "somfyIO"
}
I use mqtt explorer for testing and Home Assistant for my house.
I edited main.ccp file and changed the pinout ports to these:
The logs after build are these:
Verbose mode can be enabled via -v, --verbose
option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 (4.2.1) > WeMos D1 R2 and mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
The logs after upload are these:
Verbose mode can be enabled via -v, --verbose
option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 (4.2.1) > WeMos D1 R2 and mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
Leaving... Hard resetting via RTS pin... ===================================== [SUCCESS] Took 27.11 seconds =====================================
And the logs of serial monitor are only these:
Executing task: platformio device monitor --environment d1_mini --port /dev/cu.usbserial-14320
--- Terminal on /dev/cu.usbserial-14320 | 115200 8-N-1 --- Available filters and text transformations: colorize, debug, default, direct, esp8266_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time --- More details at https://bit.ly/pio-monitor-filters --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
I may ask if the filesystem was also build and uploaded? Can you try the latest commit? Added more output for the phases.
Verbose mode can be enabled via -v, --verbose
option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 (4.2.1) > WeMos D1 R2 and mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
framework-arduinoespressif8266 @ 3.30102.0 (3.1.2)
tool-esptool @ 1.413.0 (4.13)
tool-esptoolpy @ 1.30000.201119 (3.0.0)
tool-mklittlefs @ 1.203.210628 (2.3)
tool-mkspiffs @ 1.200.0 (2.0)
toolchain-xtensa @ 2.100300.220621 (10.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 41 compatible libraries
Scanning dependencies...
Dependency Graph
|-- PubSubClient @ 2.8.0
|-- Regexp @ 0.1.0
|-- Queue @ 1.11.0
|-- ArduinoJson @ 6.21.5
|-- LittleFS @ 0.1.0
|-- ESP8266WiFi @ 1.0
Building in release mode
Building file system image from 'data' directory to .pio/build/d1_mini/littlefs.bin
/config.json
Looking for upload port...
Auto-detected: /dev/cu.usbserial-14320
Uploading .pio/build/d1_mini/littlefs.bin
esptool.py v3.0
Serial port /dev/cu.usbserial-14320
Connecting.....
Traceback (most recent call last):
File "/Users/anastasioschatziliadis/.platformio/packages/tool-esptoolpy@1.30000.201119/esptool.py", lin
e 3969, in
The terminal process "platformio 'run', '--target', 'uploadfs', '--environment', 'd1_mini'" terminate d with exit code: 1.
I assume/think the upload did not work as the device was not reset/in boot mode - currently I have no spare d1 mini, yet could you try to reset/connect the d1 mini shortly before upload/flashing?
I tried again and now I got this:
Verbose mode can be enabled via -v, --verbose
option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 (4.2.1) > WeMos D1 R2 and mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
Leaving... Hard resetting via RTS pin... ====================================== [SUCCESS] Took 6.29 seconds ======================================
D1 Mini also now blinks blue led repeatedly
But the device is not connected to Wifi
Debugging return this: [{ "resource": "/Users/anastasioschatziliadis/Downloads/SomfyIO-master 2/.pio/libdeps/d1_mini/PubSubClient/src/PubSubClient.cpp", "owner": "cpp", "severity": 4, "message": "comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]", "startLineNumber": 523, "startColumn": 16, "endLineNumber": 523, "endColumn": 16 }]
Then try to upload the application and monitor it, then post the output.
The terminal output is complete?
No it was huge, but there is progress. I removed all the special characters from mqtt password. Not, the device connected succesfully to Wifi. I will try again to place the correct mqtt password
If I change the password of MQTT I have the error. The Password is something like PasswordPhrase2@1! Do you believe that there is issue with these special characters?
Awesome, based on the number of issues with the json parsing, I should find another solution to store the config aside the code.
If I change the password of MQTT I have the error. The Password is something like PasswordPhrase2@1! Do you believe that there is issue with these special characters?
Maybe - easiest way is to place the password in the code at the assignments to the variables.
const char *c_mqttPassword = ”test@!”;
like this
Yes! It seems finally working. I can see the device on MQTT as "shades/terrace"
Then some parsing of the json file is the issue. Which encoding is your file?
How can I see the encoding?
About MQTT, I can see only these.
How can I see the encoding?
@djacid mqtt looks fine
About MQTT, unfortunately Home Assistant cannot find any topics, because Home Assistant needs a prefix.
Also I really don't understand what's the mqtt command to change channel for instance
Edit: I found the way to change channel. But I don't know what's the command to simulate a button press
here is the cover-part of my mqtt section of the configuration.yaml of HA: ` cover:
So just to explain the concept: the ESP will autodetect channel1 on bootup with the help of the interrupt routine and the led feedback. Then whenever a command is sent from HA (or other sources) the ESP will select the channel based on current known selection, then switch to the new channel if needed and perform the button press.
Perfect, ok I understood. One more question about the state of last command. Does last command state updates only after mqtt command or it's able to update also after physical button press?
As I have 3D-printed a pogo-pin-Adapter with a housing, for me there is no physical interface anymore. Based on the current design, it would not. This would need to monitor the buttons in parallel, and also check the channel selection.
To increase the WAF, there is a zigbee-MQTT switch with choices for the shades next to the patio door, so I don't need to have the phone/smartspeaker nearby all the time.
As I am still trying to fix some thing, could you please tell me if it's the normal behaviour to change the channel (increasing by one) if you run the same command repeatedly. To be more specific, if I run cmd/channel1, the remote controls goes to channel1, but if I run the same command again, then it moves to channel 2 etc.
I haven't observed this one, after looking into the code I'd say that would be unlikely but not completly impossible. Can you check/post the output in that case?
It should remember known and current channel. If it can't detect or switch to the right channel, it will sweep until it finds it.
I will check the output later today and I will post again. If you want to repoduce what I said you have to send for instance the command cmd/channel2 and before the green light of the remote turned off, send again the same command. You will notice that every time you send the command, the channel will be stepping by 1. The only way to stay on the same channel is only if you wait for 5 seconds for the green light to be turned off.
Ah, this is some good finding- haven’t tested or tried. But that is indeed something that would not work. I guess I/someone need to block the command during this time. Or something smarter.
Hello, I have some issues. I can compile without any issues the project and upload it on my esp.
The problem is I can't find the device to MQTT server. The logs also don't show any information. Could you please help me? How can I control the remote? Is there any web interface or only via MQTT?