This looks like a totally different issue now. Is the IP address of your fire TV still the same after reboot?
@rpitera I have some more logging in my repo. I suggest running a new folder with fire tv in a virtual environment and when installing firetv-server use this to pull my current version to see if that helps you diagnose the issue further.
pip install git+git://github.com/sytone/python-firetv.git
You can then use -v on the command line to enable verbose to see if that gives you anthing else.
Example:
firetv-server -v -c /home/pi/firetv.yaml
Yeah; both of them are still at the same IP. Both are still running and pingable.
Thatās a really nice offer; Iād like to try it out but I am in the midst of pre-beta testing for three other devs here so it may not be until later in the week.
I appreciate the help from the both of you; sorry if I hijacked the thread but I wasnāt getting any replies on my issue thread here or at the firetv repo.
Iāll update you as soon as I can and thanks again.
Have you tried manually starting the service with āsudo systemctl start firetv.serviceā?
I had this issue on mine after rebootās as it tried to start the service before network was fully set up and so failed but wouldnāt restart correctly.
Changed my firetv.service to the following to sort out failure recovery:
[Unit]
Description=Fire TV Server
After=network.target
[Service]
Type=simple
User=firetv
ExecStart=/srv/firetv/bin/firetv-server -c /home/homeassistant/.homeassistant/firetv.yaml
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
Can you post your firetv.service?
See my post above - it shows the output of doing just that.
[Unit]
Description=Fire TV Server
[Service]
ExecStart=/usr/local/bin/firetv-server -c /home/pi/firetv.yaml
Restart=on-abort
[Install]
WantedBy=multi-user.target
Youāve only posted the output from status. Which will be the status on boot as it didnāt reattempt to start the service on failure (on-abort restarts if thereās an error with the actual server install I believe?).
Change your restart setting to:
Restart=always
RestartSec=3
Then restart, and then check status again with:
sudo systemctl status firetv.service
Actually, that is the status after running it manually. Output from command line is shown just above:
I am not sure what the restart options are going to accomplish if a command line start fails; wouldnāt that just cause a restart loop? Iām hesitant to do this and have the Pi get locked up.
Let me know if you get a chance to run against my repo. I can add more debug logging if needed.
I think I may scrap the whole thing and start over using your repo when I do.
Turns out you can send commands pretty quickly thankfully. So now ive got a script to do typing for me if I ever need to type something. (āhey google type (text) on the tvā), works good! Pretty happy this was an option since the harmony hub wasnāt cutting it.
@stunts1337 Nice! Want to post an example so others can see it?
Super cool!
Sure⦠first I edited the firetv code to include alphanumeric keypresses but then the script is pretty simple:
#!/usr/bin/python
import requests, sys
from time import sleep
#alphanumeric key dictionary
keys = {"a":"key_a","b":"key_b","c":"key_c","d":"key_d","e":"key_e","f":"key_f","g":"key_g","h":"key_h","i":"key_i","j":"key_j","k":"key_k","l":"key_l","m":"key_m","n":"key_n",
"o":"key_o","p":"key_p","q":"key_q","r":"key_r","s":"key_s","t":"key_t","u":"key_u","v":"key_v","w":"key_w","x":"key_x","y":"key_y","z":"key_z"," ":"space",
"0":"key_0","1":"key_1","2":"key_2","3":"key_3","4":"key_4","5":"key_5","6":"key_6","7":"key_7","8":"key_8","9":"key_9"}
#vars
baseUrl = "http://192.168.1.12:5556/devices/action/default/"
textToType = sys.argv[1]
#send keypress for each char if it is alphanumeric and in the keys dictionary defined above
for c in textToType:
letter = c.lower()
if letter in keys:
requests.get(baseUrl + keys[c.lower()])
sleep(0.2)
Then in home assistant I have a script:
type_on_tv:
alias: Type text on fire tv
sequence:
- service: shell_command.type_on_firetv
data_template:
text: "{{ text }}"
and shell command:
type_on_firetv: "python3 -u /home/homeassistant/.homeassistant/python_scripts/typeOnFiretv.py '{{text}}'"
Lastly I use IFTTT to make the google assistant command that calls the rest api of home assistant to trigger the script and pass it the text field
doc: https://home-assistant.io/developers/rest_api/#post-apiservicesltdomainltservice
Admittedly it fails at times depending on what search box you are using and such⦠increasing the delay in the loop should be able to fix that so I may do that⦠or make it another argument for the script so its adjustable.