AlexxIT / HassWP

Portable version of Home Assistant for Windows (no need to install)
https://github.com/AlexxIT/Blog
594 stars 75 forks source link

Sharing Windows support work #34

Closed dcoder42 closed 2 years ago

dcoder42 commented 2 years ago

I've been using HomeAssistant on Windows with Python 3.9 for half a year now and since a few monts i needed to patch every update to make it run. These were basically minor changes to file.py, serial socket for zha and disabling DHCP using your custom_components override. As you probably know, the home assistant devs decided to remove all the native Windows workarounds for the 2022 release. It's more work now to support Windows.

I am asking myself if there is any interest to share the work on the Windows support. I was thinking of forking the core repository, reverting all the dropped Windows submits and adding the additional changes. Basically one place where everyone caring about native Windows support can submit changes.

Is there any interest in this?

AlexxIT commented 2 years ago

Next HassWP release will have special runner. It can run any Hass version without patches.

dcoder42 commented 2 years ago

Interesting. How is this going to work? WSL?

AlexxIT commented 2 years ago

Check it. You can join the development, if you wish. python -m hass_win

https://github.com/AlexxIT/HassWP/blob/master/hass_win/__main__.py

dcoder42 commented 2 years ago

Nice! I didn't know that it's possible to override function calls in python. I tried your launcher and it started nicely but i failed to run the configuration process in the Web UI. This reverted commit is needed on my machine: https://github.com/home-assistant/core/commit/64bcd6097457b0c56528425a6a6ce00a2bce791c

I added the following to your launcher and i was able to finish the setup process:

import mimetypes
mimetypes.add_type("text/css", ".css")
mimetypes.add_type("application/javascript", ".js")

I think the reverted ping sensor and wake_on_lan workarounds might also need some additional code in your launcher: https://github.com/home-assistant/core/commit/0fa4f616ed6e3d0be423c8b6ffe6fe71e068a739 https://github.com/home-assistant/core/commit/abce453b5c442e70a38b84b4ceba73537af08a34

Not sure what is actually required by this revert: https://github.com/home-assistant/core/commit/b3421cf72767196cd80c1bc4ff4c1cc5d6ee5163

What does the following actually fix?

dt.get_time_zone = lambda _: dt.DEFAULT_TIME_ZONE

I remember i had issues with my own python environment to finish the Home Assistant configuration process because of a timezone error but i think i fixed this by installing the tzdata package.

AlexxIT commented 2 years ago

Interesting. I don't have problems with mimetypes.

For wake_on_lan it may be easier to use old version with custom_component.

get_time_zone fail on first Hass setup.