Skip to content

Commit

Permalink
Merge pull request #45 from sh00t2kill/fix-volume-name-matching-issue
Browse files Browse the repository at this point in the history
Added / to handled name cases
  • Loading branch information
sh00t2kill authored Apr 19, 2024
2 parents 50b6371 + e08f7c7 commit f2d4a2d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions custom_components/linktap/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import logging
import random
import re

import aiohttp
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -82,14 +83,12 @@ def name(self):

@property
def duration_entity(self):
name = self._name.replace(" ", "_")
name = name.replace("-", "_")
name = re.sub('[^0-9a-zA-Z]+', '_', self._name)
return f"number.{DOMAIN}_{name}_watering_duration".lower()

@property
def volume_entity(self):
name = self._name.replace(" ", "_")
name = name.replace("-", "_")
name = re.sub('[^0-9a-zA-Z]+', '_', self._name)
return f"number.{DOMAIN}_{name}_watering_volume".lower()

async def async_turn_on(self, **kwargs):
Expand Down

0 comments on commit f2d4a2d

Please sign in to comment.