Add string comparison for Update platform #1130
-
Current implementation of version comparison is based on AwesomeVersion: For some devices, ex. Shelly gen 1 devices, this always fails with Strings are as follow:
Note: Shelly gen2/3 devices work fine as the strings are " Proposed change is to introduce the ability to make a pure string comparison. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Another option could be to introduce 2 new methods that are optionally implemented by each integration:
and modify only the state method: latest_version_parsing = self.latest_version_parsing or self.latest_version
installed_version_parsing = self.installed_version_parsing or self.installed_version
try:
newer = _version_is_newer(latest_version_parsing, installed_version_parsing)
except AwesomeVersionCompareException:
# Can't compare versions, already tried exact match
return STATE_ON
return STATE_ON if newer else STATE_OFF |
Beta Was this translation helpful? Give feedback.
-
Another proposal: Make the |
Beta Was this translation helpful? Give feedback.
Another proposal: Make the
_version_is_newer
function a method ofUpdateEntity
so integrations can override it. Would that work @chemelli74 ?