enbility / eebus-go

EEBUS protocol implementation in go
https://enbility.net
MIT License
52 stars 14 forks source link

Sub entity support #96

Closed heavyweight87 closed 1 month ago

heavyweight87 commented 1 month ago

Hi, As some devices have sub entities (heatpump entity with compressor sub entitty for example) I wondered if there was an easy way to support sub entities? From what I see there currently isn't support for this

Do you think there is an easy way to add it?

DerAndereAndi commented 1 month ago

Hi, this is already supported.

Example code for an EV added to an EVSE:

localDevice := c.eebusService.LocalDevice()
evseEntity := localDevice.EntityForType(model.EntityTypeTypeEVSE)

// EV
evseAddress := evseEntity.Address().Entity[0]
evEntity := spine.NewEntityLocal(localDevice, model.EntityTypeTypeEV, []model.AddressEntityType{evseAddress, 1})