Rename the two nested `data` objects to `service_data` and `payload_data`

Proposal

I propose to

  • rename the outer data object to service_data (which it is often called in conversation anyways)

  • rename the inner data object to payload_data because it is the additional payload inside of the service_data.

Motivation

The fact that services are potentially called with two nested objects both named data did cost me hours of my time especially during my first years with Home Assistant.

I post this proposal to make handling those objects much less error prone for everybody but especially for beginners.

The most significant benefit would be the increased clarity in discussions and documentation regarding which object is being referred to. This would save a lot of time for those who (like me in many cases)

  • are not sure which data is referred to or worse
  • are not even aware of the fact that there is a second data object in addition to the one they have in mind

Details

Like we did with action these new names should be introduced as the new standard but data will probably still be valid for a very long time.

Variations

There is probably a more suitable name for the inner data object. data_inside_of_service_data is more self-explanatory but certainly a bit bulky.