toddaustin07 / edgebridge

Forwarding Bridge Server for SmartThings Edge drivers
Apache License 2.0
39 stars 19 forks source link

Windows Service rather than console app? #9

Open paultobey opened 1 year ago

paultobey commented 1 year ago

Everything works well for my "online" tester for SmartThings, but I'd rather not have a console window open all the time running the service. A Windows service seems like the right improvement for me allowing run without any UI, automatic restart/recovery on crash, etc. Obviously I can build a service designed to run the existing Windows EXE without much trouble but wonder if you'd be interested in implementing that directly. I'll whip up a wrapper service and look forward to your thoughts...

toddaustin07 commented 1 year ago

Definitely willing to consider it, especially if you have the details required. I've not looked at myself.

BTW, I think someone posted in the community topic some instructions for getting things to work as a service in Windows, so you might want to look for that also. It was sometime earlier this year.

paultobey commented 1 year ago

Hmmm. Didn't see that when searching; will take a look. Here's some working code running the EXE as-is (in a very-specific folder structure ;-)). It works for now for me. If the code were all part of the service it would be a bit easier to manage/install/startup/recover on failure, etc.

EdgeBridgeSmartThingsServiceWrapper.zip

CHeil402 commented 1 year ago

Fyi, for another project I've used NSSM which can be used to turn any executable into a Windows service... https://nssm.cc/

paultobey commented 1 year ago

I've seen it and may try it at some point.

I work with services all day so doing it at the bare metal is more-familiar and gives me more control, I guess.

Thanks!

toddaustin07 commented 1 year ago

Guys - I've been knee-deep developing another driver right now, so it may be until next week before I can even take a look at all the good stuff you are sharing here. Just wanted to let you know that my silence doesn't mean dis-interest!

paultobey commented 1 year ago

No worries! Everything is running reliably for me through various network changes, etc.

toddaustin07 commented 1 year ago

So I finally got a chance to look at your zip file and my first impression is that I understand little of it :-) So it's not something I'm keen to make part of this repository, as I certainly cannot providing any level of support for it - including just answering questions. Not sure how much of this one could make available as a turn-key installation, because the other concern I have is that most (but not all) of my users are SmartThings end-users with limited, technical skills.

I think it's great you have the knowledge to do this though, and what I would like to ask is if you could post this to your own repository so I could reference it from here. Then users could decide whether it's something want to tackle vs. going with something like NSSM.

Let me know your thoughts.

paultobey commented 1 year ago

@toddaustin07 No problem. I'll work on that in a free moment and let you know. Thanks for building the structure making it possible!