Comments (6)
@ebolisa, could you show a complete example?
First make wifimgr.py work without Blynk.
Then modify its html code to accept the blynk token.
Modify its py code so it can be read.
Then in boot.py:
try:
wlan = wifimgr.get_connection()
BLYNK_AUTH = wifimgr.get_profiles()[2]
print('** Wifi connection established **')
if wlan is None:
print("Could not initialize the network connection.")
while True:
pass # you shall not pass :D
except Exception:
print('Wifi connection error...')
umachine.reset()
in main.py:
# Initialize Blynk
try:
# blynk = BlynkLib.Blynk(BLYNK_AUTH) # faster
# or....
blynk = BlynkLib.Blynk(BLYNK_AUTH,
insecure=True, # disable SSL/TLS
server='lon1.blynk.cloud', # lon1 fra1.blynk.cloud or blynk.cloud
port=80, # set server port
heartbeat=30, # set heartbeat to 30 secs
log=dprint # use print function for debug logging
)
except OSError as e:
umachine.restart()
@blynk.on("connected")
def blynk_connected(ping):
print('Blynk ready. Ping:', ping, 'ms')
blynk.sync_virtual()
@blynk.on("disconnected")
def blynk_disconnected():
print('Blynk disconnected')
utime.sleep(5)
umachine.reset()
from blynk-library-python.
@vshymanskyy, could you suggest?
from blynk-library-python.
could you suggest?
I used wifimgr.py. Modified the html/py code to collect credentials by storing them in wifi.dat and then, used them in my main code.
from blynk-library-python.
@ebolisa, I mean the implementation of the Blynk.Inject function for connecting in the application, as in this video
from blynk-library-python.
@ebolisa, I mean the implementation of the Blynk.Inject function for connecting in the application, as in this video
I undestood you. wifimgr.py puts your device in AP mode like shown in the video. Then you introduce your router and Blynk credentials. At reboot, your device will automatically connect to Blynk. At least, that's the way I do it.
from blynk-library-python.
@ebolisa, could you show a complete example?
from blynk-library-python.
Related Issues (20)
- RPI disconnects HOT 8
- Invalid Auth Token
- Invalid auth token with both py libraries for Blynk console 2.0 HOT 3
- Pycom Lopy4 disconnects HOT 4
- Invalid Token RPi4b HOT 8
- Notify HOT 2
- Socket Disconnects - Blynk offline HOT 4
- pip install blynk-library-python doesn't pull 1.0.0 HOT 5
- Does not recover after disconnect
- An Example might be wrong when I demo it on ubuntu. @blynk.on => @blynk.ON
- BrokenPipeError HOT 6
- Connection doesn't work, requires server="blynk.cloud" HOT 1
- Pin Handlers
- Install BlynkLib using mip.install HOT 1
- AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'? HOT 3
- 'Blynk' object has no attribute 'VIRTUAL_WRITE' on a raspberry pi pico w HOT 3
- Unable to sync manual switch with the blynk app button
- Connecting to blynk.cloud:443... HOT 1
- #corrected funnction for blynk connection issue with the blynklib.py file it has issue in connect self function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blynk-library-python.