I have to agree here. command_line does not seem to work at all for any command.
I have
#################################################################
## Notifiers
#################################################################
notify:
platform: command_line
command: "tts"
#################################################################
## Automations online status
#################################################################
- alias: "System Online"
trigger:
platform: state
entity_id: device_tracker.work_pc
from: 'not_home'
to: 'home'
action:
service: notify.notify
data:
message: "Uttering a really really really long sentence to test this to be really really really really working when my system comes online."
Now ofcourse like joekieffer mentioned…nothing.
When I open a shell and execute the command from the prompt. No problem.
When I do it via shell_command it works. That is how I have it for a while now.
#################################################################
## Automations online status
#################################################################
- alias: "System Online"
trigger:
platform: state
entity_id: device_tracker.work_pc
from: 'not_home'
to: 'home'
action:
service: shell_command.speak_sus
#################################################################
## Shell commands
#################################################################
shell_command:
speak_sus: tts "Uttering a really really really long sentence to test this to be really really really really working when my system comes online."
But I want it to work via command_line since that saves me from extra lines under shell_command. For me shell_command is not a solution merely a workaround.
See if the program is running the command. One thing that I didn’t put in my post is that I had to change pulse audio permissions on my server build to allow it to use the audio system under my user id. I am running Ubuntu 15.10 server and it might not be an issue with rasbian on the Pi but a similar OS architecture.
What I wonder is how does HA assemble the command line notification. If I am reading the git link above it looks like should be how it assembles and runs the command but alas I am not a skilled programmer.
16-04-28 18:16:10 homeassistant.components.automation: Executing System Offline
16-04-28 18:16:10 homeassistant.core: Bus:Handling <Event logbook_entry[L]: name=System offline, message=has been triggered, domain=automation>
16-04-28 18:16:10 homeassistant.core: Bus:Handling <Event call_service[L]: domain=notify, service_call_id=1979574928-20, service_data=message=Uttering a really really really long sentence to test this to be really really really really working when the system goes offline., service=notify>
1 root user is active and has current password
3. Root is permitted root login.
3. switch commands work
4. Running same commands sudo tts blah b lah blah on shell terminal works.
it looks like the command is not running or just running tts and exiting in a fraction of a second. What we need someone to comment/verify if using the notify service executes the command like you do in the command line. My bet is that it does not.
If I had to guess as to what is happening, again This is just a guess it executes tts with no options and then does something with that message data, maybe logbook or history had the message data in it.
To prove this you could add the message data in the command field and try triggering the notification. If you get audio then the issue has to be something with the way that notify sends commands.
I already tried adding the message data manually. It launches but no sound.
If you look at this again you see how message data is processed through automation scenario
16-04-28 18:16:10 homeassistant.core: Bus:Handling <Event call_service[L]: domain=notify, service_call_id=1979574928-20, service_data=message=Uttering a really really really long sentence to test this to be really really really really working when the system goes offline., service=notify>
What you are posting is the log message not exactly what python is doing to execute the command. Below is the code snip-its that are essentially calling tts. Looking at how this all assembles it looks like the tts command is opened and then data is sent to it. The shell command just makes a sub process.
stack over flow says you might need the newline char to get espak to work in the way that is defined maybe the same for tts? adding \n at the end of your message would be required.