Receive user status from Microsoft Teams and display on RPi LEDs

This flow receives through MQTT the Microsoft Teams status and shows it by switching between a green, yellow and red LEDs on a Raspberry Pi.

The default configuration will turn on the LEDs in the following conditions:

  • Green LED: When "Available".
  • Yellow LED: When "Busy".
  • Red LED: When "OnThePhone", "InAMeeting" or"Presenting".

Any other state will turn off all LEDs.

To send the status use this flow on the user PC: https://flows.nodered.org/flow/ede2cc75e825b0289de6e6a978abee0c

[{"id":"c4b953be1eb8b7be","type":"aedes broker","z":"b29d058ef01696d9","name":"","mqtt_port":1883,"mqtt_ws_bind":"port","mqtt_ws_port":"","mqtt_ws_path":"","cert":"","key":"","certname":"","keyname":"","dburl":"","usetls":false,"credentials":{},"x":630,"y":220,"wires":[["0f484163573b32e5"],["d0f7a5138521178d"]]},{"id":"0f484163573b32e5","type":"debug","z":"b29d058ef01696d9","name":"Broker events","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":880,"y":200,"wires":[]},{"id":"d0f7a5138521178d","type":"debug","z":"b29d058ef01696d9","name":"Publish events","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":880,"y":260,"wires":[]},{"id":"1fb1a5f1b21199ac","type":"mqtt in","z":"b29d058ef01696d9","name":"","topic":"home/busylight","qos":"2","datatype":"auto","broker":"b5e08107fb9271fb","nl":false,"rap":true,"rh":0,"inputs":0,"x":360,"y":420,"wires":[["b40d7a306a97a934","535b41dbcb14d8f3"]]},{"id":"b40d7a306a97a934","type":"debug","z":"b29d058ef01696d9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":970,"y":420,"wires":[]},{"id":"c069e461631f66c1","type":"rpi-gpio out","z":"b29d058ef01696d9","name":"Red","pin":"17","set":true,"level":"0","freq":"","out":"out","bcm":true,"x":1010,"y":560,"wires":[]},{"id":"b2a2b3e3d95f9ca1","type":"rpi-gpio out","z":"b29d058ef01696d9","name":"Yellow","pin":"27","set":true,"level":"0","freq":"","out":"out","bcm":true,"x":1010,"y":620,"wires":[]},{"id":"423d93fa0c905d67","type":"rpi-gpio out","z":"b29d058ef01696d9","name":"Green","pin":"22","set":true,"level":"0","freq":"","out":"out","bcm":true,"x":1010,"y":680,"wires":[]},{"id":"535b41dbcb14d8f3","type":"function","z":"b29d058ef01696d9","name":"","func":"var offMsg = { payload: false };\nvar onMsg = { payload: true };\n\nswitch (msg.payload) {\n    case \"Available\":\n        return [offMsg, offMsg, onMsg];\n    case \"Busy\":\n        return [offMsg, onMsg, offMsg];\n    case \"OnThePhone\":\n    case \"InAMeeting\":\n    case \"Presenting\":\n        return [onMsg, offMsg, offMsg];\n    default:\n        return [offMsg, offMsg, offMsg];\n}","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":600,"wires":[["c069e461631f66c1"],["b2a2b3e3d95f9ca1"],["423d93fa0c905d67"]]},{"id":"b5e08107fb9271fb","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":"","credentials":{}}]

Flow Info

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

Actions

Rate:

Node Types

Core
  • debug (x3)
  • function (x1)
  • mqtt in (x1)
  • mqtt-broker (x1)
Other

Tags

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