Blynk device to forward a local WiFi connected data point

I am currently using an ESP8266 and Blynk2.0 (with Edgent) for garage data and control. This works quite well.

I would like to add a single analog value from another ESP8266 device on the same WiFi network (outside temperature) to the existing Blynk2.0 device. This would avoid using up a device count for a single data point and also integrates that forwarded value into the Blynk2.0 display.

Any suggestions or ideas?

I’d probably use the HTTP(s) webbook to push that data from your temperature sensor device to the Blynk server using the auth token for your garage door opener.

The temperature sensor won’t run any Blynk code, it will simply connect to your WiFi the use a timer (SimpleTimer probably) to take a reading then post it to the Blynk server using the API.

Be aware that if you re-provision your garage door opener then the auth token for you device will change, and you’ll need to update your temperature sensor’s sketch so that it uses the updated auth token in your API call.

The basic code to make the API call is in this example…

but this assumes that the device making the API call will be a separate device in Blynk. As that’s not what you want, you’ll need to remove the Blynk code, include the SimpleTimer library, manage the WiFi connection yourself, then add-in the code relating to your temperature sensor.

Pete.

Interesting and I’ll follow up. I had thought of maybe trying MQTT locally and having that data forwarded. Your suggestion, I believe is go to the server directly and retrieve the values from there once sent via the API. I would also then use a static token to manage that issue.

Thanks for the suggestion.

MQTT is an option, but then you’d need an MQTT Broker, which adds to the complexity.

Of course, I would do it all via MQTT and Node-Red, with no Blynk code running on my devices, but that’s a whole different story.

Pete.

1 Like

Hey Pete, have you tried running this code with the latest esp8266 build 3.?.? Doesn’t like the http.begin(server_path.c_str());
If I roll back to 2.7.? it works fine so I haven’t taken the time to trouble shoot further, but curious if you have run into it.

Hi Dave, No, I haven’t tried. I’ll ty to take a look at what the issue is if I get chance.

Thanks for flagging it up.

Pete.

Hi Dave, I’m using

#include <ESP8266HTTPClient.h>

http.begin(client, server_path.c_str()); //ESP8266 core 3.0.2

Works fine, maybe you forgot ‘client’ ? :thinking:

The original version of ESP8266HTTPClient.h didn’t require the WiFi client to be specified, but since core version 3.0.0 it is now required.

I’ve updated the code in the original post, and added a note to explain the changes. I’ve tested it with core version 2.5.0 and the latest 3.0.2 version and it works with both.

Pete.

2 Likes