Henning Posted November 7 Posted November 7 (edited) Good day everyone, I would like to send data of a 3em device to thingspeak by scripting. This is my actual script: Timer.set(30000, true, function () { Shelly.call("EM.GetStatus", { id: 0 }, function (result) { let total_act_power = result.total_act_power; let a_act_power = result.a_act_power; let b_act_power = result.b_act_power; let c_act_power = result.c_act_power; let total_energy = result.total_apparent_power; Shelly.call( "HTTP.GET", { "url": "https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXXXX&field1=" + a_act_power+ "&field2=" + b_act_power+ "&field3=" + c_act_power+ "&field4=" + total_act_power + "&field5=" + total_energy, } ); }); }); it works well and the channel data at thingspeak is being updated every 30 seconds. But unfortunately only regarding the values measured for a_act_power, b_act_power and c_act_power. As scripted I would like also the total energy measured in kWh. There are no values coming for total_apparent_power. I also tried total_energy, but ist does not seem to be a valid variable with value. does anyone know the problem here? Thank you. Edited November 7 by Henning Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish
If_then_else Posted November 7 Posted November 7 (edited) removed because of misunderstanding Edited November 7 by If_then_else Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish
If_then_else Posted November 7 Posted November 7 1 hour ago, Henning said: I would like to send data of a 3em device to thingspeak by scripting. Where does this script run? The 3EM did't support scripts so I assume you have a PRO 3EM. Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish
If_then_else Posted November 7 Posted November 7 I've added 3 lines to the beginning of the script. It should work now. Please see the link below. [EM vs EMData/EM1Data] https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPro3EM Timer.set(30000, true, function () { /////////////////////////////////////////////////////////////////////////////////////////////////// let total_energy; Shelly.call("EMData.GetStatus", { id: 0 }, function (result) { total_energy = result.total_act; }); /////////////////////////////////////////////////////////////////////////////////////////////////// Shelly.call("EM.GetStatus", { id: 0 }, function (result) { let total_act_power = result.total_act_power; let a_act_power = result.a_act_power; let b_act_power = result.b_act_power; let c_act_power = result.c_act_power; Shelly.call( "HTTP.GET", { "url": "https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXXXX&field1=" + a_act_power+ "&field2=" + b_act_power+ "&field3=" + c_act_power+ "&field4=" + total_act_power + "&field5=" + total_energy, } ); }); }); Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish
Henning Posted November 7 Author Posted November 7 Yes, sorry, of course its the pro. thank you very much for your help. EMdata was the hint i was missing. I put your added lines into my script. The value is now there and everything works! thank you very much!!! 1 Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.