Open elpedriyo opened 1 year ago
Add this to your config:
sensor:
- platform: template
name: wifi ps mode
lambda: |-
wifi_ps_type_t ps_type;
esp_err_t err = esp_wifi_get_ps(&ps_type);
ESP_LOGD("wifi_test", "get_ps returned %d", err);
return ps_type;
See what is in the log and sensor value.
This is what the log shows:
[C][template.sensor:023]: Template Sensor 'wifi ps mode' [C][template.sensor:023]: State Class: '' [C][template.sensor:023]: Unit of Measurement: '' [C][template.sensor:023]: Accuracy Decimals: 1 [C][template.sensor:024]: Update Interval: 60.0s
[D][wifi_test:025]: get_ps returned 0 [V][sensor:076]: 'wifi ps mode': Received new state 1.000000 [D][sensor:127]: 'wifi ps mode': Sending state 1.00000 with 1 decimals of accuracy [D][wifi_test:025]: get_ps returned 0 [V][sensor:076]: 'wifi ps mode': Received new state 1.000000 [D][sensor:127]: 'wifi ps mode': Sending state 1.00000 with 1 decimals of accuracy [D][wifi_test:025]: get_ps returned 0
I have reflashed esp with your code and this is the report after flashing: [V][sensor:076]: 'wifi ps mode': Received new state 0.000000 [D][sensor:127]: 'wifi ps mode': Sending state 0.00000 with 1 decimals of accuracy
And this other one after rebooting: [V][sensor:076]: 'wifi ps mode': Received new state 1.000000 [D][sensor:127]: 'wifi ps mode': Sending state 1.00000 with 1 decimals of accuracy
Can you set the logger to VERBOSE
Check for this message during startup
if (!this->wifi_apply_power_save_()) {
ESP_LOGV(TAG, "Setting Power Save Option failed!");
}
I already have VERBOSE logger AFAIK: https://pastebin.com/xLt3THU9 But I can not find that message This is my currently yaml file: https://pastebin.com/wnY9jti1
Or do you want me to insert that code in the lambda sensor?
You will only see that from serial logs if you watch from boot.
The logs I have pasted in there were taken from serial
Here you have full log after OTA flashing, and reboot via reset button: https://pastebin.com/aFYiaUuA
Just tried very verbose, and not showing either https://pastebin.com/eei1CFcV
The logs I have pasted in there were taken from serial
Sorry, I should have checked first. Try this:
external_components:
- source: github://ssieb/esphome@wifipower
components: [ wifi ]
refresh: 1min
Use verbose logging.
New logs after flashing and after rebooting: https://pastebin.com/uu7nE52a However issue not solved
I was not expecting it to be solved. I'm just trying to get more information on what is happening. And apparently, it's not even trying to set the power mode at all.
Weird thing is that it seems it sets it up after flashing, but not after rebooting :/ At least that is what I can observ
I forgot to actually commit my changes... :man_facepalming: Try again.
When I run the flashing it pop up this message: C:\Users\Pedro>esphome run prueba.yaml INFO Reading configuration prueba.yaml... INFO Updating https://github.com/ssieb/esphome.git@wifipower INFO Generating C++ source... INFO Compiling app...
But when I get into https://github.com/ssieb/esphome.git@wifipower it shows nothing. I guess that is not expected, right?
However I just flashed it again, and reboot, and here are the new logs: https://pastebin.com/iesq8pjQ
But when I get into https://github.com/ssieb/esphome.git@wifipower it shows nothing. I guess that is not expected, right?
That's not a real url, it's a short form for esphome to use.
However I just flashed it again, and reboot, and here are the new logs: https://pastebin.com/iesq8pjQ
I don't see any mention of it trying to set the mode, so I'll have to go through the code again to see how that's possible.
I really don't understand how that's happening. I added some more logging, try again.
I'm still confused about what's going on with the code, but I also can't reproduce your issue. My ESP32 always uses the configured power save mode.
Here the new logs: https://pastebin.com/rQSZED8K
I wonder if your problem is related to the auth fail and reconnect because the mode starts correctly and changes after all that.
Can you try with debug level logging instead of verbose?
I wonder if your problem is related to the auth fail and reconnect because the mode starts correctly and changes after all that.
I see at the beginning as you said is reporting the correct PS mode and after it finishes booting it's reporting the wrong one. Any idea on why it is giving me all time that auth fail?
Can you try with debug level logging instead of verbose?
Let me try
It seems you discovered the issue: https://pastebin.com/ZvyJEiss
I have just created a mobile network with my smartphone with no password, and it is booting on the correct mode. So I guess some sort of bug when it tries to reconnect to the wifi. Do we know if that can be fixed in the code?
Now, I would also like to know why it is erroring when trying to connect to my wifi xD
I don't know why your AP is failing the auth request, but maybe we can solve the power mode issue. Can you try again with debug logging?
I think it has something to do with 5ghz or wpa3 encryption. Will solve that on my own. But yes, lets focus on the issue with the power mode as it seems that even if it goes ok at first time, if wifi fails at any stage it will go wrong the power mode again. Let me change to debug and will send you logs
The logs with debug mode: https://pastebin.com/Lp8dx44v
I made a change, try updating and see what happens.
Going now
It seems the issue is now fixed: https://pastebin.com/H385TWqC
I have rebooted the device a few times, and the power mode seems to stay after all of them :)
Are you able to update esphome code for the project to be fully fixed?
No, it's not a good fix and only applies to one specific wifi type. That was just to verify the problem.
Anything else I can help with for a good fix to get implemented?
No, someone just needs to do it.
ok, sooo, I guess that you are part of the team and this will get under track for someone to pick it when possible? What sort of ETA do you think will be for the fix?
No idea about an ETA. I'll leave my branch available until there is a fix though, so you can use that for now.
hehe thanks :)
Also experiencing this issue with my esp32 wroom devkit
The problem
Hello,
I am currently using power_save_mode: none and I can see that the latency to the device reduces a lot after flashing. However after I restart the esp32, I notice how latency increases again. It continues like if it was as default, until I reflash the esp32 again.
You can see in here what was the latency after flashing the device with power_save_mode: none and after rebooting it
Kind regards
Which version of ESPHome has the issue?
2022.12.8
What type of installation are you using?
pip
Which version of Home Assistant has the issue?
N/A
What platform are you using?
ESP32
Board
D1 mini
Component causing the issue
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Verbose logs after OTA flashing and rebooting: https://pastebin.com/47EfyBV4
Additional information
I have tried setting power save off in arduino ide on my esp32, and the setting persists after reboot without any issue, with expected latency levels. So I guess it is an issue on how esphome sets up the power saving setting