Needing help making my automation less sensitive

hi all,

as you’ll probably work out, i have no idea what i am doing, only what I want to do.

i have an automation put together with the help of people in here, though its not working as well as i had hoped. the idea I thought was simple put my powered subwoofer on an ikea tradfri plug and when my sony bravia tv turns on, the subwoofer will turn on, and when the tv turns off the subwoofer turns off.

however for some reason the subwoofer turns off and back on at random times while the tv is on. my guess is that it resets the signal every so often, and with that the subwoofer responds and turns off, so to fix it, is it possible to include that the subwoofer will only turn off if the tv has been off for say 30 seconds?

this is what i have

- id: '1544197792359'
  alias: turn on subwoofer with TV
  hide_entity: true
  initial_state: 'true'
  trigger:
  - platform: state
    entity_id: media_player.sony_bravia_tv
    to: "on"
  action:
    service: switch.turn_on
    entity_id: switch.subwoofer
    
    
- id: '1544197792360'
  alias: turn off subwoofer with TV
  hide_entity: true
  initial_state: 'true'
  trigger:
  - platform: state
    entity_id: media_player.sony_bravia_tv
    to: "off"
  action:
    service: switch.turn_off
    entity_id: switch.subwoofer

can anyone help me? its driving my wife mad with all the on and off…

Edit:

I just checked my logs and found something is going on with the tv but no idea what…

JSON request error:{ “error”: [ 404, “Not Found” ] }

11:26 PM components/braviatv/media_player.py (ERROR) - message first occured at July 1, 2019, 6:41 PM and shows up 36 times

JSON request error:{ “error”: [ 40005, “Display Is Turned off” ], “id”: 1 }

4:39 PM components/braviatv/media_player.py (ERROR) - message first occured at July 1, 2019, 10:45 AM and shows up 35 times

Exception: HTTPConnectionPool(host=‘192.168.0.10’, port=80): Read timed out. (read timeout=10)

July 14, 2019, 9:07 PM components/braviatv/media_player.py (ERROR) - message first occured at July 1, 2019, 9:57 AM and shows up 61 times

Update of media_player.sony_bravia_tv is taking over 10 seconds

July 14, 2019, 9:07 PM main.py (WARNING) - message first occured at July 1, 2019, 9:57 AM and shows up 93 times

Updating braviatv media_player took longer than the scheduled update interval 0:00:10

July 13, 2019, 9:12 PM helpers/entity_platform.py (WARNING) - message first occured at July 1, 2019, 9:57 AM and shows up 36 times

Yes very easy:

- id: '1544197792360'
  alias: turn off subwoofer with TV
  hide_entity: true
  initial_state: 'true'
  trigger:
  - platform: state
    entity_id: media_player.sony_bravia_tv
    to: "off"
    for:
      seconds: 30
  action:
    service: switch.turn_off
    entity_id: switch.subwoofer

Looks like HA is having trouble contacting your TV. Have you given your TV a fixed IP address?

3 Likes

thanks tom,

just added your suggestion to my automation hope it works :slight_smile:

yes my tv has a fixed IP, set by my router