
Czym jest tajemniczy Blynk i czemu mielibyśmy się nim zainteresować, a tym bardziej kupować specjalnie dla niego VPSa i bawić się w konfigurację ?
W skrócie jest to pośrednik w naszym IOT, łączy on nasza aplikacje na telefonie z ESP w naszym domu, a dzięki rozwiązaniu bazującym na VPSie mamy bezpośredni dostęp do ESP z telefonu niezależnie od tego jak, i z czym się łączymy - do tego zyskujemy serwer WWW gdzie możemy nasze wyniki wyświetlać światu/sobie, czy postawić VPNa i dodatkowo zabezpieczyć nasz połączenie z sieci publicznych

Co możemy zrobić z Blynkiem ?
Od najprostszych zadań typu zapalanie diody telefonem, po dużo bardziej systemu automatyzacji domu (nie lubię określenia inteligentny dom).
Ja uzywam blynka jako pilota RTV, regulację jasności pomieszczeń i alarm w domu, do tego zdalne zarządzanie samochodem - możliwości ogromne jak widać.
W czym jest lepszy gorszy od innych ?
Mamy otwarty serwer, i możliwość wszystkiego napisania pod siebie.
Gorszy ? Cóż, na początku może wydawać się ciut skomplikowany bo nie ma "gotowy" jako takich.
Cóż więcej dodać ? Juz się wyprodukowałem, więc zapraszam poniżej do instrukcji na bazie wybranego przeze mnie VPSa (ze względu na cene) - oczywiście opis zadziała na każdym praktycznie systemie z rodziny Debiana (w tym te znane na Raspberry czy Ubuntu) - więc stawiając na Malinkę i nasz internet mamy za darmo

Na początek wybieramy interesujący nas VPS, polecam ten z linku poniżej ze względu na śmieszą wręcz cenę 3$ rocznie bez limitu transferu:
VPS 256MB

Po kupnie dostaniemy meila z danymi, logujemy się do panelu naszymi danymi na stronie:
KLIK
Następnie pobieramy PuttyGen, dzięki któremu wygenerujemy plik do Putty by automatycznie nas logował po połączeniu jako root.
Po odpalniu PuttyGen klikamy generate i latamy myszką po polu aż pasek postępu się zapełni. Po wygenerowaniu, kopiujemy zawartość czerwonej tabelki do panelu VPSa, w zakładce Update SSH.



Następnie klikamy save private key (zielona ramka PuttyGen), zapisujemy plik, i odpalamy putty podając nasz adres i port, a nastepnie przechodzimy do zakładki w żółtej ramce, i zaznaczamy browse (różowa ramka). Dzięki czemu podczytamy do putty nasz plik by przy logowaniu na roota nie wymagał od nas program hasła.
Następnie wracamy do strony https://vzcontrol.wishosting.com/ i tworzymy naszą maszynę:


System polecam Debian 8, ze względu na wagę i niskie zapotrzebowanie na zasoby, na czysto 450MB z 40GB.
No dobra, mamy już system i możliwość logowania, teraz chyba pora na postawienie na tym Blynka

