Julian in Discussions
최근 활동: 2024년 11월 18일

Hello, I am wondering why I have over 12000 messages (writes)per day to a channel which I only update all 8 fields every 20 minutes. Or are these statistic timely delayed? Since testing I might have more writes, but now with my ready weather station only every 20 minutes my data will be updated. Wetterbox Channel ID: 2391212 Access: Public Can you explain this to me? Thank you for your help. Regards, Julian Too many messages per day, free account If I read your channel, I see 71 messages from today, and 87 messages from yesterday. howMany=size(thingSpeakRead(2391212 ,"numdays",1, "outputformat","timetable"),1) howManyTwoDay=size(thingSpeakRead(2391212 ,"numdays",2, "outputformat","timetable"),1) howManyTwoDay-howMany=howManyYesterday The total number of messages in your channel right now is about 12,000. I read 8000 of them, the first date in the last 8000 readings is Feb 27 2024. By any chance, are you exporting the data in the channel, clearning your channel and re-importing the data into your channel? Once you update a channel, you use a message. Clearing the channel and reimporting the data just results in double the usage. If you do the clear & re-import "n" times, you are just using "n" times more messages. Thanks for this explanation. True during my testing phase I needed clear and upload data again. This makes sense. Good to know, i'll need to test messages channel update free account
Carsten in Discussions
최근 활동: 2023년 6월 6일

Hi all, I am so far on a free account. I have setup 1 channel. I am sending 3 values from a bitShake SmartMeterReader every 20 seconds to this channel. When trying to send additional data from my solar inverter every 5min! and calculate some data coming from my bitShake (e.g. once per hour) and send it back to the channel I receive the following error: Requests are too frequent. For further information, see Limitations in the documentation. Now I understand that my messages (write orperations) to my channel are limited to 3 Mio / year or 8200/day. With my current setup I am at little more than 4K messages per year and since I just recently started my account I have still 2.840.531 messages left. How come I get that error even if I switch even if my message limit is far from reached? Thanks in advance for your time! Much appreciated! Requests are too frequent. For further information, see Limitations in the documentation. Can you show a sample of the code where you are writing to ThingSpeak? You would not get the 429 error (requests too frequent) from overuse of messages, so I would guess that you may be sending messages faster than you think somehow. Hi, thank you for your response. The first code basically imitates the 2.8.0 (Einspeisung) of my solar power. I receive the value every 30 seconds. If it is negative I calculate the watt seconds (basically assume the value was constant fopr the last 30 seconds). After that I transform it into kWh and write it back to the channel once per hour via TimeControl. % Definieren Sie den gewünschten Zeitraum startDate = datetime('today'); % Startdatum endDate = datetime('now'); % Aktuelles Datum % Daten vom Stromverbrauch im gewünschten Zeitraum abrufen consumptionTotal = thingSpeakRead(stromzaehlerChannelID, 'ReadKey', readAPIKey, 'Fields', 2, 'DateRange', [startDate, endDate]); %disp(size(consumptionTotal)); % Rufen Sie die Funktion zur Berechnung des Energieverbrauchs auf energyConsumption = calculateEnergyConsumption(consumptionTotal); % Zeigen Sie das Ergebnis an disp(energyConsumption); thingSpeakWrite(writeChannelID,energyConsumption,'WriteKey',writeAPIKey, 'Fields', 6); function energyConsumption = calculateEnergyConsumption(data) timeInterval = 30; % Zeitintervall in Sekunden % Initialisierung der Summe totalEnergy = 0; % Durchlaufen der Datenpunkte for i = 1:length(data) %disp(['data:',data(i)]); if data(i) < 0 % Überprüfung auf Negativität energy = data(i) * timeInterval; % Berechnung der Energie in Wattsekunden totalEnergy = totalEnergy + energy; % Summierung der Energie %disp(totalEnergy); else %disp(int2str(data(i))); end end energyConsumption = totalEnergy / 7200000; % Umrechnung in Kilowattstunden end The second code is simply receiving data from my Solax Inverter. Also via TimeControl every 10 minutes api_url = 'https://www.solaxcloud.com/proxyApp/proxy/api/getRealtimeInfo.do?tokenId=XXXXXXXXXXXXXX&sn=XXXXXXXXXX'; api_call = webread(api_url) writeChID = 1234567; writeAPIKey = 'XXXXXXXXXXX'; res = struct(api_call.result) acpower = res.acpower yieldtoday = res.yieldtoday getData = thingSpeakWrite(writeChID, [acpower,yieldtoday],'Fields',[4,5],'writeKey',writeAPIKey); *sorry for the DE comments Thats a good start, but the code you have shown has no delay or timing information in it, so I am unable to estimate how often the writes are happening. You do mention that you are writing back to the same channel, that may possibly be a source of overwriting. I suggest using a seperate channel for the derived information. Can you show how you determine when (or how often) to write to thingspeak? Hi @Christopher Stapels, as mentioned I am using the "TimeControl" function ("Every 10 Min" & "Every 1 hour(s)). I already played aroundn with these settings but no improvement. I am new to MATLAB so I was under the impression that this is some kind of scheduler to run the script and it is being written to the channel once per script run? I would encourage you to use more descriptive names for your TimeControls. It is clear you are running the TimeControl every 10 minutes, but I think the code you wrote may be writing to a ThngSpeak channel more than once very time it is run. That could lead to the error you are seeing. Perhaps you could share the full text of the code that you selected to be run by the TimeControl? (feel free to redact api keys and channel id's) That is the full code...First one runs every hour, second one every 10 minutes.... Will name more descriptive though :-) First script only misses the channel definitions % ThingSpeak Channel-ID für den Stromverbrauch stromzaehlerChannelID = 1234567; % Ersetzen Sie dies mit Ihrer tatsächlichen Channel-ID für den Stromverbrauch % ThingSpeak Authentifizierungsschlüssel readAPIKey = 'XXXXXXXXXX'; % Ersetzen Sie dies mit Ihrem tatsächlichen Lese-API-Schlüssel writeAPIKey = 'XXXXXXXXX'; writeChannelID = 123456789; Here is my usage so far.. So both scripts have writes to channel in them. One runs every hour. When it runs, the 10 minute code is also run. Our servers are very fast, so they are running both scripts within 15 seconds, thus you are writing to the same channel twice in under 15 seconds. This is not allowed with a free license. Thus the "requests are too frequent" error message. Things you can do to fix it: Change the second time (60 minutes) to a prime number. Use two different channels to write to (or more ) Change the run time to "fuzzy" Which will work most of the time but may still randomly overlap and cause the error occasionally. other, more complicated fixes @Christopher Stapels Thanks a lot. I have now changed (combination of 1 & 3). Now when you say it it makes total sense that it is highly possible that the three write operations will conflict each other when only one write operation is allowed every 15 seconds. Will observe it not and see if it improved. Thanks again! limitations free messages
Gabriel in MATLAB Answers
최근 활동: 2022년 11월 7일

When uploading 3 fields using multifield update (writeFields) is that counted as one message or 3? I'm asking regarding the 8,200 messages/day. Thanks.

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.