genielabs / HomeGenie

HomeGenie, the programmable automation intelligence
https://homegenie.it
GNU General Public License v3.0
387 stars 154 forks source link

Home Genie Windows Service #470

Closed dakriege closed 8 months ago

dakriege commented 9 months ago

I have headless server that I need to run HomeGenie on. The homegenie.exe runs but requires a login due to the application being a console app. When I do a fresh boot, the .exe launches but the web interface does not respond. I have to reboot and try again. Sometimes several times. I noticed that the HomeGenie Windows Service project is deprecated. Is there some other means that I don't see in your documentation that I can run HomeGenie as a Windows Service and start it when the server boots? Typically I'll build and test using a console app then create a service project.

genemars commented 9 months ago

I haven't tested this, but the sc.exe system command might do the trick: https://github.com/dotnet/docs/blob/main/docs/core/extensions/windows-service.md#create-the-windows-service

sc.exe create "HomeGenie Service" binpath="C:\Path\To\HomeGenie.exe"

Then you should be able to start/stop HomeGenie service like any other service. And about the web interface not responding, I think this might be related to firewall/antivirus related restrictions. See also my reply to the #469 issue.

dakriege commented 9 months ago

Thank you for the prompt reply.

I ran the sc.exe application to install the Service.

The service starts and then stops.

Here is the Windows event information.

Here’s what I found on the Web interface not responding.

I’m not sure if the Port to use is saved in another file other than the systemconfig file.

I’m using Home Genie to control (5) motorized shades.

Home Genie pairs with the Shades and sets up a Dimmer control. (Multi-Switch). It works to raise and lower the shades.

Is there a way to create a profile for a window shade ?

