← index #15168Issue #14204
Off-topic · high · value 1.535
QUERY · ISSUE

esp8266, esp32: WiFi: clarification about PowerManagement attributes

openby massimosalaopened 2024-05-30updated 2025-11-06
docs

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues and didn't find any that matched.

Documentation URL

https://docs.micropython.org/en/latest/library/network.WLAN.html

Description

Trying to disable PowerManagement on a esp board acting as client WiFi.

The last doc says:

Constants
WLAN.PM_PERFORMANCE
WLAN.PM_POWERSAVE
WLAN.PM_NONE

I tried from REPL:

from network import *
nic = WLAN(STA_IF)
nic.config(pm = WLAN.PM_NONE)

dir(nic)
['__class__', 'PM_NONE', 'PM_PERFORMANCE', 'PM_POWERSAVE', 'active', 'config', 'connect', 'disconnect', 'ifconfig', 'isconnected', 'scan', 'status']

Questions:

  1. So the attributes are available also on the nic instance: is it wanted or is just a leftover from the past ?

  2. esp32: do these attributes make obsolete the previous setting listen_interval ?

CANDIDATE · ISSUE

esp8266: Error OSError: -40 https request

closedby andreyu-gitopened 2024-03-28updated 2024-09-02
port-esp8266

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues matching this bug, and didn't find any.

Port, board and/or hardware

esp-8266

MicroPython version

MicroPython v1.22.2 on 2024-02-22; ESP module with ESP8266

Reproduction


import esp

import network
import urequests as requests

esp.osdebug(0)

wlan = network.WLAN(network.STA_IF)
wlan.active(True)

if not wlan.isconnected():
    print('connecting to network...')
    wlan.connect('RT166', 'mypass')

    while not wlan.isconnected():
        pass

print('network config:', wlan.ifconfig()[0])

bot_token = 'mytoken'

res = requests.get(url=f'https://api.telegram.org/bot{bot_token}/sendMessage', data={
    chat_id: '000000',
    text: 'hello'
})

print(res.text)

Expected behaviour

No response

Observed behaviour

Traceback (most recent call last):
  File "<stdin>", line 26, in <module>
  File "requests/__init__.py", line 184, in post
  File "requests/__init__.py", line 93, in request
OSError: -40

Additional Information

Hello!

I'm trying to make an http request to the telegram api and I get the OSError error: -40

I searched for information on the Internet, but I never found a solution!

Please tell me how to fix this problem!

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied