Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CrowAlarmPanel::send_message_to_ha_(uint8_t type, std::vector<uint8_t> data) {
- api::HomeassistantServiceResponse resp;
- resp.service = "esphome.alarm_panel_message";
- resp.is_event = true;
- char buf[64];
- sprintf(buf, "0x%02x", type);
- api::HomeassistantServiceMap type_map;
- type_map.key = "type";
- type_map.value = buf;
- resp.data.push_back(type_map);
- api::HomeassistantServiceMap data_map;
- data_map.key = "data";
- data_map.value = hexencode(data);
- resp.data.push_back(data_map);
- api::global_api_server->send_homeassistant_service_call(resp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement