Exemple #1
0
def fire_event(api, event_type, data=None):
    """Fire an event at remote API."""
    try:
        req = api(METHOD_POST, URL_API_EVENTS_EVENT.format(event_type), data)

        if req.status_code != 200:
            _LOGGER.error("Error firing event: %d - %s", req.status_code, req.text)

    except HomeAssistantError:
        _LOGGER.exception("Error firing event")
Exemple #2
0
def fire_event(api, event_type, data=None):
    """Fire an event at remote API."""
    try:
        req = api(METHOD_POST, URL_API_EVENTS_EVENT.format(event_type), data)

        if req.status_code != 200:
            _LOGGER.error("Error firing event: %d - %s", req.status_code,
                          req.text)

    except HomeAssistantError:
        _LOGGER.exception("Error firing event")