Skip to content

Commit

Permalink
Fixed Associations and CTRL_GROUP_
Browse files Browse the repository at this point in the history
  • Loading branch information
PoltoS committed Mar 25, 2024
1 parent 500bb2c commit f031a6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ ${

private makeAction = (action: Action, associations: Association[]): string | null => {
const index = associations.findIndex(association => association.uuid === action.parentId);
const hasAssociation = action.template?.includes('{1}')
const hasAssociation = action.template?.includes('{0}')
// TODO добавить сообщение об ошибке в форме (отсутствует ассоциация)
if ((hasAssociation && index < 0) ||!action.template) {
return null;
}

return ` ${
action.template
.replace('{1}', (2 + index).toString())
.replace('{0}', makeLinear(action.parameters[0]))}`
.replace('{0}', 'CTRL_GROUP_' + (1 + index).toString())
.replace('{1}', makeLinear(action.parameters[0]))}`
}

private makeExpression(list: Expression[]): string {
Expand Down
12 changes: 6 additions & 6 deletions apps/configurator/src/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"parentId": "ZUNO_ASSOCIATION_GROUP_SET_VALUE",
"title": "Send Set value command to group",
"template": "zunoSendToGroupSetValueCommand({1}, {0});",
"template": "zunoSendToGroupSetValueCommand({0}, {1});",
"parameters": [
{
"title": "groupNumber",
Expand All @@ -31,7 +31,7 @@
{
"parentId": "ZUNO_ASSOCIATION_GROUP_SET_VALUE_AND_DIM",
"title": "Send Set value command to group",
"template": "zunoSendToGroupSetValueCommand({1}, {0});",
"template": "zunoSendToGroupSetValueCommand({0}, {1});",
"parameters": [
{
"title": "groupNumber",
Expand All @@ -48,7 +48,7 @@
{
"parentId": "ZUNO_ASSOCIATION_GROUP_SET_VALUE_AND_DIM",
"title": "Send Dim Start command to group",
"template": "zunoSendToGroupDimmingCommand({1}, {0}, TRUE);",
"template": "zunoSendToGroupDimmingCommand({0}, {1}, TRUE);",
"parameters": [
{
"title": "groupNumber",
Expand Down Expand Up @@ -78,7 +78,7 @@
{
"parentId": "ZUNO_ASSOCIATION_GROUP_SET_VALUE_AND_DIM",
"title": "Send Dim Stop command to group",
"template": "zunoSendToGroupDimmingCommand({1}, FALSE, FALSE);",
"template": "zunoSendToGroupDimmingCommand({0}, FALSE, FALSE);",
"parameters": [
{
"title": "groupNumber",
Expand Down Expand Up @@ -114,7 +114,7 @@
{
"parentId": "ZUNO_ASSOCIATION_GROUP_SCENE_CONTROL",
"title": "Send Scene to group",
"template": "zunoSendToGroupScene({1}, {0});",
"template": "zunoSendToGroupScene({0}, {1});",
"parameters": [
{
"title": "groupNumber",
Expand All @@ -137,7 +137,7 @@
{
"parentId": "ZUNO_ASSOCIATION_GROUP_DOORLOCK",
"title": "Send Door Lock command to group",
"template": "zunoSendToGroupDoorlockControlTiming({1}, {0}, 0);",
"template": "zunoSendToGroupDoorlockControlTiming({0}, {1}, 0);",
"parameters": [
{
"title": "groupNumber",
Expand Down

0 comments on commit f031a6e

Please sign in to comment.