Data not being updated when pushed from Arduino side to Linux side

I have a project that is reading the temperature from a sensor then storing that value so it will be accessible from the Linux process or. My basic code is this:

#include <Bridge.h>

void setup() {
  
  Bridge.begin();
}

void loop() {
  float temp = getTemperature();
  Bridge.put("MCP9808_Temperature", String(temp));
  delay(1000);
}

I know that my getTemperature() function (not shown) is working properly, and that is reads an updated temperature from doing some debugging with the serial monitor.

In my python code I’m doing this:

#!/usr/bin/python
import sys, time, os
sys.path.insert(0, "/usr/lib/python2.7/bridge/")
from bridgeclient import BridgeClient
client = BridgeClient()
temp = float(client.get("MCP9808_Temperature"))
print temp

Wiht this code I should be able to access the last temperature value that the arduino sketch put in the “MCP9808_Temperature” variable.

However, each time I run the python script it continues to print out the same value every single time. This even happens when I open the serial monitor and can see that the temperature value that the sketch is reading is changing.

It looks like the value that the python script continues to print out is the initial temperature reading when the sketch is first loaded. So for one reason or another during each loop of the sketch is failing to ‘put’ the new value… is not overwriting the “MCP9808_Temperature” variable.

Any thoughts?

What do you get if you use a web browser to access: HTTP://arduino.local/data/get (of course, replace arduino.local as needed with your Yun's address)

That should list the current state of all values that have been put() to the bridge. Is that value changing? That would be a good way to tell if the issue is in the sketch or the Linux code.