kubawolanin / ha-openhab

WORK IN PROGRESS 🏠 openHAB custom integration for Home Assistant
MIT License
15 stars 5 forks source link

service for sending command / update item #4

Closed kubawolanin closed 2 years ago

kubawolanin commented 2 years ago


    def handle_send_command(call):
        """Handle the service call."""
        item_name = call.data.get("item_name")
        command = call.data.get("command")
        coordinator.api.async_send_command(item_name, command)
        hass.states.set("openhab.send_command", item_name, command)

    hass.services.register(DOMAIN, "send_command", handle_send_command)

    def handle_update_item(call):
        """Handle the service call."""
        item_name = call.data.get("item_name")
        state = call.data.get("state")
        coordinator.api.async_update_item(item_name, state)
        hass.states.set("openhab.update_item", item_name, state)

    hass.services.register(DOMAIN, "update_item", handle_update_item)
github-actions[bot] commented 2 years ago

Stale issue message