>>> Join Us in the Fight Against Air Pollution

AirGradient Forum

Setup static IP and push metrics to url

Hello,

I just got my device and trying now to set it up.
The device has connected via wifi and got an IP from the DHCP server.
But I want to setup a static IP and cannot find out how.
When this problem is solved, I’d like to configure it so it pushes the data to my server.
So far I have only found the /metrics page where I could parse the data.
In my ideal world I would like to setup an URL where the device pushes the data to, in JSON format, as soon as it has new readings.
Any help appreciated!
Thank you very much.

You could create a DHCP Reservation on your server side so it will keep the same IP without needing to set it on the device

I know, I could do that.
But I prefer doing it the clean way and set it on the device.
Started browsing through the arduino code … is there an easy way to hardcode a static ip?

This isn’t a setting that is normally exposed, so I think editing the code locally is next step, but that means you won’t get the latest firmware updates without having to make the changes again.

A bit of Google/Bing will show you some ways:
How to set a Static or Fixed IP Address on your ESP32

I use ESPHome and it has a straight forward way to define a static IP as well.

@ag9 are there any further updates?

Had not the time to code that yet.
For the time being I have found out that I could use the .local address to access the device.
That’s almost as good as a static IP.

do you have any docs related to that that I can read?

1 Like