[SOLVED] Config/Setup for PHOTON WiFi bridge connection to LOCAL SERVER

It’s standard code to ensure Blynk stuff is only attempted if you are connected to the server and allows the sketch to run without interruption when the server is down. Obviously none of the Blynk stuff will work whilst the server is down but regular Arduino code will still function.

@Gunner and @Costas Thank you both for looking. I have been looking on PARTICLE community. I believe the code is correct… the SERVER is somehow at fault. In my code and in the “working” example from PARTICLE community, BOTH lock execution on the attempt to first connect to the server with the statement:

```Blynk.begin (auth, server_ip, 8442);```

( Or, it may be possible that I am formatting something bad in the command??? )

Gunner, not trying to “accomplish” anything logical with the code, the LEDs are simply my quick way of visually diagnosing where I am in the code execution. Watching the LEDs is easier than turning the COM port on constantly.

The Blynk.run connected/not connected logic was suggested code logic I copied elsewhere to keep Blynk.run() clean when not connected… simply looks like good practice to keep it out when not connected???

If you can look at my previous SERVER start text and offer suggestions, that may help. Server is the new adventure I am very weak with.
Thank you both very much for the time. I will be back on Server diagnosis tomorrow.

@LZHenry what hardware are you running the server on?

Did you move the login slider and set the IP of the server in the app?

These are interesting questions… but I have no answers. Need I be on my BLYNK phone APP to complete the SERVER setup???

Not to complete the server set up but to connect to a local server you need to make the mod in the app.

Look for the router / traffic light icon, click it and move the slider from the left, default (Blynk cloud server), to the right and enter the IP for your server (don’t change the port).

What hardware are you running the server on?

PC, WIN 10 , Hard Enet cable to Comcast modem… Comcast modem wireless to PHOTON.

@Costas New guy is confused… Phone APP has no router ICON???

It does, click logout.

@Costas WOW… totally missed that instruction …

For address I entered 10.0.0.166… which is my locked ip of my PC… Right???
Now it is claiming I have no internet connection for my login… ???

Costas… another HOPE with this puzzle piece. I will locate the documentation for the “traffic light icon” tomorrow and start with a fresh outlook. Late here for me; thank you for sticking with this and giving me something to fill the day with tomorrow.

That I understood :wink: what I meant was why stop Blynk.run() from running if disconnected? I don’t know where you read that that was “good practice”, I don’t think I have come across that in this forum?

Blynk.run() is the main function that runs the Blynk core on the hardware, stop it and you get disconnected; Don’t have it running and you are probably not going to connect properly (although Blynk.connect() might work for that); Run it when disconnected, as is available via blynk.config() setup, and while it will keep trying to connect, the rest of your sketch stays running.

EDIT - Yup am I completely lost here :stuck_out_tongue: see next post.

I guess there have been some assumptions here about your knowledge with Local Server. Sorry if that has been confusing things for you.

First, it is completely separate from the Cloud Server… Before you can actually connect to it, you need to create a new account on it, via the app (see below); Then log into it to create a NEW project and get THAT auth code to place in your Photon sketch (not one made from a cloud account)… then perhaps you can connect your hardware to your Local Server.

https://github.com/blynkkk/blynk-server#app-and-sketch-changes

You will see it in many sketches and it’s combined with the timed event of trying to reconnect to the server. If you don’t have it and the internet, router, server fails for an extended period then the ESP will spend almost all it’s time trying to reconnect to the internet and not performing the regular “Arduino” stuff in the sketch.

1 Like

Yes, I stand corrected :blush: I had seen those groupings, but having never actually played with the relevant hardware (hopefully that will change in a month or so ;)) I clearly hadn’t looked that close to the fact that Blynk.run() itself was being cut out of the loop… I just focused on the reconnection routines, until now.

Always learning, with a little help from my forum friends :smiley: Thanks.

1 Like

@Gunner @Costas Obvious NOW in the documentation that a new account is needed… but still not clear to new server implementers.

HOWEVER, still have basic issues with the SERVER connection. Please remember server is very new for me.
Connection is WIN 10 PC Hardwire hosting SERVER >>> to Comcast modem >>>to Internet. >>>to Phone APP

EDIT: AH found the correct format to be https://10.0.0.166:9443/admin but STILL nee APP Connection help…

1

  • Blynk* phone APP will NOT connect when using 10.0.0.166

  • Returns “you have no internet connection”

    • Obviously, Blynk needs to go through the comcast modem to get to this ip???
    • HOW do I specify ip in APP???

2 testing EDIT: IGNORE THIS
attempting to connect to my server locally… directly from the PC hosting the server…
USING https://10.0.0.166/admin
returns 10.0.0.166 refused to connect

attempting to connect to my server locally… from a wireless laptop
USING https://10.0.0.166/admin
returns 10.0.0.166 took too long to respond

Can you now try accessing the admin panel from your Smartphone in a browser.

This is just to check your system.

The APP just needs 10.0.0.166 as the server settings with the port left as the default 8443.

When you created the local server did to set up server.properties and mail.properties?

Just thinking about the server log verbosity that is covered in the server.properties file. Perhaps check the log as it currently is and then consider increased verbosity if it doesn’t provide enough details.

Paste the log here if required.[quote=“LZHenry, post:17, topic:15662”]
D:\BLYNK_Server_Data>java -jar server-0.25.3.jar -dataFolder /path
WARNING : ‘/path’ does not exists. Please specify correct -dataFolder parameter.
Your data may be lost during server restart. Using temp folder : C:\Users\r\AppData\Local\Temp\blynk
[/quote]

