Send Microsoft Teams status over MQTT

This flow reads the busy status of the user from Microsoft Teams and sends it over MQTT to a desired server.

The flow has to run on the computer where the user is using Teams.

[{"id":"555e296db5ae51e7","type":"debug","z":"9984a92637d8122e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":260,"wires":[]},{"id":"42c8549e64987c80","type":"file in","z":"9984a92637d8122e","name":"Read Teams log.txt","filename":"","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":790,"y":120,"wires":[["416c104dfc614a35"]]},{"id":"f4218cab1a598d50","type":"inject","z":"9984a92637d8122e","name":"","props":[{"p":"payload"}],"repeat":"10","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"USERNAME","payloadType":"env","x":150,"y":120,"wires":[["5eddd6f352fd09a2"]]},{"id":"416c104dfc614a35","type":"change","z":"9984a92637d8122e","name":"Get all statuses updates","rules":[{"t":"set","p":"payload","pt":"msg","to":"$match(payload, /(?<=Added )(.*?)(?= \\(current)/)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":260,"wires":[["33916d528ca56f34"]]},{"id":"33916d528ca56f34","type":"change","z":"9984a92637d8122e","name":"Extract last","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[$count(payload) - 1].match\t\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":260,"wires":[["73a92c4b69db744f"]]},{"id":"5ae302ccd7927bd2","type":"rbe","z":"9984a92637d8122e","name":"Drop if same message","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":200,"y":380,"wires":[["16dd9ceb105793eb","fe98a76fb8c13ec9"]]},{"id":"73a92c4b69db744f","type":"switch","z":"9984a92637d8122e","name":"Drop \"NewActivity\" messages","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"NewActivity","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":260,"wires":[["555e296db5ae51e7","5ae302ccd7927bd2"]]},{"id":"16dd9ceb105793eb","type":"debug","z":"9984a92637d8122e","name":"To MQTT host","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":820,"y":360,"wires":[]},{"id":"fe98a76fb8c13ec9","type":"mqtt out","z":"9984a92637d8122e","name":"","topic":"home/busylight","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"299715ac11aca928","x":540,"y":420,"wires":[]},{"id":"5eddd6f352fd09a2","type":"template","z":"9984a92637d8122e","name":"Build filename string","field":"filename","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"C:\\Users\\{{payload}}\\AppData\\Roaming\\Microsoft\\Teams\\logs.txt","output":"str","x":480,"y":120,"wires":[["42c8549e64987c80"]]},{"id":"299715ac11aca928","type":"mqtt-broker","name":"","broker":"","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"home/busylight","closeQos":"1","closeRetain":"true","closePayload":"ClosedClient","closeMsg":{},"willTopic":"home/busylight","willQos":"1","willRetain":"true","willPayload":"DeadClient","willMsg":{},"sessionExpiry":""}]

Flow Info

Created 3 years, 2 months ago
Rating: not yet rated

Actions

Rate:

Node Types

Core
  • change (x2)
  • debug (x2)
  • file in (x1)
  • inject (x1)
  • mqtt out (x1)
  • mqtt-broker (x1)
  • rbe (x1)
  • switch (x1)
  • template (x1)

Tags

  • teams
  • busylight
  • mqtt
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option