Skip to content

OK, he will need some explanation! – Persistent variable

OK, he will need some explanation! – Persistent variable

Hey, guys, so I had this idea to do a simple check to ride your bike through a number of radio stations on your HomePod at the push of a button. The functionality I wanted was the following … I have a hue switch button that, when I press a button, turns on my HomePod with a radio. In fact, it does more in automation, but that’s not important. I thought it would be great to extend this, so that if I press the button again, it will go to another station and practically go through 4 or 5 stations. I need to work inside the HomeKit, rather than shortcuts on an iOS device, only if others want to use it, so my first thought was to set up a shortcut in the home app using “convert to shortcut”. Anyone who has tried such shortcuts knows that it is much more limited than regular shortcuts. I needed a way to remember which station it was actually playing, and because I couldn’t find a way to persistently store the variables, I decided to make a basic node.js server running on my home Linux server. This worked great and I created some code to rotate an integer and return the next “station”. So basically I would set a URL “http: // myserver: 8004? Variable = station & low = 1 & high = 5 ”This returns a JSON object that I can read as a dictionary and get the next value in rotation. This worked great when testing shortcuts, but it looks like you can’t use non SSL in HomeKit shortcuts. I have no idea if it’s even possible to set up SSL on a basic home server, because I don’t want to expose it directly to the internet. Does anyone have any suggestions on how I could accomplish this? I could very well complicate automation too much. Do I just need a way to switch between homePod radio stations at the touch of a button and would I like to hear suggestions? Luck