Created
August 31, 2020 05:17
-
-
Save xbmcnut/d2425f6b773a6746494d4815db3069c7 to your computer and use it in GitHub Desktop.
Turn PTZ to sunset, take a snapshot and if the TV is on, send it to the TV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
automation: | |
- alias: 'Take sunset snapshot and send to TV' | |
initial_state: true | |
trigger: | |
platform: numeric_state | |
entity_id: sun.sun | |
value_template: "{{ state_attr('sun.sun', 'elevation') }}" | |
below: 0.3 | |
condition: | |
- condition: template | |
value_template: >- | |
{% set season = states('sensor.season') %} | |
{{ season == 'autumn' or season == 'summer' }} | |
- condition: template | |
value_template: "{{ (as_timestamp(now()) - | |
as_timestamp(states.automation.take_sunset_snapshot_and_send_to_tv.attributes.last_triggered)) | |
> 15 * 60 * 60 }}" | |
action: | |
- service: rest_command.move_to_preset_05_07s # Preset defined in \packages\surveillance\surveillance_station.yaml# | |
- delay: '00:00:05' | |
- service: camera.snapshot | |
data: | |
entity_id: camera.proxy_deck_720_2fps | |
filename: '/config/www/images/sunset.jpg' | |
## Adds a condition inside actions. More info here https://www.home-assistant.io/docs/automation/action/ | |
- condition: state | |
entity_id: media_player.sony_bravia_tv | |
state: 'on' | |
- delay: 00:00:02 | |
- service: rest_command.androidtv_sunset_view |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Utilises an Android TV with the Pipup add-on installed.
https://play.google.com/store/apps/details?id=nl.rogro82.pipup&hl=en