[SOLVED] Entertainment center automation?

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
drksam
Level 1
Level 1
Posts: 8
Joined: Sun Jan 25, 2015 9:01 pm

[SOLVED] Entertainment center automation?

Post by drksam » Wed Jan 17, 2018 1:10 pm

Hi everyone. I am playing with an idea to make a piece of hardware (probably an arduino based thing) that will be connected to a pc running mint and will turn on and off entertainment center parts such as amps so that I don't get a pop out of the speakers when the computer comes on and off.

I know quite a bit about arduino and have already made a sketch that turns a pin on or off from a serial H or L. This works great for controlling the hardware and I can get it to work using echo -e -n 'H' > /dev/tty/USB or echo -e -n 'L' > /dev/tty/USB0. I wrote a little script and set it as executable and it works fine.

So now all I should have to do is get the computer to run the script right after boot up and right before shutdown. I have looked around and found some info about setting this up using rc0.d and rc6.d as well as a method using systemd. I have tried both methods (only for shutdown) but have had no luck getting it to send the command.

So my questions are
1. Is it that by the time my script is running the serial is already disabled?
2. Anyone have any other ideas to do the same thing?

Thanks for any help
Last edited by drksam on Sat Jan 20, 2018 5:55 pm, edited 1 time in total.

User avatar
AndyMH
Level 4
Level 4
Posts: 486
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Entertainment center automation?

Post by AndyMH » Wed Jan 17, 2018 6:13 pm

I had something similar in that I wanted to run a script (to do a backup) on shutdown, googled how to do it and in the end decided not to mess with systemd - think it could be quite easy to bork your system. It would also appear that you can't control the order in which the processes (or your script) shut down. In my case, my backup drive may be unmounted before my backup script runs.

In the end, I changed my backup script to shut down the system on completion and added it to the menu - much simpler. Want to run something on startup - add it to 'startup applications', but again, I've no idea in what order the processes start up.
Thinkpad T430 i7-3632 Cinnamon 18.3, Thinkpad T420 Cinnamon 18.3, Thinkpad T410 Cinnamon 17.3, Thinkpad T60 19.0 Mate

drksam
Level 1
Level 1
Posts: 8
Joined: Sun Jan 25, 2015 9:01 pm

Re: Entertainment center automation?

Post by drksam » Fri Jan 19, 2018 9:38 am

Thanks for the reply.

I have done some more messing with it and I am satisfied that it should be possible so I've set up a test computer that I'm not worried about messing up. I have played with systemd a little and kinda understand what's going on but am unsure of where to insert my script to make it send the echo before everything else starts to shutdown. Also I'm not sure if my script is correctly formated to be used by systemd, it does work fine if I click it but is that good enough?

drksam
Level 1
Level 1
Posts: 8
Joined: Sun Jan 25, 2015 9:01 pm

Re: Entertainment center automation?

Post by drksam » Sat Jan 20, 2018 4:04 pm

Ok so i figured it out. I did use systemd and bash scripts to control an arduino uno. The current setup is working great so I thought I would post my files here. Maybe they will help someone.
Attachments
EntAuto.tar.gz
(5.04 KiB) Downloaded 43 times

Post Reply

Return to “Software & Applications”