{"id":13278,"date":"2021-03-19T16:07:49","date_gmt":"2021-03-19T16:07:49","guid":{"rendered":"https:\/\/www.rjt.org.uk\/home\/?post_type=home_assistant_tip&#038;p=13278"},"modified":"2021-03-23T10:08:40","modified_gmt":"2021-03-23T10:08:40","slug":"play-radio-on-weekdays","status":"publish","type":"home_assistant_tip","link":"https:\/\/www.rjt.org.uk\/home\/archives\/home-assistant-tip\/play-radio-on-weekdays\/","title":{"rendered":"Play Radio on weekdays"},"content":{"rendered":"\n<p>This automation starts the Alexa in the Kitchen in the morning on weekdays when the kitchen is first entered.<\/p>\n\n\n\n<p>It uses the last automation run time to see if it has been previously run on the current morning to prevent it being run again.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">alias: Play Radio 2 in the Morning\ndescription: ''\ntrigger:\n  - platform: state\n    entity_id: input_boolean.kitchen_motion\n    to: 'on'\ncondition:\n  - condition: time\n    after: '07:00:00'\n    before: '09:00:00'\n    weekday:\n     - mon\n     - tue\n     - wed\n     - thu\n     - fri\n  - condition: template\n    value_template: >\n     {{ (as_timestamp(now()) -\n      as_timestamp(states.automation.play_radio_2_in_the_morning.attributes.last_triggered\n      | default(0)) | int > 7200)}}\naction:\n  - service: media_player.play_media\n    data:\n      entity_id: media_player.flex_kitchen\n      media_content_id: radio 2\n      media_content_type: custom\nmode: single<\/pre>\n","protected":false},"template":"","class_list":["post-13278","home_assistant_tip","type-home_assistant_tip","status-publish","hentry","comments-off"],"_links":{"self":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/home_assistant_tip\/13278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/home_assistant_tip"}],"about":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/types\/home_assistant_tip"}],"wp:attachment":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/media?parent=13278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}