Aktualizujemy system do wersji stable (bo stary nie lubimy starego kernela 2.6

apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get clean && apt-get autoremove -y && apt-get install -y nano apt-utils && reboot
potem:
sed -i 's/jessie/stretch/g' /etc/apt/sources.list
echo "deb http://ftp.debian.org/debian stretch-backports main" | tee -a /etc/apt/sources.list > /dev/null
apt-get update
apt-get -t stretch-backports upgrade && apt-get -t stretch-backports install linux-image-4.19.0-0.bpo.5-amd64 && reboot
i na koniec:
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get clean && apt-get install -y openjdk-11-jdk screen && reboot
Logujemy się jako root na naszej maszynie i tworzymy nowego użytkownika (albo nie, jak kto woli) poleceniem:
adduser blynk
Logujemy się na użytkownika Blynk i pobieramy najnowszy serwer https://github.com/blynkkk/blynk-server/releases:
wget https://github.com/blynkkk/blynk-server/releases/download/v0.41.8/server-0.41.8.jar
mkdir Blynk
Tworzymy plik konfiguracyjny, bez niego nie damy rady się połaczyć bo nie wszystkie porty VPS ma otwarte, informacje o otwartych mamy w meilu, musimy zmienić wpisy:
hardware.mqtt.port=8440
http.port=8080
https.port=9443
admin.pass=admin
reszta wdg uznania.
nano Blynk/server.properties
i wklejamy:
Spoiler:
#hardware mqtt port
hardware.mqtt.port=8440
#http, plain web sockets and plain hardware port
http.port=8080
#if this property is true csv download url will use port 80 and will ignore http.port
force.port.80.for.csv=false
#if this property is true redirect_command will use 80 port and will ignore http.port
force.port.80.for.redirect=true
#secured https, web sockets and app port
https.port=9443
#address to bind to. by default bounded to all interfaces
listen.address=
#by default server uses embedded in jar cert to simplify local server installation.
#WARNNING DO NOT USE THIS CERTIFICATES ON PRODUCTION OR IN WHERE ENVIRNOMENTS REAL SECURITY REQUIRED.
#provide either full path to files either use '.' for specifying current directory. For instance "./myfile.crt"
server.ssl.cert=
server.ssl.key=
server.ssl.key.pass=
#by default System.getProperty("java.io.tmpdir")/blynk used
data.folder=
#folder for logs.
logs.folder=./logs
#log debug level. trace|debug|info|error. Defines how precise logging will be.
log.level=info
#maximum number of devices allowed per account
user.devices.limit=50
#maximum number of tags allowed per account
user.tags.limit=100
#defines maximum allowed number of user dashboards. Needed to limit possible number of tokens.
user.dashboard.max.limit=100
#defines maximum allowed widget size in KBs as json string.
user.widget.max.size.limit=20
#user is limited with 100 messages per second.
user.message.quota.limit=100
#maximum allowed number of notification queue. Queue responsible for processing email, pushes, twits sending.
#Because of performance issue - those queue is processed in separate thread, this is required due
#to blocking nature of all above operations. Usually limit shouldn't be reached.
notifications.queue.limit=2000
#Number of threads for performing blocking operations - push, twits, emails, db queries.
#Recommended to hold this value low unless you have to perform a lot of blocking operations.
blocking.processor.thread.pool.limit=6
#this setting defines how often we can send mail/tweet/push or any other notification. Specified in seconds
notifications.frequency.user.quota.limit=5
#this setting defines how often we can send webhooks. Specified in miliseconds
webhooks.frequency.user.quota.limit=1000
#this setting defines how big could be response for webhook GET request. Specified in kbs
webhooks.response.size.limit=96
#maximum size of user profile in kb's
user.profile.max.size=128
#number of strings to store in terminal widget
terminal.strings.pool.size=25
#number of strings to store in map widget
map.strings.pool.size=25
#number of strings to store in lcd widget
lcd.strings.pool.size=6
#maximum number of rows allowed
table.rows.pool.size=100
#period in millis for saving all user DB to disk.
profile.save.worker.period=60000
#period in millis for saving stats to disk.
stats.print.worker.period=60000
#max size of web request in bytes, 256 kb (256x1024) is default
web.request.max.size=524288
#maximum number of points that are fetched during CSV export
#43200 == 60 * 24 * 30 - minutes points for 1 month
csv.export.data.points.max=43200
#specifies maximum period of time when hardware socket could be idle. After which
#socket will be closed due to non activity. In seconds. Default value 10 if not provided.
#leave it empty for infinity timeout
hard.socket.idle.timeout=10
#enable DB
enable.db=false
#enable raw data storage to DB
enable.raw.db.data.store=false
#size of async logger ring buffer. should be increased for loads >2-3k req/sec
async.logger.ring.buffer.size=2048
#when true - allows reading worker to trigger hardware even app is offline
allow.reading.widget.without.active.app=false
#when enabled server will also store hardware and app IP
allow.store.ip=true
#initial amount of energy
initial.energy=100000
#ADMINISTRATION SECTION
admin.rootPath=/admin
#used for reset password page and certificate generation.
#by default current server IP is taken. could be replaced with more friendly hostname.
#it is recommended to override this property with your server IP to avoid possible problems of host resolving
#server.host=test.blynk.cc
#used for fallback page for reset user password, in most cases it should be the same as server.host
#IP is not allowed here, it should be blynk-cloud.com for Blynk app
#or *.blynk.cc for private servers with own apps
restore.host=blynk-cloud.com
product.name=Blynk
#email used for certificate registration, could be omitted in case you already specified it in mail.properties
#contact.email=
#network interface to determine server's current IP.
#only the first characters of the interface's name are needed.
#the default setting eth will use the first ethX interface found (i.e. eth0)
net.interface=eth
#comma separated list of administrator IPs. allow access to admin UI only for those IPs.
#you may set it for 0.0.0.0/0 to allow access for all.
#you may use CIDR notation. For instance, 192.168.0.53/24
allowed.administrator.ips=0.0.0.0/0,::/0
# default admin name and password. that will be created on initial server start
admin.email=admin@blynk.cc
admin.pass=admin
i uruchamiamy nasz serwer poleceniem:
screen java -jar server-0.41.8.jar -dataFolder Blynk -serverConfig Blynk/server.properties
I tyle, od teraz możemy do woli już bawić się Blynkiem, energii nam nie zabraknie

Mam nadzieję że się przyda - do wszelkich projektów.
Cool? Ranking DIY