Skip to content

Commit

Permalink
Alpha 09 (#98)
Browse files Browse the repository at this point in the history
* Bump the revision.

* Fix set availability service.
  • Loading branch information
twrecked committed Feb 4, 2024
1 parent 63d77d9 commit 6482e19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.9.0a9:
I forgot to bump the revision
Fix set availability service
0.9.0a8:
fix upgrade issue #2, use config functions not hard coded directory locations
0.9.0a7:
Expand Down
9 changes: 4 additions & 5 deletions custom_components/virtual/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from .cfg import BlendedCfg, UpgradeCfg


__version__ = '0.9.0a7'
__version__ = '0.9.0a9'

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -144,7 +144,8 @@ async def async_virtual_service_set_available(call) -> None:
if not hasattr(hass.data[COMPONENT_SERVICES], COMPONENT_DOMAIN):
_LOGGER.debug("installing handlers")
hass.data[COMPONENT_SERVICES][COMPONENT_DOMAIN] = 'installed'
hass.services.async_register(COMPONENT_DOMAIN, SERVICE_AVAILABILE, async_virtual_service_set_available)
hass.services.async_register(COMPONENT_DOMAIN, SERVICE_AVAILABILE,
async_virtual_service_set_available, schema=SERVICE_SCHEMA)

return True

Expand Down Expand Up @@ -194,13 +195,11 @@ def get_entity_from_domain(hass, domain, entity_id):


async def async_virtual_set_availability_service(hass, call):
entities = call.data['entity_id']
value = call.data['value']

if type(value) is not bool:
value = bool(util.strtobool(value))

for entity_id in entities:
for entity_id in call.data['entity_id']:
domain = entity_id.split(".")[0]
_LOGGER.info("{} set_avilable(value={})".format(entity_id, value))
get_entity_from_domain(hass, domain, entity_id).set_available(value)
2 changes: 1 addition & 1 deletion custom_components/virtual/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"documentation": "https://github.com/twrecked/hass-virtual/blob/master/README.md",
"iot_class": "local_push",
"issue_tracker": "https://github.com/twrecked/hass-virtual/issues",
"version": "0.9.0a6"
"version": "0.9.0a9"
}

0 comments on commit 6482e19

Please sign in to comment.