1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-03 11:52:20 +01:00

Add device_id to entity state messages for sub-device support (#9304)

This commit is contained in:
J. Nick Koston
2025-07-03 19:31:03 -05:00
committed by GitHub
parent eef71a79da
commit 14d7c4bdbd
7 changed files with 530 additions and 21 deletions

View File

@@ -292,6 +292,9 @@ class APIConnection : public APIServerConnection {
// Helper function to fill common entity state fields
static void fill_entity_state_base(esphome::EntityBase *entity, StateResponseProtoMessage &response) {
response.key = entity->get_object_id_hash();
#ifdef USE_DEVICES
response.device_id = entity->get_device_id();
#endif
}
// Non-template helper to encode any ProtoMessage