Hi there,
I just started a personal project without any knowledge and know how to do it.
I discovered 3 days ago, the BalenaCloud Platform and created an account. I followed step by step the tutorial and successed to connect my new Raspberry Pi4 B model 4GB RAM with BalenaOS on it linked to the Cloud Platform. I made my first application with :
- BalenaOS
- Redis
- srly-ose-celery
- srly-ose-server
- srly-ose-viewer
- srly-ose-websocket
Everything works fine. I had some problems to fit the digital signage exactly with my HDMI FullHD cheap TVâs screen and it was hard to find how to change UTC time to get the right time in the Screenly browser alike (I used commands directly in srly-ose-viewerâs Terminal in the cloud interface).
sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/Europe/Paris/etc/localtime
My question is how to add tasks in Celery with Redis (I guess) linked to the worker (beat???) to get a kind of cron jobs to switch on/off the screen by HDMI CEC every night and in the morning.
I can switch off HDMI and put TV in Standby and wake it up by using commands in Terminal, it works fine but I donât have any idea how to make it automaticlly.
echo 'standby 0.0.0.0' | cec-client -s -d 1
echo 'on 0.0.0.0' | cec-client -s -d 1
The tasks could be :
0 6 * * * echo 'on 0.0.0.0' | cec-client -s -d 1 >/dev/null 2>&1
30 20 * * * echo 'standby 0.0.0.0' | cec-client -s -d 1 >/dev/null 2>&1
I made some research and I understand I have to put that kind of code somewhere, but I donât know how and where to do itâŚ
from celery.schedules import crontab
app.conf.beat_schedule = {
# Executes every day in the morning at 6:00 a.m.
'add-every-morning': {
'task': 'tasks.add',
'schedule': crontab(hour=6, minute=00, day_of_week=0-6),
'args': (16, 16), // <-- Don't know what it means!!!
},
}
from celery.schedules import crontab
app.conf.beat_schedule = {
# Executes every day at night at 8:30 p.m.
'add-every-night': {
'task': 'tasks.add',
'schedule': crontab(hour=20, minute=30, day_of_week=0-6), // 0=sunday
'args': (16, 16), // <-- Don't know what it means!!!
},
}
app.conf.timezone = 'UTC' // ???? Europe/Paris (yes, I'm French)
Thank you in advance for your kind help!!