plugwise / Plugwise-Smile

Plugwise module for Smiles (Anna, Adam, P1)
MIT License
4 stars 3 forks source link

[BUG] Fix minor version allowance with fallback to latest minor version supported (CLOSED/FUTURE REFERENCE) #109

Closed CoMPaTech closed 4 years ago

CoMPaTech commented 4 years ago
-            _LOGGER.error(
-                'Your version Smile identified as "%s" \
-                          seems unsupported by our plugin, please create \
-                          an issue on github.com/plugwise/Plugwise-Smile!\
-                          ',
+            _LOGGER.info('Firmware "%s" not officially supported yet', target_smile)
+            target_smile_major = f"{smile_model}_v{ver['major']}"
+            target_smile = [key for key in SMILES if target_smile_major in key.lower()][0]
+            if target_smile not in SMILES:
+                _LOGGER.error(
+                    'Your version Smile identified as "%s" \
+                              seems unsupported by our plugin, please create \
+                              an issue on github.com/plugwise/Plugwise-Smile!\
+                              ',
+                    target_smile,
+                )
+                raise self.UnsupportedDeviceError
+
+            _LOGGER.info(
+                'Using "%s" for your smile, please create \
+                        an issue on github.com/plugwise/Plugwise-Smile!\
+                        ',
+                target_smile,
+            )
-            raise self.UnsupportedDeviceError