CRG in Discussions
上次活动时间: 2024-9-30

Hi everyone, I'm working on a school project where I need to send sensor data from my Arduino to a Power BI REST API using ThingsHTTP. I've been trying to get this to work, but I'm running into errors like this: {"error":{"code":"InvalidRequest","message":"Error parsing request for dataset sobe_wowvirtualserver|a7b68fb5-533b-471f-a5da-3bdd6746ee16: Conversion error on column '<pi>pH</pi>': <pi>Input string was not in a correct format.</pi>"}} I'm a beginner with this, and I'm not sure what I'm doing wrong. What steps should I take to resolve this issue? Also, does anyone know the correct format for an HTTP request body when sending dynamic sensor data? This is the body format I'm trying to send to Power BI: [ { "pH": 98.6, "TDS": 98.6, "turbidity": 98.6, "temperature": 98.6 } ] Any advice on how to construct the HTTP body with values that change over time would be greatly appreciated! Thanks in advance!" Need Help with School Project: Sending Data from ThingsHTTP to Power BI REST API I suggest using webwrite and webread to send data to an external API. Instead of using thingHTTP, I suggest using MATLAB code that is triggered by a write to a channel (use react) or runs on a regular schedule (use time control.) You can build the POST request body or querry string parameters using variables to be able to send dynamic data. If you start on that route, feel free to describe how it does here and we will try to help futher. Make sure to show a code sample. power bi api thingshttp
Chris Nas in MATLAB Answers
上次活动时间: 2024-4-19

Hey, I am currently programming something in ArduinoIDE for an ESP8266 to read my sensor data that is already uploaded to TS. For this, I use the function: ThingSpeak.readMultipleFields(CHANNELID,READKEY). Unfortunately, I found that the server no longer returns the correct data. Here some debug Log from the Arduino library right after caling ThingSpeak.readMultipleFields(CHANNELID,READKEY): ts::readRaw (channelNumber: 13xxxxx readAPIKey: H89OOxxYFXxxxxxx suffixURL: "/feeds/last.txt?status=true&location=true") Connect to default ThingSpeak: api.thingspeak.com:80...Success. GET "/channels/13xxxxx/feeds/last.txt?status=true&location=true" Got Status of 200 Content Length: 210 Found end of header Response: "{"created_at":"2021-04-06T20:25:06Z","entry_id":5,"field1":null,"field2":null,"field3":null,"field4":null,"field5":"27.82000","field6":"28.96680","latitude":null,"longitude":null,"elevation":null,"status":null}" Read: "{"created_at":"2021-04-06T20:25:06Z","entry_id":5,"field1":null,"field2":null,"field3":null,"field4":null,"field5":"27.82000","field6":"28.96680","latitude":null,"longitude":null,"elevation":null,"status":null}" disconnected. As you can see, field 4 returns "null". When reading the same Channel and field with the function: ThingSpeak.readFloatField(CHANNELID,FIELD ID,READKEY) I get: ts::readStringField(channelNumber: 13xxxxx readAPIKey: H89OOxxYFXxxxxxx field: 4) ts::readRaw (channelNumber: 13xxxxx readAPIKey: H89OOxxYFXxxxxxx suffixURL: "/fields/4/last") Connect to default ThingSpeak: api.thingspeak.com:80...Success. GET "/channels/13xxxxx/fields/4/last" Got Status of 200 Content Length: 8 Found end of header Response: "29.94141" Read: "29.94141" disconnected. And this is the right value. Im using the latest Version from TS arduino Library. I already opend an issue on Github but there is no reaction on it. https://github.com/mathworks/thingspeak-arduino/issues/80 Does anyone have any ideas? Greetings!
Perky Whale in MATLAB Answers
上次活动时间: 2023-11-28

