AntoineGS / teams-status-rs

47 stars 0 forks source link

teams_status.exe closes with an error and no tray icon #2

Closed binderth closed 6 months ago

binderth commented 7 months ago

What I did:

  1. Downloaded teams_status.exe
  2. started it the first time
  3. edited conf.ini and added Home Assistang URL/Token, left Teams URL and Token as is (new Teams doesn't use a Token)
  4. started a Meeting with myself
  5. started second time
  6. got the following within output.log
  7. teams_status.exe closes (not present anymore in task manager)
2023-11-17T11:49:33.059365300+01:00  INFO teams_status - --------------------
2023-11-17T11:49:33.059563200+01:00  INFO teams_status - Application starting
2023-11-17T11:49:33.089053600+01:00  INFO teams_status::configuration - The file conf.ini could not be loaded, we will create a new one: Das System kann die angegebene Datei nicht finden. (os error 2)
2023-11-17T11:55:00.636129100+01:00  INFO teams_status - --------------------
2023-11-17T11:55:00.636355300+01:00  INFO teams_status - Application starting
2023-11-17T11:55:02.741703400+01:00  INFO teams_status::teams_api - {"meetingUpdate":{"meetingPermissions":{"canToggleMute":false,"canToggleVideo":false,"canToggleHand":false,"canToggleBlur":false,"canLeave":false,"canReact":false,"canToggleShareTray":false,"canToggleChat":false,"canStopSharing":false,"canPair":false}}}
2023-11-17T11:55:02.742504900+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T11:55:02.742538200+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T11:57:33.368959900+01:00  INFO teams_status - --------------------
2023-11-17T11:57:33.369075+01:00     INFO teams_status - Application starting
2023-11-17T11:57:35.460542700+01:00  INFO teams_status::teams_api - {"meetingUpdate":{"meetingPermissions":{"canToggleMute":false,"canToggleVideo":false,"canToggleHand":false,"canToggleBlur":false,"canLeave":false,"canReact":false,"canToggleShareTray":false,"canToggleChat":false,"canStopSharing":false,"canPair":false}}}
2023-11-17T11:57:35.460594800+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T11:57:35.460602600+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T11:58:22.237613300+01:00  INFO teams_status - --------------------
2023-11-17T11:58:22.237770+01:00     INFO teams_status - Application starting
2023-11-17T11:58:23.675526100+01:00  INFO teams_status - --------------------
2023-11-17T11:58:23.675609400+01:00  INFO teams_status - Application starting
2023-11-17T11:58:24.332069600+01:00  INFO teams_status::teams_api - {"meetingUpdate":{"meetingPermissions":{"canToggleMute":true,"canToggleVideo":true,"canToggleHand":true,"canToggleBlur":false,"canLeave":true,"canReact":true,"canToggleShareTray":true,"canToggleChat":true,"canStopSharing":false,"canPair":true}}}
2023-11-17T11:58:24.332128600+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T11:58:24.332135300+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T11:58:25.766753700+01:00  INFO teams_status::teams_api - {"meetingUpdate":{"meetingPermissions":{"canToggleMute":true,"canToggleVideo":true,"canToggleHand":true,"canToggleBlur":false,"canLeave":true,"canReact":true,"canToggleShareTray":true,"canToggleChat":true,"canStopSharing":false,"canPair":true}}}
2023-11-17T11:58:25.766837500+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T11:58:25.766848900+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T12:00:05.236169300+01:00  INFO teams_status - --------------------
2023-11-17T12:00:05.236319300+01:00  INFO teams_status - Application starting
2023-11-17T12:00:07.327368+01:00     INFO teams_status::teams_api - {"meetingUpdate":{"meetingPermissions":{"canToggleMute":true,"canToggleVideo":true,"canToggleHand":true,"canToggleBlur":false,"canLeave":true,"canReact":true,"canToggleShareTray":true,"canToggleChat":true,"canStopSharing":false,"canPair":true}}}
2023-11-17T12:00:07.327430+01:00     ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T12:00:07.327439900+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T12:49:20.889031900+01:00  INFO teams_status - --------------------
2023-11-17T12:49:20.889393500+01:00  INFO teams_status - Application starting
2023-11-17T12:49:22.999428100+01:00  INFO teams_status::teams_api - {"meetingUpdate":{"meetingPermissions":{"canToggleMute":false,"canToggleVideo":false,"canToggleHand":false,"canToggleBlur":false,"canLeave":false,"canReact":false,"canToggleShareTray":false,"canToggleChat":false,"canStopSharing":false,"canPair":false}}}
2023-11-17T12:49:22.999575700+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
2023-11-17T12:49:22.999591700+01:00  ERROR teams_status::teams_api - Unable to locate isVideoOn variable in JSON
AntoineGS commented 7 months ago

Alright so my logging is still lacking in some places, mostly around the HA connection. The Teams token will be auto populated by the application after you toggle mute the first time around, after which it will use the token so you do not have to request authentication from Teams every time. From the logs I can see that the Teams API is connecting fine so that end should be OK. On the HA side, could you either delete the sensor and see if it gets created again or change the name of the sensor in the conf.ini to something different and see if that gets created? That would confirm that it is on the HA side of the application that it fails, in which case re-entering the token and url might be a good idea. Otherwise I am finishing off a modification and will then add additional logging for HA, so if you you would rather wait that works too!

binderth commented 7 months ago

Alright so my logging is still lacking in some places, mostly around the HA connection.

ah! ok, I don't have HA running atm, so I used the endpoints already there from the "old" version with my Node-Red (POST: /api/states/sensor.*). But as I'm thinking now, I guess, you've changed that? Would it be possible, if the "virtual HA new Teams"-endpoints are available? ...that's why I suggested either a "free" endpoint or mqtt messages. If it's easy, a POST with the Teams-JSON should suffice, the rest can be done after that - but teams-status-rs would be HA agnostic...?

AntoineGS commented 7 months ago

Oh it is now a binary_sensor by default, so that could be it. Though I am using a crate/package to do the API call and not constructing it myself, so I am not really sure it something else could have changed. Otherwise I am wrapping MQTT support shortly which is probably easier to integrate into Node-Red? It should be done this week-end.

binderth commented 7 months ago

If it's easier just send the TeamsJSON via POST to a webhook. Node-Red (and many others) can cope with a post of an URL. That way, potential new JSON attributes from the Teams-API would be updated automatically.

AntoineGS commented 7 months ago

So I finished the integration with mqtt, but... My anti-virus flags the application as a virus and so do about 12 on virustotal šŸ˜£šŸ˜£šŸ˜£ no idea what to do with this problem.

binderth commented 7 months ago

Thanks for adding the mqtt integration. And yes, I also can see that. My company policy won't allow me to start it because of that. šŸ˜¢

AntoineGS commented 7 months ago

I was able to resolve the issue by self-signing it, though I am unsure if that will cause an issue with some group policies. If it does, I can also release the debug build as that was also does not get picked up from what I can see, very odd. https://github.com/AntoineGS/teams-status-rs/releases/tag/v0.2.1

binderth commented 7 months ago

fyi; That's still flagged by my AntiVirus...

AntoineGS commented 7 months ago

What anti virus are you running?

AntoineGS commented 7 months ago

After some trial and error, when I compile with the new version of Rust (1.74.0) it is much worst. I built two versions, one regular release (here) and one that is unoptimized (here), the latter is not ideal but gets flagged even less (the VirusTotal reports are on the releases). Let me know if either or both of them work for you, also anti-virus you are running can help as I will submit the application to get it reviewed with the companies that have this process.

binderth commented 7 months ago

We're running Microsoft Defender. I'll give it a try later.

mhoogenbosch commented 7 months ago

I've installed it this night. Enabled the local API, but with 'new teams'.

Uncertain if it is the same issue, but the log shows the same:

2023-11-22T21:43:36.756368900+01:00  INFO teams_status - --------------------
2023-11-22T21:43:36.756476800+01:00  INFO teams_status - Application starting
2023-11-22T21:43:37.813511900+01:00  INFO teams_status::teams::api - {"meetingUpdate":{"meetingPermissions":{"canToggleMute":true,"canToggleVideo":true,"canToggleHand":false,"canToggleBlur":true,"canLeave":true,"canReact":true,"canToggleShareTray":true,"canToggleChat":true,"canStopSharing":false,"canPair":true}}}
2023-11-22T21:43:37.813598300+01:00  ERROR teams_status::teams::api - Unable to locate isVideoOn variable in JSON
2023-11-22T21:43:37.813621500+01:00  ERROR teams_status::teams::api - Unable to locate isVideoOn variable in JSON

The sensors get created in HA, so I guess URL and Token are fine.

With a test call the status doesn't change.

Running the 0.2.2 version, I do run Defender, but the app is located in the tray and doesn't seem to get flagged.

AntoineGS commented 7 months ago

This would be a different issue, have you done this step here? image

If you have, please open a new issue and I will help further!

jcschmidt31 commented 6 months ago

I had to use a local ip connection for HomeAssistant instead of my Cloudflared URL. Once I set that in the config it was able to connect to HomeAssistant and the I could toggle the mic mute. Excellent work.

AntoineGS commented 6 months ago

Yeah the new Teams does not seem to allow external connections unfortunately. Thanks for the feedback!