Repository: broox/python-nuheat (language: python)

Issue:
Mape Heat Alternative URL
NuHeat was recently rebranded as Mape Heat and has correspondingly changed their domain name. It seems likely that the API at the new URL is the same as the old one, but registration with new devices under the new brand happens there instead. I believe that old devices will continue to function at the old NuHeat domain.

Old API URL: https://mynuheat.com/api OR https://www.mynuheat.com/api (with optional www subdomain)
New API URL: https://mymapeheat.com/api OR https://www.mymapeheat.com/api (with optional www subdomain)

Since it appears that both URLs should be supported for the time being, it would be ideal if the choice were an option in config.py or taken as an argument to the NuHeat() constructor.


Discussion / hints:
I'm trying to use the [NuHeat HA integration](https://www.home-assistant.io/integrations/nuheat/) for my new thermostat, which uses this library for the connection and control. Unfortunately my new thermostat is Mape Heat branded and is registered through the new domain so I'm stuck for the moment.

Before I put any more energy into making this library work I'd like to know if you're considering PRs or interested in maintaining it yourself. I'd like to get my thermostat working so either way I'm likely to fork this repo and make some changes but if you'd consider a PR I'll put a little more work into making it configurable, whereas if you wouldn't then I'll just edit the URL for my own use.

Thanks for your work to get this running a few years ago! :)
PRs are definitely welcome!
Any update on this getting support in? I too would like to use MapeHeat with Home Assistant.
I apologize; this fell completely off my radar. @dapostol73's comments on my PR are pretty manageable so I'll try to get to them in the next couple of weeks. It'd be good to finally get this merged so it can be picked up by HA.
@brab - let me know if i can help! also, would you mind rebasing your branch from `master`? i've added some github workflows to automate testing. thanks!
@brab is there any way I can test these changes...happy to help verify it works.
Hey folks. Sorry for the major delay on this one. I left on vacation shortly after my last comment and then came down with a fairly bad case of COVID. I did take a look at it a few weeks back and it shouldn't be too bad to refactor and get to a merge-ready state, I just need to find some time to get to it.

Fix patch:
diff --git a/README.md b/README.md
index 391ea14..54cfa40 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,8 @@
 
 A Python 3 library that allows control of connected [NuHeat Signature](http://www.nuheat.com/products/thermostats/signature-thermostat) radiant floor thermostats.
 
+This also supports the **Mapei MapeHeat** line of smart thermostats.
+
 * This uses the web-based NuHeat API, so it requires an external internet connection
 * The API in use is not an officially published API, so it could change without notice
 * Please contribute!
@@ -28,6 +30,10 @@ from nuheat import NuHeat
 api = NuHeat("email@example.com", "your-secure-password")
 api.authenticate()
 
+# Initialize an API session for a specific brand
+api = NuHeat("email@example.com", "your-secure-password", brand="MAPEHEAT")
+api.authenticate()
+
 # Fetch a thermostat by serial number / ID. This can be found on the NuHeat website by selecting
 # your thermostat and noting the Thermostat ID
 thermostat = api.get_thermostat("12345")
diff --git a/setup.py b/setup.py
index 84cff69..51ee590 100644
--- a/setup.py
+++ b/setup.py
@@ -6,14 +6,14 @@
 setup(
   name='nuheat',
   packages=['nuheat'],
-  version='1.0.1',
-  description='A Python library that allows control of connected NuHeat Signature radiant floor thermostats.',
+  version='1.1.0',
+  description='A Python library that allows control of connected NuHeat Signature and Mapei Mapeheat radiant floor thermostats.',
   long_description=long_description,
   long_description_content_type="text/markdown",
   author='Derek Brooks',
   author_email='derek@broox.com',
   url='https://github.com/broox/python-nuheat',
-  download_url='https://github.com/broox/python-nuheat/archive/1.0.1.tar.gz',
+  download_url='https://github.com/broox/python-nuheat/archive/1.1.0.tar.gz',
   license='MIT',
   keywords=['nuheat', 'thermostat', 'home automation', 'python'],
   classifiers=[


Test patch:
diff --git a/tests/test_nuheat.py b/tests/test_nuheat.py
index 69f105a..878faba 100644
--- a/tests/test_nuheat.py
+++ b/tests/test_nuheat.py
@@ -19,7 +19,7 @@ class TestNuHeat(NuTestCase):
         ("MAPEHEAT", "mymapeheat.com"),
     ])
     def test_brands(self, brand, hostname):
-        api = NuHeat("test@example.com", "secure-password", session_id=None, brand=brand)
+        api = NuHeat("test@example.com", "secure-password", brand=brand)
         self.assertEqual(api._hostname, hostname)
         self.assertEqual(api._api_url, f"https://{hostname}/api")
         self.assertEqual(api._auth_url, f"https://{hostname}/api/authenticate/user")
diff --git a/tests/test_thermostat.py b/tests/test_thermostat.py
index 475f387..3dac0d9 100644
--- a/tests/test_thermostat.py
+++ b/tests/test_thermostat.py
@@ -30,7 +30,7 @@ def test_init(self, _):
     ])
     @patch("nuheat.NuHeatThermostat.get_data")
     def test_brand_urls(self, brand, hostname, _):
-        api = NuHeat(None, None, session_id=None, brand=brand)
+        api = NuHeat(None, None, brand=brand)
         serial_number = "serial-123"
         thermostat = NuHeatThermostat(api, serial_number)
         self.assertEqual(thermostat._url, f"https://{hostname}/api/thermostat")