Photon softAP usage?

An interesting take by Google on this type of functionality :

Hello mebrunet, i realise this thread is old but i just where wondering.

Instead of flashing the firmware would it not be possible to use your connect html file
and host it on the Photon with help of the webserver library?

Maybe when connecting to the webserver via a webbrowser there is a index.htm with a link to the connect.htm.

What i was thinking of is that a client that do not have internet access can connect to the photons webserver and it opens the main page which shows the values i want to show from my photon and also use your connect file to connect the Photon.

I have not tried this yet but was thinking before i fall a sleep that this should be possible and i don’t have to do anything with the firmware.

What do you say about that?

BR
Dimi

@ido
Does that require a Wifi router or can 2 photons establish a connection and transmit data without Wifi? Do you know of any sample code/documentation to get started? I’m new to this.

To clarify, I want to be able to send data from one photon to another via softAP/Wifi-Direct without using Wifi. So basically I'm wondering if it is necessary for a client to have WiFi in order for 2 photons to share information. Can the photons establish this type of connection?

It was stated that this was on the roadmap but I have not found any updates.

Can you please advise?

Hi
Did any reply to this - I have the same issue - I want to use 2-legged auth to associate a new customer with a photon. The SoftAP works fine (thanks @mebrunet). The photon connects fine, but I presume a claim code has already been used by this time and the device is connected to my account? I now need to reassign to a specific customer. Has anyone attempted this?

Thanks

Kevin

3 posts were merged into an existing topic: Configure wifi (only) via website and/or app: please help

This might be interesting in this regard
https://github.com/spark/firmware/pull/906

That is milestoned for 0.5.0, which should go public not too far from now.
https://github.com/spark/firmware/milestones


Sorry that reply was moved due to a double post redact

Hi,

I am confused as to how to use softap-setup-js ( https://github.com/spark/softap-setup-js )
I want to set photon as an access point to directly communicate with a phone. I have node.js, can use particle cli to connect to networks, but want to use photon without an external network. So I installed softap with ( npm install softap-setup ) but I can’t be able to use anything from the repo. I keep getting a terminal error: -bash: syntax error near unexpected token `(’

I also tried using Meteor version of this library (https://github.com/msolters/softap-setup-meteor)
Here, the browser opens, and although I am to the photon wireless network with my computer, I get a red error at the bottom saying: "We weren’t able to find a Photon! … "
The console displays these while I do so:
I20160330-20:07:59.457(3)? WiFiControl: Automatically located wireless interface en0.
I20160330-20:08:00.949(3)? INFO electrify:plugins: acquire
I20160330-20:08:00.949(3)? INFO electrify:plugins:mongodb: acquiring mongo
I20160330-20:08:00.950(3)? INFO electrify:plugins:nodejs: acquiring nodejs
I20160330-20:08:00.950(3)? INFO electrify:plugins: start
I20160330-20:08:00.950(3)? INFO electrify:plugins:mongodb: app in development mode, skipping start
I20160330-20:08:00.952(3)? INFO electrify:plugins:nodejs: app in development mode, skipping start
I20160330-20:08:00.954(3)? INFO electrify:app: ensuring electrify dependencies
I20160330-20:08:01.571(3)? INFO electrify:electron: launching electron
I20160330-20:08:04.558(3)? WiFiControl: Scanning for nearby WiFi Access Points…
I20160330-20:08:07.967(3)? WiFiControl: Nearby WiFi APs successfully scanned (17 found).

@emilkl - Interesting idea. But does the user code run in SoftAP mode? I didn’t think so. If not, then this strategy would only be useful when the Photon already has credentials.

@mebrunet, have you given the links in this post a read?

Right, @mdma had linked me to that last week and talked about turning those SoftAP pages into a library. Curious to play with it when released and stable, but pretty over loaded with other stuff right now.

@nexxy , I have downloaded the softap-setup-js from github but I noticed that config.js is missing when I looked at basic-setup.js in the example folder. Would you add or let me know that config.js file. thanks.

Hi @mebrunet, I hosted on Digital Ocean and it doesn't work. What am I missing? I simply modified the HTML to my branding and hosted it and nothing is working. Thanks!

Any noteworthy output in the console perhaps?

Hi @Moors7, thanks for responding. There is no error....I should have been clearer. The HTML page works. I sent you a private message with the IP address. I just spun up the server on Digital Ocean yesterday to do a test - so I havent disable root login, secured the server, etc..

Here's a picture of the "error":

I feel as though this isn't an error, but rather I need to change something somewhere to "initiatie" a service. I have no idea how to technically explain this, since I am new.

My Photon already has the softap @mebrunet created flashed. But when I got to the HTML page and click the next button, the above dialogue appears.

Shouldn't I be prompted to enter the device ID or search for nearby Photons first? So it cannot be as simple as just modify the HTML and host the files.

In the script.js from the zip file, you will find the following:

var base_url = 'http://192.168.0.1/';

Should I change that to my IP address? I must have to do more than just host files, there has to be more configurations.... In some way I feel that there is not an error per se, but a step I am missing because experienced developers understand it to be implied, whereas I need a detailed step by step instruction.

Hope that made sense!

@dancingpearl -

There are two ways to use the repository of SoftAP setup tools I put together.

  1. Hosted from an external server: In this case the user should visit the url where you are hosting the setup page, e.g. this demo I have setup, and follow the instructions. The first step requires they connect their device to the Photon’s hotspot, which is emitted while it is Listening Mode (blinking blue). No special application firmware (i.e. the code you write) is required on the device, it just needs to be running system firmware 0.5.0 or above, which should be the case if it has already connected to the cloud once.

  2. Hosted from the Photon. In this case you need to connect to the Photon first, then visit a page its hosting. The method requires you write and flash application firmware, as described in the Firmware docs.

Which method are you trying? In the past, a had two separate SoftAP scripts for each case. The latest version I pushed to the repo two days ago should do both.

1 Like

Thank you! I understand now. I do have a remaining question. How did you change the name of the device from Photon-XXXX to Blinders-XXXX?

See this thread to change SSID.

3 Likes

Thank you!

I hope you did read down in that thread, to actually get to the dedicated function that got introduced since

System.set(SYSTEM_CONFIG_SOFTAP_PREFIX, "prefix");
System.set(SYSTEM_CONFIG_SOFTAP_SUFFIX, "suffix");