Sensehat problems in getting entries!

Gheorghe Vasile on 6 May 2021
Latest activity Reply by Christopher Stapels on 11 May 2021

Hi!Yersterday i finally connected my rpi 3B+ with sensehat via Thingspeak.All worked just fine but today when i started the stream(run-prod.sh) number of entries appeared stuck on 0.I created a new channel but the problem still persist.If someone could help much obliged.P.S is a project for faculty.Any help would be helpfull.

Regards, Andrei.

Gheorghe Vasile
Gheorghe Vasile on 11 May 2021

So, what seem to be the problem then!?. To bad that i didnt exported the data when it still worked(streaming entries). Can we talk on social like skype, dicord, anything.I really need to get done my project this month. Please help!

Christopher Stapels
Christopher Stapels on 11 May 2021

I’m sorry, that’s not really a service we offer for free users. I haven’t used a sense hat. I would recommend trying to write without interfacing with the sensehat. There is an example in the ThingSpeak doc , but it’s a little out of date, I'm not sure it works in Python 3. (update coming soon). Anyone else on this forum have experience with the sense hat?

Christopher Stapels
Christopher Stapels on 6 May 2021

Are you able to update your channel in a web browser? Use the format https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=0 but fill in your write API key. If that works, but the pi still does not, then please share the part of the code on your pi that is updating ThingSpeak.

Gheorghe Vasile
Gheorghe Vasile on 7 May 2021 (Edited on 7 May 2021)

Yes!I am able to update entries through browser!In attachment i provided code of the project in src directory(.py files and 2 sh files).

Christopher Stapels
Christopher Stapels on 7 May 2021

Its good that you can update your channel, that means you must have the syntax correct for that part at least. We need you to share the parts of your code where you are connecting to ThingSpeak and sending the data, not the whole file. And what you are seeing in the code output when you run the file (please)

Gheorghe Vasile
Gheorghe Vasile on 7 May 2021

I see!Ok i will. import logging import logging.config import os.path

from flask import Flask from flask import render_template from apscheduler.schedulers.background import BackgroundScheduler from datastore import DataStore from sensehatwrapper import SenseHatWrapper

app = Flask(__name__) app.config.update( THINGSPEAK_WRITE_KEY="abcd1234", THINGSPEAK_CHANNEL='my_channel' ) app.config.from_envvar('WEATHERSTATION_SETTINGS', silent=True)

logger = logging.getLogger() datastore = DataStore(app.config['THINGSPEAK_CHANNEL'], app.config['THINGSPEAK_WRITE_KEY']) sensehat = SenseHatWrapper()

def setup(): # Set up logging logging.config.fileConfig(os.path.join(os.path.dirname(__file__), "logging.conf"))

setup()

def collect_data(): logger.debug('Running data collection') weatherdata = sensehat.get_weather_data() datastore.save_data(weatherdata)

def update_display(): logger.debug('Running display update') sensehat.write_data_to_display()

scheduler = BackgroundScheduler() scheduler.start() scheduler.add_job(collect_data, 'interval', minutes=1) scheduler.add_job(update_display, 'interval', minutes=1)

@app.route('/') def index(): logger.debug('Calling app root') weatherdata = sensehat.get_weather_data() return render_template('index.html', weatherdata=weatherdata)

Christopher Stapels
Christopher Stapels on 10 May 2021

I am not familiar with the sensehat library. Is it verified to work? Are you using their sample code?

Gheorghe Vasile
Gheorghe Vasile on 10 May 2021

Yes.But i was thinking maybe when i force shutdown the pi(unplugged) something happened.Or maybe i have a reatriction on entries number(how many entries could a student can have?)

Christopher Stapels
Christopher Stapels on 10 May 2021

Do you have a paid student license or are you using the free license? The total number of entries allowed is very large in either case, but the is a difference in how frequently you can update your channel.

Gheorghe Vasile
Gheorghe Vasile on 10 May 2021 (Edited on 10 May 2021)

A free license!So how often can i update my channel?

Christopher Stapels
Christopher Stapels on 11 May 2021

Free license holders can update a channel once every 15 seconds.

Gheorghe Vasile
Gheorghe Vasile on 11 May 2021

Ok.Can we speak/talk more details?How can i contact you?

Gheorghe Vasile
Gheorghe Vasile on 9 May 2021

Is ok?Am I missing something?

Gheorghe Vasile
Gheorghe Vasile on 6 May 2021

Ty for reply!I will try tomorrow and return with feedback.