Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Sending data from arduino to emoncms localhost

Hi, I want to send sensordata to a localhost but it dosent work properly.

If i sent only one sensor it works, but when i sent two or more sensors to the localhost nothing happens.

this works:
WiFiClient client;
if (client.connect(server, 80)) {
client.print(“GET /emoncms/input/post.json?”);
if (node > 0) {
client.print(“node=”);
client.print(node);
}
client.print("&json={");
client.print(“InputVoltage1:”);
client.print(10.00);

If i try this
WiFiClient client;
if (client.connect(server, 80)) {
client.print(“GET /emoncms/input/post.json?”);
if (node > 0) {
client.print(“node=”);
client.print(node);
}
client.print("&json={");
client.print(“InputVoltage1:”);
client.print(10.00);
client.print(“BatteryVoltage1:”);
client.print(11.00);

No data on the localhost

emoncms.log
2021-02-07 12:23:46.560|ERROR|input_controller.php|{“success”: false, “message”: “Format error, json value is not numeric”} for User: 1

The error message is telling you what is wrong. It says the value is not a number. What it means is, it cannot see a number where it thinks there should be a number. Look very carefully at what you are really sending - not what you want to send.

What you are sending is
node=1&json={InputVoltage1:10.00BatteryVoltage1:11.00

Now can you see what is wrong? What should there be around the names and to separate the values?
Look at the Input API Help in your emonCMS to see what the JSON format should be - or even, look at the error message itself!

Thank you Robert, now it’s working :grinning:

client.print("&json={");
client.print(“InputVoltage1:”);
client.print(InputVoltage1);
client.print(",BatteryVoltage1:");
client.print(BatteryVoltage1);
client.print(",ChargingPower1:");
client.print(ChargingPower1);
client.print(",UnitTemperature1:");
client.print(UnitTemperature1);

1 Like

Hi, i want to load a few graphics for my dashboard onto the raspberry.
What is the easiest way to do this?

I have prepared a USB stick with the graphics. It is also recognized as / dev / sda1.
But I have no idea how to copy the files to the Raspberry.