I have a sensor set to pull tasmota firmware versions. The version number it gets back comes back as something like “6.5.0”. I have another sensor that pulls current firmware from all my tasmota devices, but it comes back as something like “6.5.0(release-sonoff)” I tried the following:
- platform: mqtt
name: "Sonoff S31-9 Firmware version"
state_topic: "stat/sonoffS31-9/STATUS2"
value_template: "{{ value_json['StatusFWR'].Version | regex_search('^[0-9]\\.{1,2}[0-9]\\.{1,2}[0-9]{1,2}', ignorecase=TRUE) }}"
qos: 0
availability_topic: "tele/sonoffS31-9/LWT"
payload_available: "Online"
payload_not_available: "Offline"
but that just returns “True” because it matches. Basically I want to extract just the X.X.X version from the front of the string, and strip off the rest. The problem is I dont know what the next version will be (might be 6.10.2, might be 6.6.10(silly-rabbit), etc)
According to https://www.home-assistant.io/docs/configuration/templating/ there are very few regular expression options.
Thanks.