From: Gene @.> Sent: Wednesday, October 4, 2023 5:03 AM To: genielabs/HomeGenie @.> Cc: dakriege @.>; Author @.> Subject: Re: [genielabs/HomeGenie] Home Genie Windows Service (Issue #470)

I haven't tested this, but the sc.exe system command might do the trick: https://github.com/dotnet/docs/blob/main/docs/core/extensions/windows-service.md#create-the-windows-service

sc.exe create "HomeGenie Service" binpath="C:\Path\To\HomeGenie.exe"

Then you should be able to start/stop HomeGenie service like any other service. And about the web interface not responding, I think this might be related to firewall/antivirus related restrictions. See also my reply to the #469 https://github.com/genielabs/HomeGenie/issues/469 issue.

— Reply to this email directly, view it on GitHub https://github.com/genielabs/HomeGenie/issues/470#issuecomment-1746546926 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDU3TBLZE2C5ASRMLIR6F3X5UX5FAVCNFSM6AAAAAA5Q5PPRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBWGU2DMOJSGY . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AGDU3TBIPZ52F2CE4ZE6KXDX5UX5FA5CNFSM6AAAAAA5Q5PPRKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTIDIYO4.gif Message ID: @. @.> >

-- This email has been checked for viruses by AVG antivirus software. www.avg.com

genemars commented 9 months ago

Here is the Windows event information.

I can't see any event info in your message.

Is there a way to create a profile for a window shade ?

I will add a specific widget for controlling shades in the next release. What is the brand/model of your z-wave shades control? It can eventually help me figure out if there's a way to automatically detect the specific type instead of a generic multi-level switch. Otherwise you will have to manually set the device type clicking the "Edit" option in the widget options menu.

I restarted Home Genie. It kept reverting back to 8080.

I guess you didn't stop the service before editing the systemconfig.xml file, so hg overwrote your modifications to the systemconfig.xml file when stopping/restarting.

dakriege commented 9 months ago

I included pictures of the Windows event log.

Was there an option to download pictures in the email?

As I mentioned you’ll probably need a command line switch or xml parameter to put the .exe in a non-verbose mode.

The shades are from Smartwings.

https://www.smartwingshome.com/products/smartwings-motorized-outdoor-shades-5-openness

I’m using the ZWave motor.

The Manufacturer ID from the fields from one of the shades.

045A:0904:0507

The way it works now with the Dimmer object

Off = Close

On = Open

The Dimmer slider tells the shade to partially close or open.

From: Gene @.> Sent: Wednesday, October 4, 2023 7:32 AM To: genielabs/HomeGenie @.> Cc: dakriege @.>; Author @.> Subject: Re: [genielabs/HomeGenie] Home Genie Windows Service (Issue #470)

Here is the Windows event information.

I can't see any event info in your message.

Is there a way to create a profile for a window shade ?

I will add a specific widget for controlling shades in the next release. What is the brand/model of your z-wave shades control? It can eventually help me figure out if there's a way to automatically detect the specific type instead of a generic multi-level switch. Otherwise you will have to manually set the device type clicking the "Edit" option in the widget options menu.

I restarted Home Genie. It kept reverting back to 8080.

I guess you didn't stop the service before editing the systemconfig.xml file, so hg overwrote your modifications to the systemconfig.xml file when stopping/restarting.

— Reply to this email directly, https://github.com/genielabs/HomeGenie/issues/470#issuecomment-1746782622 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/AGDU3THDFPFPKMZC3FDGTADX5VJLXAVCNFSM6AAAAAA5Q5PPRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBWG44DENRSGI unsubscribe. You are receiving this because you authored the thread. https://github.com/notifications/beacon/AGDU3TARBOWYIDA4WTZCJHLX5VJLXA5CNFSM6AAAAAA5Q5PPRKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTIDXEZ4.gif Message ID: < @.> @.>

-- This email has been checked for viruses by AVG antivirus software. www.avg.com

genemars commented 9 months ago

The images your sending via e-mail are not shown here. So please use the GitHub website. Anyway I think I now know how to add a specific widget for the shades motor, but I need one more information. Click on the widget options and select "Edit", then change the type to Swicth. You should now see two buttons for ON and OFF commands. Press the ON button, the shade will start to open. My question is: does it stop if you issue again the ON command (or the OFF one)?

genemars commented 8 months ago

Hi @dakriege I just published a new release (HomeGenie 1.4.0-beta.58). This new release adds the Shutter widget that should work for the shades control as well. Even if your Z-Wave device is recognized as a Dimmer you can manually set the type to Shutter using the Edit option. Let me know if this works for you or if there is something that could be improved.

dakriege commented 8 months ago

Here are the pictures of the Windows event log when trying to convert the console app to a service and starting it.

image

image

image

genemars commented 8 months ago

Thanks for the screenshots, I've just published a new release (v1.4.0-beta.59) that might fix this issue. Let me know if this is fixed now and if the new shutter widget works with your z-wave shades control device.

dakriege commented 8 months ago

I installed Beta 59. The Service seems to be working ok. Thanks for the quick fix !

I changed the Shade widgets from Dimmers to the new Shutter type The Open and Close works. The Slider doesn't seem to work. If I move the slider and press Calibrate nothing happens. I tried it with the Shade open and closed. When I had it set up as a Dimmer switch, if I moved the Slider the Shade would follow the position.

I did a remote desktop into my Server and used Chrome to set up the new Beta 59. This is what the new Shutter Widgets look like.

image

When I use Chrome on my Laptop the Widgets look different. I cleared the Chrome cache and reloaded the page.

image

BTW I have the Web api working with my Server. Works great ! Plan is to integrate the Shades into our Home Portal. I have several Arduinos monitoring various data points that feed Dashboards. We can monitor the data remotely when we are traveling. For the Shades I'm going to integrate Rain and Wind sensors so I can control them from the Server.

genemars commented 8 months ago

Hi, glad to hear the Windows Service issue is now solved.

I will fix the bug with Shutter widget reverting to Switch in the next few days. In the meantime it can be helpful to know if setting the type to Dimmer makes the slider works again.

The calibration is not working because each manufacturer use a different parameter and currently only two kind of device are automatically detected:

You should be still able to set the parameter number to use by editing the ZWaveNode.Calibration field (Edit and then click on Fields button). If you let me know which parameter number is I could add it to the auto-detected list. This should be in the end-user manual of your z-wave device.

Feel free to close this issue and open a new one about the Shutter Widget issues we are discussing here.

dakriege commented 8 months ago

Thank you for your support ! This is a very nice product you have developed

genemars commented 8 months ago

Hi @dakriege , I just published a new release that should fix the level and calibration issues of the Shutter widget. Let me know if everything works now or if there are improvements/fixes that could be done.