sHedC / python-masterthermconnect

MasterTherm HeatPump API
MIT License
3 stars 2 forks source link

Improve command line output for easier debugging #59

Closed johny-mnemonic closed 1 year ago

johny-mnemonic commented 1 year ago

In case you don't like adding new dependency for the natural sorting, it can be done by few lines of code like this:

import re

convert = lambda text: float(text) if text.isdigit() else text
alphanum = lambda key: [convert(c) for c in re.split('([-+]?[0-9]*\.?[0-9]*)', key)]
sorted(device_reg.keys(), key=alphanum)

Fixes #52

johny-mnemonic commented 1 year ago

@sHedC could I ask how do you install this for testing purposes? I tried both the old setup.py method and also the more modern pip install -e . but both were failing and installing package with the name UNKNOWN. I convinced it to install by editing the setup.py with these changes:

 if __name__ == "__main__":
-    setup()
+    setup(
+        name='masterthermconnect',
+        packages=['masterthermconnect'],
+    )

But I am python noob so no clue if this is correct approach. In case it is I can send PR with the change.

sHedC commented 1 year ago

@johny-mnemonic - Both myself and sebz are using visual Studio code and dockers. Sebz is using windows and docker I am using Fedora and podman which is a bit harder to setup as VS Code is geared towards docker.

I have put a read me under .devcontainer folder that describes most of what I did. Once setup it sets everything up needed and installs in edit mode ready to go.

johny-mnemonic commented 1 year ago

@sHedC I see. That explains why the setup.py is so barren 😃 I have both, personal Windows PC and Fedora work laptop so I can try both setups. So far I have containers everywhere else, but not on the personal computers :-)

sHedC commented 1 year ago

Yeh I have always used containers or vm's as hate installing loads of stuff on my machines. setup.py is barren because I also had no idea about python until about 3 months ago :)

sHedC commented 1 year ago

or github

johny-mnemonic commented 1 year ago

That needed some brave pills then ;-) Respect!

sHedC commented 1 year ago

quick learner :)