How do you control the TV’s specific HDMI input ?
Hi there!
Sadly my Philips TV doesn’t have HTTP controls (as far as I’ve searched).
So I had to implement a sad workaround that is anyway doing a fine job using a cheap and very nicely working IR blaster:
https://www.lightinthebox.com/nl/nieuwe-upgrade-versie-broadlink-rm-mini-3-zwarte-bonen-smart-home-wifi-universele-ir-slimme-afstandsbediening_p5528626.html?currency=EUR&litb_from=paid_adwords_shopping&sku=1_45&country_code=nl&utm_source=google_shopping&utm_medium=cpc&adword_mt=&adword_ct=200276709092&adword_kw=&adword_pos=1o1&adword_pl=&adword_net=g&adword_tar=&adw_src_id=8919752254_856513905_46187053391_aud-346682122756:pla-327174701475&gclid=CjwKCAiAxarQBRAmEiwA6YcGKHr1bizC9gbWAMpL9h2TdJyM79U5UgRb2WN46iwben-5nvJw_yo9OBoCMo0QAvD_BwE
Hi,
I’m interested in your automation to: “Dim the lights when I’m watching a show on my TV through Netflix/Plex/Chromecast”. How did you achieve the Netflix part? What event are you using as your trigger?
Thank you
I only watch Netflix on the Chromecast, sorry for the confusion.
My scripts only monitor if the Chromecast is playing anything and then dims the light. I have no direct hook into Netflix itself.
Maybe you could make something like that though, possibly by monitoring traffic to Netflix domains on a router/PI etc.
vexter could you share option 2
My Favourite
I have a Hot water cupboard Its has a heater Bar in it now as i put Instant Gas Hot water.
it has door Sensor
If the door is open turn off the bar heater until it is closed again ONLY if the Heater was on before it was open.
next to automate the hall lights then add more brains to it. If I open The cupboard and its nite time turn on hall Lights until the cupboard door is closed but only if the Light was off before it was opened.
@myle - sure!! First of all - I’ll give credit where credit is due - I had to start a thread where I was having to determine the type of content playing - as I didn’t want the lights to dim when playing ‘tv’ content vs ‘movies’ - so credit to @Zen for the help!! - Thread is here - KODI - Content Type - Movie vs Tv Show - Library
I had the whole solution in that thread - so I’m copying/pasting from there - it’s all still working perfectly!!
Just so everyone has the solution -
bash script:
#! /bin/bash
curl -s -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "playerid": 1}, "id": "VideoGetItem"}' http://<<<IP ADDRESS OF KODI>>>/jsonrpc | if [[ $(grep -o movie) ]]; then echo "ON"; else echo "OFF"; fi
Sensor:
- platform: command_line
scan_interval: 10
name: Movie_Time
command: "/usr/bin/mediachecker.sh"
payload_on: "ON"
payload_off: “OFF”
Automation:
- alias: "KODI Movie Stopped"
trigger:
- platform: state
entity_id: sensor.movie_time
from: 'ON’
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
service: scene.turn_on
entity_id: scene.Kodi_Stopped
- alias: "KODI Movie Playing"
trigger:
- platform: state
entity_id: sensor.movie_time
to: 'ON'
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
service: scene.turn_on
entity_id: scene.Kodi_Playing
Scene:
scene:
- name: Kodi_Playing
entities:
light.linear_lb60z1_dimmable_led_light_bulb_level_3_0:
state: on
brightness: 25
switch.ge_unknown_type5052_id3031_switch_2_0: off
- name: Kodi_Stopped
entities:
light.linear_lb60z1_dimmable_led_light_bulb_level_3_0:
state: on
brightness: 255
switch.ge_unknown_type5052_id3031_switch_2_0: on
I have the following three.
- Set the heating to come on if we are home in the morning (working from home) and its cold outside
- Set the heating back to its normal schedule at 5pm
- Set the heating back to its normal schedule if we leave the house during the day
I want to add a fourth using proximity but haven’t quite got there. Annoyingly have to use IFTTT to do the heating control because the home-assistant component is not fit for purpose (Honeywell Evohome).
- alias: Someone Home in the morning so lets set the heating on via IFTTT
trigger:
platform: time
at: "08:30:00"
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: sensor.dark_sky_apparent_temperature
below: 16.0
- condition: state
entity_id: group.all_devices
state: home
action:
- service: homeassistant.turn_on
entity_id: input_boolean.heating
- service: ifttt.trigger
data: {"event":"Heating_On"}
- service: notify.ios_paul
data_template:
title: "Heating On"
message: "Its morning, cold and people are home. Lets give them heat"
- service: script.turn_on
entity_id: script.tts_to_windows
data_template:
variables:
payload: 'Its 8 30 and people are home so Im going to put the heating on for you'
- alias: Reset Heating at 5
trigger:
platform: time
at: "17:00:00"
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.heating
state: 'on'
- condition: state
entity_id: group.all_devices
state: home
# Automation enabled
- condition: state
entity_id: input_boolean.automation_override
state: 'off'
action:
- service: ifttt.trigger
data: {"event":"Heating_Off"}
- service: notify.ios_paul
data_template:
title: "Heating Reset"
message: "Clocking off time lets reset the heating to its normal schedule!"
- service: script.turn_on
entity_id: script.tts_to_windows
data_template:
variables:
payload: 'Its 5 o clock so setting the heating back to its normal schedule'
- service: homeassistant.turn_off
entity_id: input_boolean.heating
- alias: Left for the day - reset heating
trigger:
platform: state
entity_id: group.all_devices
from: 'home'
to: 'not_home'
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.heating
state: 'on'
# Automation enabled
- condition: state
entity_id: input_boolean.automation_override
state: 'off'
action:
- service: ifttt.trigger
data: {"event":"Heating_Off"}
- service: homeassistant.turn_off
entity_id: input_boolean.heating
- service: notify.ios_paul
data_template:
title: "Away - Heating Rest"
message: "Everyone has left so lets reset the heating to its normal schedule!"
I just use this to detect media type, works perfectly…
- condition: template
value_template: '{{ states.media_player.kodi.attributes.media_content_type == "movie" }}'
@Bobby_Nobble - I ended up putting this to use in node red - worked perfectly - thanks again for the tip on states.media_player.kodi.attributes.media_content_type == “movie”!
You’re welcome, wish I had more of an idea how to use node red, get stuck with anything beyond turning something on and off with Alexa
I use this:
- alias: 'Dim lights when playing Netflix in Living Room'
trigger:
platform: state
entity_id: media_player.living_room
to: 'playing'
condition:
condition: and
conditions:
- condition: sun
after: sunset
after_offset: "-0:20:00"
- condition: template
value_template: '{{ states.media_player.living_room.attributes.app_name == "Netflix" }}'
action:
service: scene.turn_on
entity_id: scene.netflix
@Bobby_Nobble - take a look here for Node Red stuff - this guy put me on the right track - once I caught on - it’s been game on! http://diyfuturism.com/
That was who I followed to get started but found after the first simple description he suddenly leaps forward leaving out big chunks but talks like he’s explained it.
What I could really do with is something like the infamous turn your lights on at sunset automation in the HA docs that everybody uses to pick apart to see how they work, well those that can read or search do at least, rewritten for code red and uploaded somewhere handy so you can click on all the nodes and see what’s inside. All anyone seems to upload, understandably, are huge masterpieces of complex automation.
@Bobby_Nobble - see if this helps - pretty straight forward on sunrise/sunset and lights - http://forums.opto22.com/t/sun-rise-set-inside-outside-light-control/1206
Not mine - but with my understanding of node red - looks pretty good for a baseline understanding of sunset/lighting actions.
node outputs and msg.payload and debug node are the key points for me when working with node red. a node produces a msg.payload and the data you want could be the payload or the msg.topic or another property (such as the kodi stuff you helped me with above - the kodi state node for HASS produced an object and I just had to drill down into the area you mentioned within that object to get the media type.). Then I use a switch node a lot to determine which ‘path’ I want to go down or look at current states and do ‘stuff’ with HASS etc. I hope that helps a bit - I LOVE node red, but I also have a heavy IT background with orchestration etc - so it makes sense to me even though I know very little javascript or node.js which I think node red uses quite a bit.
Thanks for that, I’ll give it a go. I have very limited programming knowledge but am perfectly capable when it revolves around logic and common sense or I have something similar that I can tweak I’m fine, when you need to ‘know stuff’ like this I come unstuck.
Thank you, this is most useful!
Is it possible to do this with plex too?
Have a look in Dev states and see what info Plex shares when it’s playing.
I need your help,
I have 04 automations.
1 - Kodi playing
2 - kodi playing for paused
3 - kodi playing for idle
4 - kodi paused for idle
The first three work very well! But I have a serious problem. I can identify if the kodi is playing a movie or not. And I call automation (1), only if it’s a movie.
However, I have the addon (tvtunes) that reproduces the themes of the movies (audio.mp3), at that moment I have problem … Because when it stops playing, it is called automation (3) … No I can use the template to identify movie, because if I use it always will be false after stop.
I need the help of the gentlemen … If there is no solution I will have to deactivate the execution of themes of the films and tvshows …