Normally the server is “expected” to be on a Unix machine but Windows will work. You haven’t created the correct folder as defined in the path. There is a danger when you get up and running that you will lose all your projects etc with the set up you currently have. Perhaps search for my posts that contain the word “path” but it shouldn’t stop you testing the system as it is now. If you have problems with the path perhaps start another thread for this.

Basically the Hardware, Local Server and App need to communicate on the same network. Or in the case of the App, when roaming around away from home, over the internet to your local network via port forwarding.

But your network infrastructure must support all of that. Is your comcast modem a cellular modem?? Does it offer a WiFi access point?

@LZHenry I was thinking Comcast was the brand of router but I now think this is your service provider. Can you provide details of the exact make and model of your router.

@Gunner @Costas

Today’s work has focused on the server not communicating properly. ( I understand you would like me to switch to LINIX, but I am old and resist “new” trends.) If you have the patience… please comment on the following.

Overview

  • PC where server is hosted CAN connect to the ADMIN screens (https://10.0.0.166:9443/admin)
  • Laptop on my wireless net CAN NOT connect
  • And obviously, Phone APP can not connect.

Implemented Port Forwarding at the Comcast modem model AARIS TG 1682G

Directory WARNING Fixed
Fixed the server start warning by properly adding my server directory into the cmd file
java -jar %latestjar% -dataFolder D:\BLYNK_Server_Data

SSL Certificate Warnings NOT fixed; will fix as knowledge increases. Is this needed before APP or remote PC will talk???

Server.Properties
YOUR QUESTION “When you created the local server did to set up server.properties and mail.properties? “

Added the properties file, but have not yet edited much yet; working on that tonight.

ISSUE: Server Exits Improperly

  • Start the server … Using the Waleed El-Badry cmd file.
  • Server starts and dos window remains “up”
  • If the dos window is closed, the server EXITS!
  • Do not know why; do not think this was the action “yesterday”
    *** Comments welcomed to aid with learning**

Logical questions seeking wisdom

  • Why are tokens needed for a LOCAL network.
  • I want to talk PHOTON >>> PHOTON
  • Assumed I could use ANY number I wanted?

If the answer to the above is “FW needs a properly hashed number” then
Why do I need a NEW token with a NEW account specifically for LOCAL nets???

After tonight, traveling for the week and will not get back to project work for a few days.
Thanks for continuing to help with issues that are probably boring to you.




Server Startup Data Follows


Starting HZ Blynk Server
Script created by
Waleed El-Badry
waleed.elbadry@must.edu.eg


Your working directory is D:\BLYNK_Server_Data\



Local Server IP Address is: 10.0.0.166
Hardware Port : 8442
Application Port : 8443


Available server files
Volume in drive D is H BOOT 1TB
Volume Serial Number is D068-4CDD

Directory of D:\BLYNK_Server_Data

07/06/17 08:52 PM 16,806,240 server-0.25.3.jar
1 File(s) 16,806,240 bytes
0 Dir(s) 471,473,258,496 bytes free

D:\BLYNK_Server_Data>echo Server latest version on folder is server-0.25.3.jar
Server latest version on folder is server-0.25.3.jar

D:\BLYNK_Server_Data>rem R fixed to the BELOW

D:\BLYNK_Server_Data>java -jar server-0.25.3.jar -dataFolder D:\BLYNK_Server_Data -serverConfig D:\BLYNK_Server_Data\HZServer.properties

Blynk Server 0.25.3 successfully started.
All server output is stored in folder ‘D:\BLYNK_Server_Data.\logs’ file.

Blynk.log Data follows

18:26:22.097 INFO - Using data dir ‘D:\BLYNK_Server_Data’
18:26:22.472 INFO - Region : local
18:26:22.864 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
18:26:22.894 INFO - Didn’t find custom user certificates.
18:26:22.894 INFO - Didn’t find Let’s Encrypt certificates.
18:26:22.894 WARN - You didn’t specified ‘server.host’ or ‘contact.email’ properties in server.properties file. Automatic certificate generation is turned off. Please specify above properties for automatic certificates retrieval.
18:26:22.894 WARN - ATTENTION. Server certificate paths (cert : ‘D:\BLYNK_Server_Data’, key : ‘D:\BLYNK_Server_Data’) not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
18:26:23.347 INFO - Hardware plain tcp/ip server listening at 8442 port.
18:26:23.347 INFO - Hardware SSL server listening at 8441 port.
18:26:23.347 INFO - Application server listening at 8443 port.
18:26:23.347 INFO - HTTP API and WebSockets server listening at 8080 port.
18:26:23.347 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
18:26:23.347 INFO - Mqtt hardware server listening at 8440 port.

NOTE: Occasionally this last WARN appears???

17:53:05.822 WARN - No order field ‘id’

There used to be an entry in server.properties towards the end of the file that granted access to the admin panel. Originally it was localhost 127.0.0.1 only and that is why your PC would connect but nothing else. I thought this restriction had been removed when the password was added to access the admin area. Worth you checking this though.

Certs don’t need to be fixed yet.

Do you have a link to the Waleed Ed-Badry script?
I suspect the Dos window should be kept open.

Because that’s how the system works, your Photon interfaces via the server and your local server is a totally different server to the Blynk server you were originally using. Therefore your new local server knows nothing about any projects / accounts / token until you create them anew.