Use value from input_select to run automation - MS Teams Status light/Phillps Hue

Hi,

followed some instructions here to get MS Teams status to report in HA.

It works great, I can now see the status in HA on my dashboard (as per the instructions on the page in the link above),

Next I’d like to create a light (via Hue) to reflect the status shown on my dashboard.

The integration uses input_select with the states (options)

options:

  • Available
  • Presenting
  • In A Call
  • In A Meeting
  • Busy
  • Away
  • Be Right Back
  • Do Not Disturb
  • Idle
  • Offline
  • ‘Off’
  • In A Conference Call

When I try to create an automation, using the input_select entity ID and a trigger state, i use attribute (options), then say from available to busy the condition, then I action the device (Hue Light) even simply turning it off does not work.

How do I connect the existing state of Teams presence to flip on a light (or change the colour of it)?

thanks

Don’t use that attribute, that is a list of available options. Use the entity state. That is which option it is currently selected.

e.g.

trigger: 
  platform: state
  entity_id: input_select.teams_status
  to: "Do Not Disturb"

Or, using this trigger will trigger an any state change of the input select:

trigger: 
  platform: state
  entity_id: input_select.teams_status
  to:

You can then use a template to set the light colour depending on the input select state.

1 Like

thank you very much! that worked well.

I set up a simply automation to just turn off the light on Do Not Distrub, and it turned off!

CAn you please elaborate a bit more the colour aspect of this? Are there templates avilable for Hue lights to select colours based on states?

You can use the “choose” action to tie each state to a specific action to perform for that state.

this really simplfies things in one automation!

I can create 6 options (for each status) then each option has an action.

In the actions sections, do you know how I can select a colour instead of just the regular on/off/brightness for the lght control?

The light.turn_on service should have everything you need.

1 Like

@Edwin_D @tom_l

Thank you very much! I’m amazed at how easy that was and how well it works!

Would it be possible to make this only run during certain times? For example at night time I want the light just to be a normal night light but during working hours it can be that team status light

The conditions in an automation allow you to specify when (and by implication - when not) to execute the automation. So put in a condition to test for the time, and if needed create another automation for the night.

Thank you again @Edwin_D

I was able to specify a condition with time in the automation upfront (i.e. before the choose actions commands) of the automation. I then created a second automation for the night light control of the same light.

Here’s what I did:

Automation 1. I set the time condition for after 6 am to before 6 pm (mon to saturday) for the Teams Status to work on the Hue Go light. So, anything outside of that time, the light will not change colour based on status (I tested this and it works).

Automation 2. For the second automation i.e. make the Hue Go light a normal/night light, I created two time conditions (in the same automation) for after 6pm and before 6 am (mon to friday) and allday say and sun

Just some observations/questions:

  1. I noticed that once 6 am hits on a work-day, the light still remains at the last state (i.e. night-light state colour), and it isn’t untill the teams status has changed that the light will turn to status colour. Not an issue at all, but, would it easy for the automation to get the status the moment 6 am hits? Its not a big deal if it not possible or easy.

  2. For the second automation (i.e. normal/night light). How do I specify 24 hrs on the weekend days (i.e. Sat, Sun)? Right now I’ve set the “before” and “after” times to the same time 12:00:00 am. I don’t know if this means all day…I suspect I have to change it to only “after” 12:00:00 am for Sat, Sun.

  3. Would it be possible, using trigger IDs and get rid of the second automation entirely? That way I can create only 1 automation (i.e. the first one), so that it can do both make the Hue Go light a Teams status light from Mon-Fri 6am to 6 pm, and every other time its a normal/night light at a different set colour?

thanks for your input!

This is easily fixed by using the start time as a a tigger too for the automations.

Short answer is - not. Leave the times empty and the test will only use the weekday.

condition: time
weekday:
  - sat
  - sun

Yes, but it would make the choice more complex, it is a matter of taste, but I would keep it separate. If you wanna torture yourself and HA you could combine all automations into one huge mess :- :crazy_face:

1 Like

thank you! this works well, and no, I don’t want to tortue myself with that so i’ll leave it as is! thanks again!