<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->
## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
CC: @Penait1
## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#
## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->
## Summary
Changed the implementation of `getEntities(matching string: String? =
nil)` to return an array of key values pairs instead of a dictioniary.
The intent of the function seems to return a sorted list of entities
grouped by server name since the servers are sorted
`Current.servers.all.sorted(by: { $0.info.name < $1.info.name })`. A
dictioniary does not guarantee order, resulting in unpredicting results
in my `Sensor` widget configure window. Sometimes one server is first,
the next time the other.
Apple also recommends using a KeyValuePair when order is important:
https://developer.apple.com/documentation/swift/keyvaluepairs
`Use a KeyValuePairs instance when you need an ordered collection of
key-value pairs and don’t require the fast key lookup that
the Dictionary type provides.`
Because there are typically (I think?) not many servers configured the
loss of fast lookup seems acceptable to me.
## Screenshots
Here an overview of the `getEntities` function while debugging showing
the problem. I adjusted the function slightly to temp store the values,
`servers` contains the value of `Current.servers.all.sorted(by: {
$0.info.name < $1.info.name })` The entitiesPerSever does not have the
same order as the `servers` variable, while they should have

## Any other notes
This is also an issue for other widgets like the script widget. I only
fixed the function in `IntentSensorsAppEntity` though
, they have the same problem in the calling function because they return
an dictionary not preserving order;
`private func getScriptEntities(matching string: String? = nil) ->
[Server: [IntentScriptEntity]] {`
## Summary
Fixed two issues mentioned in #3067;
Sensors in the suggested sensors view should be grouped by server now
The order of the selected sensors is now respected if they come from two
different servers
## Screenshots

## Any other notes
The `for` loop bothers me, Swift feels a lot like Kotlin and a `map`
seems more appriopiate.
Because an async call happens in it I could not get `map` working that
is nice to read, let me know if there is a better option chatgpt gave me
this
```
let sensorValues = try await withThrowingTaskGroup(of: WidgetSensorsEntry.SensorData?.self) { group in
for sensor in configuration.sensors ?? [] {
group.addTask {
guard let server = Current.servers.all.first(where: { $0.identifier.rawValue == sensor.serverId }) else {
throw WidgetSensorsDataError.noServers
}
return try await fetchSensorData(for: sensor, server: server)
}
}
return try await group.compactMap { $0 }
}
```