Sensor scrape only on certain day

hi guys

Every Saturday morning i sit and watch two YouTube video by using the below scrape platform.

this is fine for my first two YouTube channels as they post new content Friday night, yet i like watching Chris Ramsay’s Wednesday video too.

my issue it he posts new content on a friday which then updates my scrape sensor.

# Chris Ramsay
- platform: scrape
  resource: 'https://www.youtube.com/feeds/videos.xml?channel_id=UCrPUg54jUy1T_wII9jgdRbg'
  name: yt_puzzle
  select: yt\:videoid

is there away to scrape the above only on a certain day?

only thing I can think of would be to create a template_Sensor that pulls data from your scrape sensor with the condition that the day of week is the one you want

1 Like

thank you for your help

i was able to resolve my issue by using input_text and an automation

- alias: youtube_puzzle_weds
  initial_state: 'on'
  trigger:
      - platform: time
        at: '14:00:00'
  condition:
  - condition: time
    weekday:
      - wed
  action:
      - service: input_text.set_value
        data_template:
          entity_id: input_text.youtube_puzzle
          value: "{{ states('sensor.yt_puzzle') }}"
1 Like

That seems like a good way of doing it.

I tried something similar, I need to record a sensor at 3pm everyday, so I’ve got an action which publishes an MQTT packet, and then I have an MQTT sensor set up to record the publishes MQTT value. Not ideal but I could see no obvious way to record values at certain times in HA.

Here’s my yaml

automation:
  - alias: 'Daily Value Log'
    initial_state: True
    trigger:
      platform: time
      at: '15:00:00'
    action:
      - service: mqtt.publish
        data_template:
          topic: "stat/hass_io/DAILY/value_log"
          payload: "{{ states('sensor.test_pres') }}"

sensor:
  - platform: mqtt
    name: "Daily Value log"
    state_topic: "stat/hass_io/DAILY/value_log"

I’ll have to give the input text method a go.