I have a few ESP8266 running various sensor tasks, and sending GET or POST requests to Thingspeak via api.thingspeak.com. They all connect to the household router. Recently, I became aware of a problem with the devices occasionally timing out when trying to communicate with Thingspeak. For example, here's a bit of code from a basic water level sensor: String url = "http://api.thingspeak.com/update?api_key=xxxxxxxxxxxxx&field1="; url += getdistance(); url += "&field8="; url += batt; http.begin(client, url); int httpcode = http.GET(); Serial.println(httpcode); String payload = http.getString(); Serial.println(payload); http.end(); Fairly often, the connection will fail with a -1 httpcode. Sometimes it will run for weeks with no issues and then suddenly stop connecting. If I type the URL in a browser, it will always work immediately. If I connect the ESP to a mobile hotspot, it will also connect immediately with no issues. I can't find any issues at all with the router, and I've fully reset it etc. I've also confirmed the wifi connection between ESP and router is not the problem. Sometimes one ESP will be running fine, and another will be having connection issues. The next day, the first one will have issues and the other will be fine. So I added a bit of code to see if I could time the connection: server = "api.thingspeak.com" timer= millis(); while(client.connect(server,80)){ delay(10)} t=millis()-timer; Serial.print(t); The devices now connect every time. But the connection can take up to 180 seconds. Some ESP's updating to older channels are much more reliable and connect within a second or two; it seems as though the more recently created channels take longer to connect to. I'm reaching out here because I can't really think of where to begin trying to fix this. Why does a browser succeed immediately updating a channel with the api.thingspeak url but the ESP takes up to 180 seconds? Why do I not have any problems connecting the ESP via a mobile hotspot? Why does the same device work for weeks then suddenly play up? I think I've isolated the problem to either the router or the thingspeak api, and I can't find anything wrong with the router. Might be worth noting that I have an ESP in a heat pump which updates every 15 seconds to thingspeak by MQTT and it hasn't skipped a beat in months so maybe I should upgrade them all to MQTT. Is the api just that flakey?
Thomas in Discussions
上次活动时间: 2023-3-14

Hello people, I made a program to read a dataset from JSON and make an API request to Thingspeak (bulk_write). After the transmission I display the response of the request, which is 202 (compliant data). My data updates fine on my Thingspeak channel but the longitude and latitude fields do not change. Do you have any explanation for this problem? Here is the code: Localisation not updated through bulk_write API The latitude and longitude for the channel (i.e. channel home location) are set using the write settings endpoint, using the user API key. For bulk update, you will change the feed parameters (each point). Use the read API endpoint with location=true to see position information. I don't use the read API endpoint, but I look the channel location on the website. I just remark that the values "longitude", "latitude" and "elevation" are not updated. But all the fields are updated. Bulk update does not change the channel location. The channel feed is updated from any updates. Channle location is a reletively static location. I like to think of the channel location as home base for a plane. The channel location is the home base, airport, hangar station, etc. The feed contains the present location of the device, airplane, helicopter drone. Or say you put a GPS on your bike. The garage would be the channel location and the feed parameters would tell you where your bike is at any given moment. Here you can see a discussion about how to make a map of location points from your channel Okay, I get the idea. I'll do the necessary. Thanks for the quick answers ! coordinates api
Mario Guthrie in MATLAB Answers
上次活动时间: 2023-2-12

