Hue Motion Sensor > Start playing radio on my wireless speaker

Hi everyone,

I am trying to do my first automation, and man do I feel the pain of knowing zero about coding. I apologize for being a complete newbie at this, and really want to learn! Can someone point me in the right direction? I have not been able to find any thorough guides to help me out for this.

Where I am at the moment:
-My Philips Hue Bridge 2.0 is detected, and I see and can control all my lights in Home Assistant.
-My B&O Beoplay M3 speaker is detected as a Chromecast Audio player, and if I play something on it, through Chromecast, I can see it in Home Assistant too
-I have not gotten around to get an actual component for Beoplay installed yet, but there is an unofficial that @marton have made based on a similar component. Therefore my control of the speaker is limited, but I assume I can still start chromecasting something, like tunein radio, to it from HA.

-I found this GitHub project for the sensors: https://github.com/robmarkcole/Hue-sensors-HASS
-Added the custom_components folder provided to my /configuration folder
-Added the following in my configuration.yaml under #Sensors:
sensor:
platform: hue
-In the top of my Home Assistant Overview I now see my two dimmer switches, but I do not see my motion sensor

I have not been able to find a solution to get the motion sensor to show up. Also, I have not manged been able to understand how to make the automations, as I for example do not know how to make my speaker play radio in HA.

So I assume what I need help for is:
-How do I get the motion sensor to show up as well?
-How do I create an automation that makes my Beoplay M3 play a station on tunein radio for, say, 20 minutes everytime the motion sensor is triggered, but only between 06:45 - 22:00?

Hope someone would be nice enough to help me out here. I would highly appreciate it!

Hi @pandaym

I don’t know how the Hue things work, I have none of those, but for the automation I think something like this could work:

automation:
- alias: 'Radio on motion trigger'
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: <name of philips hue sensor>
    to: 'on'
  condition:
    condition: and
    conditions:
      - condition: time
        after: '06:45:00'
      - condition: time
        before: '22:00:00'
  action:
  - service: media_player.play_media
    data_template:
      entity_id: media_player.<name of beoplay m3>
      media_content_id: http://live-icy.gslb01.dr.dk/A/A29H.mp3
      media_content_type: 'audio/mp3'
  - delay: '00:20:00'
  - service: media_player.turn_off
    data:
      entity_id: media_player.<name of beoplay m3>