No.
The simplest solution would be to turn off auto updates for app. And do manual updates when necessary.
We will also simplify admin access soon. However, no compromise here. Either secured env. or simplicity .
No.
The simplest solution would be to turn off auto updates for app. And do manual updates when necessary.
We will also simplify admin access soon. However, no compromise here. Either secured env. or simplicity .
i didn’t say the current way to set up admin panel is complicated, because it seems ok.
the problem rather was the not very clear composition of the docs, about the importance of the server.properties file. that should be edited a little…
I agree… I had Local Server up and running almost at the very beginning… but it took much longer tying to figure out the admin page before even catching onto the server.properties file.
But as stated… soon to get even easier
ok, now i need some sleep. tomorrow i will get back with details how it goes.
thanks again, for everyone!
I didn’t mean you, I mean many other users .
hello!
just continuing with my wandering in the realm of linux and rpi… maybe will be useful for others. today i managed to configure the rest of the necessary stuff:
downloaded blynk server files from here
copy server.properties file into home/pi folder and make your modifications if necessary. i’ve changed here:
enable.raw.db.data.store=true
allowed.administrator.ips=0.0.0.0/0
(only i will use this server, so no security concern)
reboot pi
start blynk admin panel in browser, give yourself lots of energy in users > yourAccount > energy > save changes
make the modifications in hw sketch and upload. for easy switching between cloud and local server, i made like this:
in header file:
// SERVER CONFIGURATION
//#define CLOUD
#define LOCAL
in main file:
#ifdef CLOUD
const char* ssid = "router ssid"; // CLOUD
const char* pass = "router wifi pass"; // CLOUD
char auth[] = "cloud token";
#endif
#ifdef LOCAL
char ssid[] = "zero ssid"; // LOCAL
char pass[] = "zero wifi pass"; // LOCAL
char auth[] = "local token";
#endif
and in void setup:
#ifdef CLOUD
Blynk.begin(auth, ssid, pass); // CLOUD
#endif
#ifdef LOCAL
Blynk.begin(auth, ssid, pass, IPAddress(zero ip here)); // LOCAL
#endif
this way, when switching the same hw between local or cloud, i just have to comment / uncomment the 2 lines in the header file.
at this point all the pi / ap / server / app / hw configuration is done. now, i can connect to my local blynk server and have a fully standalone, working system. (when uploading new sketch ota, i just connect with my laptop to the pi zero wifi, and select the wemos ip address in arduino ide)
now, i could even stop here, because theoretically all is set up. but i’m too lazy person, and i wanted to have other “gadgets” like:
1) reduced boot time / power consumption on pi
2) access my pi zero from my windoze laptop (this way i can renounce to the pi’s keyboard, mouse and display)
3) have internet connection on the pi, while still in ap mode (this is important, because i have to keep the os and blynk server up to date, etc)
my linux knowledge is ultra basic, to say at least. probably i could never figure out how to achieve all these functions, if one of my friends didn’t help me out. (luckily, that guy is a unix / linux guru. these specimens are really strange kind of people, but could be quite handy sometimes ;))
1) ok, actually i could do this alone, with some google:
in terminal type: sudo raspi-config
(this is kind of a “bios” menu for the pi)
here one can find various basic os setting. i just have selected the “no gui on startup, with command line auto login” option, that’s all. this way i have much shorter boot up time, lower current consumption, lighter on ram, etc.
2) access pi from windoze pc:
first enable ssh on the pi:
one can do this in gui:
start menu > preferences > pi configuration > interfaces
or in sudo raspi-config
after ssh is enabled, install putty portable on the windoze machine. connect to the pi hotspot, open putty and type the pi zero ip address. leave the other settings as is (port 22, ssh). you can also save the session for future use. (on my pc the putty text size was too small to read, i could set the size in window > appearance > font settings.)
also, if you wish to set up auto log in with putty, you can do like this:
if all is set, just press open. a terminal window will open, here you have to enter user (default rpi user is “pi”), and password (default is “raspberry”).
there you have a working command line, to interact with the pi zero! no dedicated keyboard, mouse, display are needed, you can mount now the mini server out of sight!
3) internet connection:
for my project i set up the pi to work in access point mode (wifi hotspot). so, there is no internet connection on it. if you wish to check for server updates, or install new app, it is not possible.
here is how to share your laptop’s ethernet connection with the pi:
on the windoze pc:
connect to the pi zero wifi
start putty and connect to the pi (log in, etc)
set the gateway to use static ip:
edit the interfaces file: sudo nano /etc/network/interfaces
add after netmask line these 2 lines:
gateway xxx.xxx.xxx.200
(the pi ip address)
dns-nameservers 8.8.8.8 8.8.4.4
it should look like this:
iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0
gateway 192.168.42.200
dns-nameservers 8.8.8.8 8.8.4.4
save the file and close editor: ctrl+x, y, enter
sudo reboot
xxx.xxx.xxx.200
). for subnet mask use 255.255.255.0
ping 8.8.8.8
(if you see some ms times it is ok)ping google.com
(if you see some ms times it is ok)sudo apt-get install mc
After all said and done, disable the GUI on the Pi, saves power
if you mean this:
it is already done
i’ve heard that it is also possible to turn off the hdmi port, it saves around 25ma, but it is a little risky…
Ow yes, missed that, awesome instructions, very complete!
thanks, i still learning linux, on very beginner level
Did you use the forever service for this or did you find a less bloated way?
initially we (one of my quite expert linux friend + me) tried to make it with init.d method, but after more than 1 hour unsuccessful trying, we gave up.
with the crontab it worked out of the box, and still work flawless since than.
@wanek crontab seems fine, maybe it’s the client (in combination with the server) that requires the forever service.
i do not really understand. you mean if the client + server are on the same rpi?
Yes, the issue is the Blynk server takes quite a long time to start up so if you try to run the client from crontab and similar it will fail. “Forever service” is fine though.
ah, ok i see. but i do not have the client on the same hw. the client is a wemos.
Hope you don’t mind me posting this here @wanek but hopefully this thread can become a go to resource for Zero W.
@Dmitriy I messed up a new Zero W installation with the new login details for the admin panel. I didn’t want to use a server.properties initially so I went with the default credentials and this was fine.
I then added server.properties and new admin panel credentials, but no certs, and restarted the server.
The credentials were for one of my email accounts that didn’t yet have an account on the server. At this point the default credentials still gave me access to the admin panel.
I then added the account for the email address in server.properties and started the server again.
Now I can’t get in with Chrome unless I use incognito mode, probably some weird caching issue. Can’t login with Internet Explorer and that doesn’t have an cache for the url. Incognito is still taking the default access details and not the credentials I provided.
How do I gain access with the real credentials?
Are certs required for the admin panel to work?
What will happen if I delete the admin@blynk.cc account from the server?
regarding the autostart, there was a bug in docs, this is why it not worked with the first method…
The better solution is to create a separate script in init.d folder, and run update-rc.d to include it at startup. There is an example startup script for Blynk I made somewhere around here. But for reference, here is another script:
#!/bin/sh
### BEGIN INIT INFO
# Provides: mjpeg-stream
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mjpeg-stream
# Description: webcam stream from local network
### END INIT INFO
BASE=/tmp
PID=$BASE/mjpeg-streamer.pid
LOG=$BASE/mjpeg-streamer.log
ERROR=$BASE/mjpeg-streamer-error.log
COMMAND="/home/bastiaan/mjpg-streamer/mjpg_streamer -b -i '/home/bastiaan/mjpeg-streamer/input_uvc.so' -o '/home/bastiaan/mpjeg-streamer/output_http.so -w ./www -c bastiaan:15Pir@@tjes'"
status() {
echo
echo "==== Status"
if [ -f $PID ]
then
echo
echo "Pid file: $( cat $PID ) [$PID]"
echo
ps -ef | grep -v grep | grep $( cat $PID )
else
echo
echo "No Pid file"
fi
}
start() {
if [ -f $PID ]
then
echo
echo "Already started. PID: [$( cat $PID )]"
else
echo "==== Starting"
touch $PID
if nohup $COMMAND >>$LOG 2>&1 &
then
echo $! >$PID
echo "Done"
echo "$(date '+%Y-%m-%d %X'): START" >>$LOG
else
echo "Error"
/bin/rm $PID
fi
fi
}
kill_cmd() {
SIGNAL=""; MSG="Killing "
while true
do
LIST=`ps -ef | grep -v grep | grep server.jar | awk '{print$1}'`
if [ "$LIST" ]
then
echo; echo " $MSG $LIST" ; echo
echo $LIST | xargs kill $SIGNAL
sleep 2
SIGNAL="-9" ; MSG="Killing $SIGNAL"
if [ -f $PID ]
then
/bin/rm $PID
fi
else
echo; echo "All killed" ; echo
break
fi
done
}
stop() {
echo "==== Stop"
if [ -f $PID ]
then
if kill $( cat $PID )
then echo "Done."
echo "$(date '+%Y-%m-%d %X'): STOP" >>$LOG
fi
/bin/rm $PID
kill_cmd
else
echo "No pid file. Already stopped?"
fi
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop ; echo "Sleeping..."; sleep 1 ;
start
;;
'status')
status
;;
*)
echo
echo "Usage: $0 { start | stop | restart | status }"
echo
exit 1
;;
esac
exit 0
The trick is to use the start/stop/restart states otherwise update-rc.d won’t work. More info here: https://www.debuntu.org/how-to-managing-services-with-update-rc-d/