EBOOZ / TeamsStatus

Monitoring your Microsoft Teams status with PowerShell
202 stars 40 forks source link

Service wont start (paused) #23

Closed joelhauxwell closed 3 years ago

joelhauxwell commented 3 years ago

Hello,

I followed the instructions to the letter to install this and although the service appears in the services list, its status is paused and it wont start.

I didn't get any errors whilst following the instructions until the last line where i get:

PS C:\Scripts> Start-Service -Name "Microsoft Teams Status Monitor"
Start-Service : Failed to start service 'Microsoft Teams Status Monitor (Microsoft Teams Status Monitor)'.
At line:1 char:1
+ Start-Service -Name "Microsoft Teams Status Monitor"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
   ServiceCommandException
    + FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand

PS C:\Scripts>

Any ideas?

Thanks,

EBOOZ commented 3 years ago

What happens when you try to start the script directly in a PowerShell prompt?

joelhauxwell commented 3 years ago

Thanks for your reply. The message I copy/pasted above was directly from the PowerShell prompt.

EBOOZ commented 3 years ago

Yeah, but you try to start the service via PowerShell. What happens when you run Get-TeamsStatus.ps1 directly from the prompt?

joelhauxwell commented 3 years ago

Ah that's interesting, i get this:

image

Looks like it cant connect to my HA.

I have checked the Long-Lived Access Token and the URL of my HA box - this is the config

image

I suspect the $HAUrl may be formatted incorrectly?

Thanks.

joelhauxwell commented 3 years ago

A bit of progress - i realised that the HA ip address possibly needed the port adding, so i have done that and now the error doesn't appear in PowerShell

image

However, in HA i just get 'unknown' for status and activity:

image

I have rebooted the HA pi and my PC.

Thanks,

EBOOZ commented 3 years ago

I think something got messed up when adding the sensors to your configuration. The sensor that get updated are not input_text, but template sensors:

sensor:
  - platform: template
    sensors:
      teams_status: 
        friendly_name: "Microsoft Teams status"
        value_template: "{{states('input_text.teams_status')}}"
        icon_template: "{{state_attr('input_text.teams_status','icon')}}"
        unique_id: sensor.teams_status
      teams_activity:
        friendly_name: "Microsoft Teams activity"
        value_template: "{{states('input_text.teams_activity')}}"
        unique_id: sensor.teams_activity

So the sensors that get updated are sensor.teams_status and sensor.teams_activity.

joelhauxwell commented 3 years ago

OK, i was following the instructions here:

image

I just pasted this all into configuration.yaml

Is this correct?

EBOOZ commented 3 years ago

Jup! That's how I have it in my config as well :)

joelhauxwell commented 3 years ago

So i just created a new Card in the UI and searched for "teams" and added all the entities to one card and get this:

image

The bottom entry "Microsoft Teams status" showing "Presenting" was correct

EBOOZ commented 3 years ago

The teams_activity sensor should update as soon as you join a call. Have you tested that one already? I assume that will work as well, since the teams_status sensor updates.

Feel free to reopen if you still experience issues.