mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Optional section at start of obis code
This commit is contained in:
parent
7a91ca9809
commit
c2df7a9d55
1 changed files with 1 additions and 1 deletions
|
@ -32,7 +32,7 @@ async def to_code(config):
|
|||
|
||||
def obis_code(value):
|
||||
value = cv.string(value)
|
||||
match = re.match(r"^\d{1,3}-\d{1,3}:\d{1,3}\.\d{1,3}\.\d{1,3}$", value)
|
||||
match = re.match(r"^(?:\d{1,3}-\d{1,3}:)?\d{1,3}\.\d{1,3}\.\d{1,3}$", value)
|
||||
if match is None:
|
||||
raise cv.Invalid(f"{value} is not a valid OBIS code")
|
||||
return value
|
||||
|
|
Loading…
Reference in a new issue