This is almost impossible, but just in case I suggest to split up you automation.yaml This makes it much easier to debug without beaking excisting and working automations. Take a look here for details
I think you’re trying too many things at once, just take it step by step. You have input slider errors but for what I can see it is not caused by the input slider for switching off the bathroom lights. Probably switching off your bathroom lights is not working due to other input slider problems. So remove them, check if the bathroom light problem is fixed. If it’s not fixed try debugging this first before adding or changing other automations.
maybe check your bathroom_off scenes as well (try to activate them manually using dev-services). The error is maybe there.
As suggested by @sjee, I would also recommand proceeding step by step and fixing one bug at a time before trying to include new potential breaks (like template delays). Otherwise it would be difficult to know if the error was there before or it is something that you introduced later.
Thanks, splitting up the automations helped me find out the issue with the bathroom lights. It was a remnant from a copy paste job causing that problem. It’s strange that I never got an error when it was part of the automations.yaml but as it’s own the error was picked up.
Now the only things I can’t figure out how to get working are:
- My iHeartRadio automation works sometimes and doesn’t other times. There doesn’t seem to be any rhyme or reason.
- The automations that are supposed to dim or turn off the lights when media player (Fire TV) is playing hasn’t worked in weeks. I copied the exact code from the website and I’ve tried light.turn_on and scene.turn_on with no luck.
I have no errors in the log. What else can I try for these? Or anyone have working code I can try to see if it would work with my setup?
# Shut off the music at 7:20AM
- alias: 'Shut off bathroom chromecast each morning'
initial_state: 'on'
hide_entity: false
trigger:
- platform: time
at: '18:18:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- service: media_player.turn_off
entity_id: media_player.all_devices_group
#####################
# MORNING ROUTINE
#####################
# Start iHeartRadio in the morning
- alias: 'Turns on the chromecast and plays iHeartRadio in the bathroom each morning'
initial_state: 'on'
hide_entity: false
trigger:
- platform: time
at: '18:17:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- service: media_player.play_media
entity_id: media_player.all_devices_group
data:
media_content_id: http://kbpi-fm.akacast.akamaistream.net/7/535/19810/v1/auth.akacast.akamaistream.net/kbpi-fm
media_content_type: audio/mp3
####################
# MEDIA PLAYING
####################
# Fire TV Paused
- alias: 'Media player paused/stopped'
trigger:
- platform: state
entity_id: media_player.fire_tv
from: 'playing'
to: 'idle'
# condition:
# - condition: state
# entity_id: sun.sun
# state: 'below_horizon'
action:
service: light.turn_on
entity_id: light.living_room
- alias: 'Media player playing'
trigger:
- platform: state
entity_id: media_player.fire_tv
to: 'playing'
from: 'idle'
# condition:
# - condition: state
# entity_id: sun.sun
# state: 'below_horizon'
action:
service: light.turn_off
entity_id: light.living_room
Not sure what’s causing the sporadic behavior but have you tried breaking each media player out individually instead of using a group of players? Either with multiple services or adding them individually to a list?
As for the lights not working with your fire tv. Did you check if the media_player still is properly changing states? The action looks right to me so I would suspect the trigger is the problem.
The other thing that I would do is not make your aliases so long or have punctuation. I’d comment the code instead. Just a good practice to do anyway.
When I first set up Home Assistant a few weeks ago it was detecting my Fire TV and when I would play stuff off the Plex app it would show an image of the file playing at everything on my front end. From reading about it, that shouldn’t have been working since the fire tv server uses python 2 and home assistant uses python 3. Apparently I need to run the firetv server through python 2 in a virtual environment. I have no idea how to do this. I’ve been googling but am not finding any good walkthroughs. Does anything have a resource for me to learn how to set up a virtual environment on windows 10? I do not know how to do that. If I could get that set up with pything 2.7 running on it, I think I can get the fire TV working again.
Yeah I gave up with the Fire TV component because of having to virtualize the environment. Hopefully one day it will run on Python 3. Could it be that your automation was working with Plex instead?
No unfortunately i’ve never been able to get plex to work sucessfully. Fire TV was working despite it saying it wasn’t compatible with python 3.6. It just stopped working and I can’t get it back. How frustrating. I hope I can get Plex to work. It’s hard because I have 2 servers and I can only use one.
@3m0 Plex has been rocky over the months for me too but finally seems to be reliable. I had to delete the Plex.conf file and start over with the config a few times. Also had to sign out of the server and back in. There was also another way to refresh my token but I can’t remember what I had to do. Here’s a link with some troubleshooting tips.
Thanks Jer78. I deleted my plex.conf file and no luck. I checked out the think you supplied and ran through all of that. It’s showing the correct server, ip address and stuff when using my token.
Originally HA detected my other plex server (plex 2). Now I’m trying to get it forget that one and add Plex 1 server but in my error log it still references the original. Any ideas how to get HA to forget my original plex server and point to the correct one? Should be pointing to 192.168.1.68 and not 192.168.1.159.
Here’s the error:
17-09-03 19:53:44 ERROR (SyncWorker_1) [plexapi] http://192.168.1.159:32400: (401) unauthorized
2017-09-03 19:53:44 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform plex
Traceback (most recent call last):
File "C:\Users\DESKTOP2\AppData\Roaming\.homeassistant\deps\Python36\site-packages\plexapi\server.py", line 47, in _connect
return self.query('/')
File "C:\Users\DESKTOP2\AppData\Roaming\.homeassistant\deps\Python36\site-packages\plexapi\server.py", line 110, in query
raise BadRequest('(%s) %s' % (response.status_code, codename))
plexapi.exceptions.BadRequest: (401) unauthorized
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\desktop2\appdata\local\programs\python\python36\lib\site-packages\homeassistant\helpers\entity_component.py", line 164, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File "c:\users\desktop2\appdata\local\programs\python\python36\lib\asyncio\tasks.py", line 358, in wait_for
return fut.result()
File "c:\users\desktop2\appdata\local\programs\python\python36\lib\asyncio\futures.py", line 245, in result
raise self._exception
File "c:\users\desktop2\appdata\local\programs\python\python36\lib\concurrent\futures\thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "c:\users\desktop2\appdata\local\programs\python\python36\lib\site-packages\homeassistant\components\sensor\plex.py", line 52, in setup_platform
name, plex_url, plex_user, plex_password, plex_server)], True)
File "c:\users\desktop2\appdata\local\programs\python\python36\lib\site-packages\homeassistant\components\sensor\plex.py", line 74, in __init__
self._server = PlexServer(plex_url)
File "C:\Users\DESKTOP2\AppData\Roaming\.homeassistant\deps\Python36\site-packages\plexapi\server.py", line 27, in __init__
data = self._connect()
File "C:\Users\DESKTOP2\AppData\Roaming\.homeassistant\deps\Python36\site-packages\plexapi\server.py", line 50, in _connect
raise NotFound('No server found at: %s' % self.baseurl)
plexapi.exceptions.NotFound: No server found at: http://192.168.1.159:32400