[{"data":1,"prerenderedAt":177},["ShallowReactive",2],{"\u002Fblog\u002F2024-11-xmas-pi":3},{"id":4,"title":5,"body":6,"cover":164,"date":165,"description":166,"extension":167,"meta":168,"navigation":169,"path":170,"seo":171,"stem":172,"tags":173,"__hash__":176},"blog\u002Fblog\u002F2024-11-xmas-pi.md","XMAS-PI 2024",{"type":7,"value":8,"toc":157},"minimark",[9,21,41,44,59,64,73,76,100,107,110,114,129,144,150,154],[10,11,12,13,20],"p",{},"Since the release of ",[14,15,19],"a",{"href":16,"rel":17},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=TvlpIojusBE",[18],"nofollow","Matt Parkers Video"," it became a tradition for me, that at some point in November I start tinkering with my overly overegineered fairy lights of my christmas tree. Like the lights from the inspiring video, I am using ws2811 LED's that are controlled by a raspberry pi.",[22,23,24,33],"ul",{},[25,26,27,32],"li",{},[14,28,31],{"href":29,"rel":30},"https:\u002F\u002Fgithub.com\u002FEldoranDev\u002Fxmaspi",[18],"XMAS-PI"," (golang - interaction with ws2811)",[25,34,35,40],{},[14,36,39],{"href":37,"rel":38},"https:\u002F\u002Fgithub.com\u002FEldoranDev\u002FChristmasPortal",[18],"ChristmasPortal"," (csharp - interaction with lego toypad)",[10,42,43],{},"This year two additions where made to the existing infrastructure:",[45,46,47,56],"ol",{},[25,48,49,50,55],{},"Moving away from a custom user interface and api in favor of HomeAssistant integration through MQTT (",[14,51,54],{"href":52,"rel":53},"https:\u002F\u002Fwww.home-assistant.io\u002Fintegrations\u002Flight.mqtt\u002F",[18],"MQTT Light",")",[25,57,58],{},"Adding a Lego ToyPad as physical interface",[60,61,63],"h2",{"id":62},"replacing-the-custom-ui-with-homeassistant","Replacing the Custom UI with HomeAssistant",[10,65,66,67,72],{},"The last two years, I used a ",[14,68,71],{"href":69,"rel":70},"https:\u002F\u002Fnuxtjs.org\u002F",[18],"nuxt"," based frontend application that ran on the same pi as the xmaspi go application (and communicated through grpc) to control the lights.",[10,74,75],{},"To remove complexity from the application, while also allowing for automations, scenes and easy control I decided trying to integrate my service with HomeAssistant, which I have running for some simple automations and data collection anyway.",[10,77,78,79,83,84,87,88,93,94,99],{},"This caused a major rewrite of the application as a very big chunk of the current code could get removed in favor of a much leaner alternative. Everything related to interaction with the service (",[80,81,82],"code",{},"grpc",", ",[80,85,86],{},"rest-api",") got replaced by the ",[14,89,92],{"href":90,"rel":91},"https:\u002F\u002Fgithub.com\u002Feclipse-paho\u002Fpaho.golang\u002Ftree\u002Fmaster\u002Fautopaho",[18],"AutoPaho"," MQTT client, which handles connection, automatic reconnection and subscriptions. Adding discovery messages according to the ",[14,95,98],{"href":96,"rel":97},"https:\u002F\u002Fwww.home-assistant.io\u002Fintegrations\u002Fmqtt\u002F#mqtt-discovery",[18],"HomeAssistant documentation"," allows the service to automatically show up in the managed devices without any extra configuration.",[10,101,102],{},[103,104],"img",{"alt":105,"src":106},"screenshot from homeassistant device overview","images\u002Fposts\u002F2024-xmaspi\u002Fmqtt-discovery.png",[10,108,109],{},"This already allows full control through home assistant, like automaticly turning the leds on\u002Foff based on some conditions.",[60,111,113],{"id":112},"adding-a-lego-toypad-as-phyical-interface","Adding a Lego ToyPad as Phyical Interface",[10,115,116,117,122,123,128],{},"For an even simpler interaction with the service I decided to use one of the Lego Dimensions ToyPad, that I recieved from ",[14,118,121],{"href":119,"rel":120},"https:\u002F\u002Fgithub.com\u002Ftomwendel",[18],"Tom Wendel"," as part of his ",[14,124,127],{"href":125,"rel":126},"https:\u002F\u002Fgithub.com\u002FWendelpunkt\u002FToypadChallenge",[18],"ToypadChallenge",", as a switch for the lights.",[10,130,131,132,137,138,143],{},"For this I implemented a small service in csharp using the ",[14,133,136],{"href":134,"rel":135},"https:\u002F\u002Fwww.nuget.org\u002Fpackages\u002FLegoDimensions",[18],"LegoDimensions"," and ",[14,139,142],{"href":140,"rel":141},"https:\u002F\u002Fwww.nuget.org\u002Fpackages\u002FMQTTnet",[18],"MQTTnet"," NuGet packages. Currently the service is fully targeted towards the xmaspi software and sends messages directly to the mqtt topic that controls it, leading to the following architecture right now:",[10,145,146],{},[103,147],{"alt":148,"src":149},"structure of the software","images\u002Fposts\u002F2024-xmaspi\u002Fstructure.png",[60,151,153],{"id":152},"future-improvements","Future Improvements",[10,155,156],{},"One of the next steps, even if not directly related to this project, will be the generalization of the ToyPad as its own MQTT Device that will send and receive messages through MQTT and could therefore be integrated into HomeAssistant. This would allow the ToyPad to be part of automations, and simply reconfiguring the actions on the pads as it would not require a recompilation and redeployment of the software to take effect.",{"title":158,"searchDepth":159,"depth":159,"links":160},"",2,[161,162,163],{"id":62,"depth":159,"text":63},{"id":112,"depth":159,"text":113},{"id":152,"depth":159,"text":153},"\u002Fimages\u002Fposts\u002F2024-xmaspi\u002Fheader.png","2024-11-25","Summary of the yearly tinkering with my christmas tree fairy lights","md",{},true,"\u002Fblog\u002F2024-11-xmas-pi",{"title":5,"description":166},"blog\u002F2024-11-xmas-pi",[174,175],"raspberry-pi","lego-toypad","TZ4FH1rL4mirkj0S_yI5aIpv5cPNhI8UVMcy_b61Rhs",1783361547514]