Is bulk update API broken? Was working , day later not working... Tried using bulk update and get {"status":"401","error":{"error_code":"error_auth_required","message":"Authorization Required","details":"Please provide proper authentication details."} tried a POST to http://api.thingspeak.com/channels/1191021/bulk_update.json with this payload: { "write_api_key": "WRITE_API_KEY", "updates": [{ "created_at": "2018-01-30 10:26:2 -0500", "field1": "1.0", "field2": "2.0" }, { "created_at": "2018-02-02 11:27:27 -0500", "field1": "1.1", "field2": "2.2", "status": "well done" } ] } And I get {"status":"401","error":{"error_code":"error_auth_required","message":"Authorization Required","details":"Please provide proper authentication details."} Already tried new channel new key validated key
Derek Huether in MATLAB Answers
上次活动时间: 2022-6-20

Did a project that uses an ESP8266 and WS2812B, using ThingHTTP to pull MarketWatch data to display live stock symbols, trending prices, and trending percentages. Overall, everything works. I then discovered that during trading hours (09:30-16:00), all of the data displays on both the LED matrix and serial monitor as jumbled characters. Am I missing some neccessary and obvious line of code that allows me to pull live data curing market hours? Any direction is appreciated. Rather than including the ino code here, I'll just point to my public Github repo. https://github.com/derekhuether/stockticker Thank you in advance!
Lorenzo Scavarda in Discussions
上次活动时间: 2022-6-8

Good morning, I'm working with an Arduino MKR 1010 which takes information about weather from the website "api.openweathermap.org". On a ThingSpeak dashboard I displayed the main numbers (float) information like: temperature, wind speed, humidity, etc. Moreover, from the openweathermap I can also get string sentence (e.g. "light rain" or "broken clouds" etc.). I'm wondering if there is a way to display on the ThingSpeak dashboard string fields. Indeed, in the ThingSpeak Channel Settings I added an extra Field in order to store these string words but I don't know how to print them in the dashboard. Someone can help me? Thanks in advance, Lorenzo Display message on ThingSpeak Are you trying to display the text on your ThingSpeak channel? If so, you can use a MATLAB visualization, and use the text or annotate functions to put the text on a figure. Then add the visualization to your channel. When I've done this, i occasionally have to experiment with scaling the figure and text, but with a little work, you can definitely get what you want. Maybe you can use the Status field of the channel to display the text? Thanks Christopher for the answer. Yes, I though it but I have a doubt: what is the right function to retrieve the string (that I want to display) and put it in the annotate function? Because my problem is that the String is one of the Fields of my Channel. For example I found: data = thingSpeakRead(readChannelID,'Fields',field_number,NumPoints=3) but I don't how to handle a string variable. Is it enough use: data = thingSpeakRead(readChannelID,'Fields',field_number) Do you have some hints? Thanks a lot in advance, Cheers, Lorenzo Hi Vinod, yes, I'm using the Status Field indeed. However, it is not the best way because the layout and format of the text is very fixed, for example I can't use the "new line" but the text is in just one line. If I want to display a sort of weather report for the next hours of the day (i.e. not just one word but several sentences) is not very suitable. Either option you show above will work fine. dashboard string arduino api field
pravin vaz in Discussions
上次活动时间: 2022-5-31

Hi all, I am trying to create a complete learning unit online using laravel. The unit of work is in Internet of Things. Hardware will be provided to students - Its a microbit plus the DFRobot Environment science expansion kit (https://www.dfrobot.com/product-2194.html) . All the video tutorials and project work is assigned via the laravel lms.They will log into the lms via their microsoft logins. My next step is to simplify the process of users accessing the mathworks account. I would like to pre assign channels for students with API keys to write sensor values from each of their microbit shields to the cloud. Has anyone tried to do this or has any suggestions how to? The advantages of students having their own channels on my account is for me to monitor how they are progressing. These are year 9 students at high school who have never done any IoT or mathworks/thingspeak related content before. User generation for channels for IoT Shield You can use the create channel API to create new channels for your students. The response to the request has the API kiy and channel ID in it. microbit dfrobot iot sensors api laravel lms
Vlad Breaban in Discussions
上次活动时间: 2022-4-29

Hello, I need an endpoint to retrive my file with data from my channel. Do you think is this possible? Notice that i do not want to press export data button, i want an endpoint to use in a personal project. Thank you. API to retrive file which contains data from my channel Found the answer here: https://www.mathworks.com/help/thingspeak/read-data-from-channel.html api data. file download
Oguzhan Memis in MATLAB Answers
上次活动时间: 2022-2-17

Hi , I am trying to design a "website, which can run Matlab codes automatically " , to obtain processed IoT sensor data & graphs. I realized ThinkSpeak as a useful tool , but our custom design is needed for our system. When I made a quick surf on the internet & communities , I can not find exact same thing as embedding the matlab code, but integrating - visualizing matlab codes & outputs and graphs to the website. This is not the same thing as functions of ThinkSpeak. For "remote" acces, the API informations and automatic Matlab script outputs ( graphs etc. ) are need to be obtained, inside of the cloud-server. the ultimate question is : how to embed Matlab in a website, to run it automatically ? ( similar questions and answers are almost checked )
Lalit Jetwani in MATLAB Answers
上次活动时间: 2022-1-2

I cannot find the ThingSpeak MQTT API under the My Profile option. Also, I cannot access the ThingSpeak MQTT broker's server address.
Gcobani Mkontwana in MATLAB Answers
上次活动时间: 2021-8-19

Hi Team I have this Ajax call request, it seem it does not working on my button to download date range, Strange part when i access this URL directly from the browser it can download this file format as CVS file on my local computer, Any idea as to why am i not able to get this write? Kindly please help, thanks. https://nl.mathworks.com/help/thingspeak/readdata.html $(document).ready(function() { $("#download").click(function() { $.ajax({ url:'https://www.thingspeak.com/channels/899906/feeds.csv?api_key=F**&results=3', type:'POST', dataType:'json', success:function(response){ window.location = response; } }); }); });
andy neo in Discussions
上次活动时间: 2021-5-5

Hi, currently I am working on a dashboard that uses Thingspeak and Mendix. I am using a GaugeChart in Mendix and it receives data from Thingspeak. However, I have to refresh the page manually to see the new sensor values. One of my answers I got is that it is the Thingspeak that is not sending the data properly. Long story short, he said that I have to expose API from Mendix which will produce a URL link (similar to Thingspeak API URL link) and in Thingspeak, I have to put that URL into Thingspeak. I have been looking around in Thingspeak and the closest thing that allows me to put an external URL is at ThingHTTP. However, we did not make use of ThingHTTP when communicating with our hardware and for Mendix, I only use Call rest API to receive data. Please help! Is it possible to send data to an API URL? You can use the webread() function in MATLAB analysis in ThingSpeak to make web requests. You can use TimeControl and React to call your MATLAB analysis automatically. api sending data
Robert Mollik in MATLAB Answers
上次活动时间: 2021-1-1

Hi, when I request the average data of a feed using the api call, I sometimes get unplausible values. My channel contains one field for special purpose, that is being updated asynchronously. It seems like, when that field contains data (while the others contain NULL), the average calculation is messed up. I believe that the average calculation interprets NULL as 0. Is this a bug or a feature? Thanks, Robert
BRIAN MINOR in MATLAB Answers
上次活动时间: 2020-11-11

I'm thinking about adding a second channel, but I'd like both to receive data as often as I'm allowed to send it. I'm worried that if I program both devices to send data every 15 seconds, only one channel will receive data while the other will keep trying while the site is unavailable. I'm wondering if there's a way to check whether or not ThingSpeak is ready to receive data so that I can program my timers to start after receiving that confirmation. Thanks!
Mikhail Mikhailichenko in MATLAB Answers
上次活动时间: 2020-2-1

Hello folks, I'm using ThingSpeak MQTT API and now am struggling with MQTT connection keep alive time. I can't find in the docs what keep alive time is recommend by ThingSpeak. Also I'm interesting in what value of keep alive time is the best for you? Thanks in advance.
Benjamin Cortez in MATLAB Answers
上次活动时间: 2020-1-28

I explain, under an alternative internet, I can send information without any problem from the Arduino to ThingSpeak, but when I connect to the network of my work (Ministry of Housing and Urbanization of Chile), it fails to send the applications, or I think it sends them but it is not able to receive answers .. In some occasions it does not solve the DNS, or in others, it resolves them, but it throws error 401 Unauthorized. So, I need to know what exactly the problem is, in order to send a ticket to those who are responsible for modifying the network here. To be more exact, I use an ENC28J60 module I would appreciate any help, if more information is missing just ask me, thank you and have a good day.
Gcobani Mkontwana in MATLAB Answers
上次活动时间: 2019-11-12

Hi Team I am testing my ajax URL to download cvs file using GET method, these are my paremeters channel for my plugin. GET https://api.thingspeak.com/channels/899906/feeds.csv?start=2019-11-11%2019:11:11&end=2019-11-08%2019:11:11 How do i resolve this issue? I need some help, thanks. $(document).ready(function() { $("#download").click(function() { $.ajax({ url:'https://api.thingspeak.com/channels/899906/feeds.csv?start=2019-11-11%2019:11:11&end=2019-11-11%2019:11:11', type:'GET', success:function(response){ window.location = response; } }); }); });
Gcobani Mkontwana in MATLAB Answers
上次活动时间: 2019-11-6

Hi Team Is there any mate who can show me in Ajax, if there is better approach to read values in your ajax call request? That will read these values as they are passed on your parameter. What i want to achieve is similar to an example of light bulb, if the bulb is set true is on. If the bulb is set false is off. Now i want something similar to my below code logic for my current channel. Currently the buttons only accept these moment they are fired from the browser, i want a better approach and scale my application better. <div class="col-md-2 text-center"> <button id="singlebutton" name="singlebutton" class="btn btn-primary">Subscribe</button> <br> </div> <!------ ----> <br/> <div class = "col-md-2 text-center"> <button id = "singlebtn" name="singlebtn" class="btn btn-primary">Unsubscribe</button> <br> </div> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function(){ $.ajax({ url:'https://api.thingspeak.com/update?api_key=***&field8=0', type:'GET', data:{ format:'text' }, success:function(response){ alert(response); }, error:function() { $('#error').text("There was an error processing your request.Please try again"); $('#singlebutton').append(data); } }); // second button for unsubscribe. $(document).ready(function(){ $.ajax({ url:'https://api.thingspeak.com/update?api_key=***&field8=1', type:'GET', data:{ format:'text' }, success:function(response){ alert(response); }, error:function(){ $('#error').text("There was an error processing your request.Please try again"); $('#singlebtn').append(data); } }); }); }); </script>
Gcobani Mkontwana in MATLAB Answers
上次活动时间: 2019-11-4

I have a html code for my button together with javascript, i want to know how do i implement this with my javascript using talkback api key? Javascript code; <script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script> <script type="text/javascript"> $(document).ready(function(){ $("#boot .btn").click(function(){ $(this).button('Talk-Back'); }); $.post('https://api.thingspeak.com/talkbacks/35730/commands.json?apikey=JJHHMMITZ2TAK9PU&command_string=TalkBack Command&position=2'); }); </script> HTML code; <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"><br/> <div class="col-md-4 text-center"> <button id="singlebutton" name="singlebutton" class="btn btn-primary">Talk-Back</button> </div> </body> Do i need to write C++ device application? I am still new to this environment as to say, i am more experienced in Azure, please help me.
Oliver Woodford in MATLAB Answers
上次活动时间: 2019-2-8

Some REST APIs, such as <https://developers.google.com/analytics/devguides/reporting/core/v3/gdataAuthorization Google Analytics' Core Reporting API>, require authorization tokens, which must be obtained before the required data can be downloaded. Can anyone share or point to code on how to do this in MATLAB? In particular I'm looking to use an App in the MATLAB-based ThingSpeak service to automatically download the number of unique visitors to my website from Google Analytics (behind an authentication firewall) daily, and save that information to a ThingSpeak channel.
MathWorks Support Team in MATLAB Answers
上次活动时间: 2018-1-2

What ports need to be opened in a firewall in order to communicate with the ThingSpeak server? kA00Z000000oUUDSA2 000093410

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.