A basic implementation that now reachable scenes are connected to group and its behavior(based on applicationType).
@mtross please check if the scenesPerButtonId are valid for both default and ventilation behavior. Also still scenes in buttonId 15 and for black devices are interesting.
Closes #16340
Activity
Adding the names to the scenes is not really final - I reused the getSceneName from
eventinterpretersystemplugin
but the names are a little bit weird there. Please let me know if the names should be generic or group specific (for temperature and ventilation they will have different values and it makes requests only to zone more difficult - one scene number can have 2 names).added 21 commits
-
1e40ac44...96175088 - 20 commits from branch
dss:master
- 0fbd1781 - updated getReachableScenes for new groups, add scene names
-
1e40ac44...96175088 - 20 commits from branch
Rebased, reworked and squashed. Please take a look at current implementation:
- it uses different reachable scene tales for normal groups, ventilation, joker and temperature control
- it checks if the scene is active based on selected application type
- it returns names of the scene depending on current group (for temperature and ventilation names are redefined)
- it returns custom scene name if it is provided
I have change the C-style arrays for
static const std::map
to make it easier to manage the mappings, but this have of course runtime performance impact.Still WIP because I do not know if the buttonID-group-scene mappings are valid.
351 {SceneOnE2, "On-Preset21"}, {SceneOffE3, "Off-Preset30"}, {SceneOnE3, "On-Preset31"}, 352 {SceneOffE4, "Off-Preset40"}, {SceneOnE4, "On-Preset41"}, {SceneAutoOff, "Off-Automatic"}, 353 {SceneImpulse, "Impuls"}, {SceneDecA1, "Dec-Area1"}, {SceneIncA1, "Inc-Area1"}, {SceneDecA2, "Dec-Area2"}, 354 {SceneIncA2, "Inc-Area2"}, {SceneDecA3, "Dec-Area3"}, {SceneIncA3, "Inc-Area3"}, {SceneDecA4, "Dec-Area4"}, 355 {SceneIncA4, "Inc-Area4"}, {SceneLocalOff, "Off-Device"}, {SceneLocalOn, "On-Device"}, 356 {SceneStopA1, "Stop-Area1"}, {SceneStopA2, "Stop-Area2"}, {SceneStopA3, "Stop-Area3"}, 357 {SceneStopA4, "Stop-Area4"}, {SceneSunProtection, "Sunprotection"}, {SceneAutoStandBy, "AutoStandBy"}, 358 {ScenePanic, "Panic"}, {SceneEnergyOverload, "Overload"}, {SceneStandBy, "Zone-Standby"}, 359 {SceneDeepOff, "Zone-Deep-Off"}, {SceneSleeping, "Sleeping"}, {SceneWakeUp, "Wake-Up"}, 360 {ScenePresent, "Present"}, {SceneAbsent, "Absent"}, {SceneBell, "Bell"}, {SceneAlarm, "Alarm"}, 361 {SceneRoomActivate, "Zone-Activate"}, {SceneFire, "Fire"}, {SceneSmoke, "Smoke"}, {SceneWater, "Water"}, 362 {SceneGas, "Gas"}, {SceneBell2, "Bell2"}, {SceneBell3, "Bell3"}, {SceneBell4, "Bell4"}, {SceneAlarm2, "Alarm2"}, 363 {SceneAlarm3, "Alarm3"}, {SceneAlarm4, "Alarm4"}, {SceneWindActive, "Wind"}, {SceneWindInactive, "WindN"}, 364 {SceneRainActive, "Rain"}, {SceneRainInactive, "RainN"}, {SceneHailActive, "Hail"}, 365 {SceneHailInactive, "HailN"}, 366 }; - Resolved by Branislav Katreniak
- Resolved by Branislav Katreniak
- Resolved by Branislav Katreniak
185 foreach (auto&& sceneNr, filteredGroupScenes) { 186 // get the user defined scene name, or default one in case we do not find it 187 auto sceneName = group->getSceneName(sceneNr); 188 if (sceneName.empty()) { 189 sceneName = SceneHelper::getSceneName(sceneNr, group->getID()); 190 } 191 192 reachableScenes.push_back(sceneNr); 193 reachableScenesWithNames.push_back( 194 std::pair<int, std::string>(sceneNr, sceneName)); 195 } 196 } 150 197 } 198 199 // sort the scenes by value 200 std::sort(reachableScenes.begin(), reachableScenes.end()); the problem is that in case this call is executed without group id - so get reachable scenes for all groups in the zone then we can have one id with multiple strings (depending if group ventilation or Joker will be there). then we cannot directly use the
reachableScenesWithNames
there because it will contain repetitions and we will need to have local vector and run unique on it so it will be the same..I am open to suggestions but I did not find a viable alternative..
208 151 209 JSONWriter json; 152 210 json.startArray("reachableScenes"); 153 for (int iBit = 0; iBit < 64; iBit++) { 154 if ((reachableScenes & (1uLL << iBit)) != 0uLL) { 155 json.add(iBit); 156 } 211 foreach (auto&& sceneNr, reachableScenes) { json.add(sceneNr); } 212 json.endArray(); 213 214 json.startArray("reachableScenesWithNames"); 215 foreach (auto&& sceneNrAndName, reachableScenesWithNames) { 216 json.startObject(); 217 json.add("sceneNr", sceneNrAndName.first); 218 json.add("sceneName", sceneNrAndName.second); 219 json.endObject(); added 1 commit
- 590af865 - send only user defined scene names in response of getReachableScenes
added 17 commits
-
590af865...b2dcaa11 - 16 commits from branch
dss:master
- b0a39257 - updated getReachableScenes for new groups, add scene names
-
590af865...b2dcaa11 - 16 commits from branch
Rebased, squashed and updated the getReachableScenes to require the group id as parameter. Current response looks like this:
{"result":{"reachableScenes":[0,5,17,18,19],"userSceneNames":[{"sceneNr":5,"sceneName":"light 1"}]},"ok":true}
the scene names are only displayed in case user name is assigned.
Build finished. Tests FAILED. Build results available at: http://dsjenkins.cloudapp.net/jenkins/job/dSS_MR/891/