Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Idea: Use rpi LEDs as status LEDs for moOde itself
#21
(04-30-2020, 10:07 PM)Tim Curtis Wrote: I was initially thinking of doing the logic in the while loop as a checkSources() function but your approach should work just fine :-)

No need to put it in the loop since there's the systemd timer unit, that's it ?
Reply
#22
Maybe not but I haven't worked out how the two different use cases for the LED's are going to work. The script and systemd units as-is default to using the LED's as status for the mounts. The mount check and auto-remount are generally applicable but the use of the LED's is up to the user.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#23
(04-30-2020, 10:26 PM)Tim Curtis Wrote: Maybe not but I haven't worked out how the two different use cases for the LED's are going to work. The script and systemd units as-is default to using the LED's as status for the mounts. The mount check and auto-remount are generally applicable but the use of the LED's is up to the user.
Tim, in one of the previous posts I had proposed the following stuff, is it too complicated to enforce or even unfeasible in your opinion ?

a 'LED Operation' dropdown list with two options: 
- On/Off (default)
- Mount Status

with the LED0/LED1 toggle switches available just below if user chooses the On/Off option (default)

If the user chooses the Mount Status option then the LED0/LED1 toggle switches below the dropdown list could become hidden or greyed out, the LEDs would be disabled by worker.php and the systemd service and timer units would be started from worker.php. 
Reply
#24
That would prolly work. I just need to get hands on with the code. Sometimes what looks good on paper doesn't work out in practice.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#25
(05-01-2020, 01:06 AM)Tim Curtis Wrote: That would prolly work. I just need to get hands on with the code. Sometimes what looks good on paper doesn't work out in practice.
Tim, 
now that I have taken a quick look at the code I understand better what you say and realize that it involves more things than what I thought at the beginning. 
Without any pretention to obtain a convincing result (I'm not a professionnal developer) and with your agreement of course, I would gladly fiddle with the code to do some local tests ; could you tell me if there are other files than sys-config.php, sys-config.html and worker.php that I should look at for that purpose please ?
Thanks a lot for your time
Reply
#26
Those files plus you may need to add a row to cfg_system to store the setting.

Heres the row for the current LED state seting
Code:
pi@rp3:~ $ sqlite3 /var/local/www/db/moode-sqlite3.db "SELECT * FROM cfg_system WHERE param='led_state'"
130|led_state|1,1

if you need to add a new row then run the command below substituting for new_param_name and default_value.
Code:
sqlite3 /var/local/www/db/moode-sqlite3.db "INSERT INTO cfg_system VALUES (138, 'new_param_name', 'default_value')"
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#27
(05-01-2020, 01:50 PM)Tim Curtis Wrote: Those files plus you may need to add a row to cfg_system to store the setting.

Heres the row for the current LED state seting
Code:
pi@rp3:~ $ sqlite3 /var/local/www/db/moode-sqlite3.db "SELECT * FROM cfg_system WHERE param='led_state'"
130|led_state|1,1

if you need to add a new row then run the command below substituting for new_param_name and default_value.
Code:
sqlite3 /var/local/www/db/moode-sqlite3.db "INSERT INTO cfg_system VALUES (138, 'new_param_name', 'default_value')"
many thanks, I'll see if I can do something
Reply
#28
(05-01-2020, 01:53 PM)romain Wrote:
(05-01-2020, 01:50 PM)Tim Curtis Wrote: Those files plus you may need to add a row to cfg_system to store the setting.

Heres the row for the current LED state seting
Code:
pi@rp3:~ $ sqlite3 /var/local/www/db/moode-sqlite3.db "SELECT * FROM cfg_system WHERE param='led_state'"
130|led_state|1,1

if you need to add a new row then run the command below substituting for new_param_name and default_value.
Code:
sqlite3 /var/local/www/db/moode-sqlite3.db "INSERT INTO cfg_system VALUES (138, 'new_param_name', 'default_value')"
many thanks, I'll see if I can do something

Hello Tim,

sorry for the late reply, I haven't had the time to work on this until today.

I've finished adding the mount status feature to the moOde interface and it works.

The new parameter name is "mount_status", possible values are 0 (disabled, by default) or 1 (enabled).

If you enable the mount status feature, LED0 and LED1 toggle buttons are hidden. If you disable the mount status feature, LED0 and LED1 toggle buttons are displayed again and original LEDs configuration is restored.

Do you want me to send you the 3 modified files (worker.php, sys-config.php and sys-config.html) ?
Reply
#29
Its on the TODO list to investigate but not getting priority ATM.

I did upload the script to the moode repo and at some point I'll check it out. At first glance I think the value is more in verifying that mounts are good rather than how its reported. It could be by LED's, notifications in the UI and/or entries in Moode log.

UI notifications are more universal and cover the scenarios where user has Pi in a closet or a case or somewhere where LED's are not visible.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#30
Hello Tim, 

I understand that it needs to be improved to cover different use cases. I've still attached my work if you want to figure out how it works on a fresh moOde 6.5.2 install.

It doesn't take more than 5 minutes to set up, README file is included.


Attached Files
.zip   mountstatus.zip (Size: 28.86 KB / Downloads: 2)
Reply


Forum Jump: