Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add internal IP address to device info #30

Open
emcniece opened this issue Apr 6, 2016 · 2 comments
Open

Add internal IP address to device info #30

emcniece opened this issue Apr 6, 2016 · 2 comments

Comments

@emcniece
Copy link
Collaborator

emcniece commented Apr 6, 2016

It would be useful to know the internal IP address assigned to a device. Can this be done through OakCore?

@pfeerick
Copy link

pfeerick commented Oct 25, 2016

Do you mean as in "What IP has my Oak been allocated on my wifi network?" If so, I've done that manually via the following code during setup(), which creates a Particle variable that is populated with the devices current IP address. The overall code is a bit more complicated than that... as I manually connect to particle to work around the 'variable must exist within first 1-2 seconds of particle connection' glitch, and also rather dumbly refreshes the IP address every 60 seconds just in case the DHCP lease lapses and a new IP is allocated. You can see an earlier version of the full code here if you wish.

  IPAddress myIp;
  char myIpString[24];
  myIp = WiFi.localIP();
  sprintf(myIpString, "%d.%d.%d.%d", myIp[0], myIp[1], myIp[2], myIp[3]);
  Particle.variable("ipAddress", myIpString);

@kh90909
Copy link
Owner

kh90909 commented Oct 25, 2016

Do you mean as in "What IP has my Oak been allocated on my wifi network?"

Yes, that was what @emcniece had in mind. We weren't able to add this feature at the time because OakCore didn't support it, but I could imagine adding an IP address query based on your code similar to the mode query I wrote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants