Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added protection modes for mrwm2 #691

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wb-mqtt-serial (2.109.2) stable; urgency=low

* WB-MRWM2 templates: add protection modes by power and low/high voltage

-- Daniil Safonov <[email protected]> Fri, 02 Feb 2024 17:00:00 +0600

wb-mqtt-serial (2.109.1) stable; urgency=medium

* MRM2mini template: fix curtains mapping matrix size
Expand Down
181 changes: 179 additions & 2 deletions templates/config-wb-mrwm2.json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,58 @@
"title": "Output Safe State",
"id": "gg_outputs_safe_state",
"group": "g_outputs"

},
{
"title": "Protection Mode",
"id": "gg_protection",
},
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
{
"title": "Channel {{out_num}} protection modes",
"group": "gg_protection",
"id": "gg_protection_channel_{{out_num}}",
},
{
"title": "Protection channel {{out_num}} high voltage",
"group": "gg_protection_channel_{{out_num}}",
"id": "gg_protection_channel_{{out_num}}_high_voltage",
"ui_options": {
"wb": {
"disable_title": true
}
}
},
{
"title": "Protection channel {{out_num}} low voltage",
"group": "gg_protection_channel_{{out_num}}",
"id": "gg_protection_channel_{{out_num}}_low_voltage",
"ui_options": {
"wb": {
"disable_title": true
}
}
},
{
"title": "Protection channel {{out_num}} timeout",
"group": "gg_protection_channel_{{out_num}}",
"id": "gg_protection_channel_{{out_num}}_timeout",
"ui_options": {
"wb": {
"disable_title": true
}
}
},
{
"title": "Protection channel {{out_num}} auto power on",
"group": "gg_protection_channel_{{out_num}}",
"id": "gg_protection_channel_{{out_num}}_power_on",
"ui_options": {
"wb": {
"disable_title": true
}
}
},
{% endfor -%}
{
"title": "Outputs group",
"id": "gg_outputs_channels",
Expand Down Expand Up @@ -291,6 +341,9 @@
"enum_titles": ["no action", "reset", "set", "toggle"],
"condition": "in{{in_num}}_mode==6"
},
{% endfor -%}
{% endfor -%}
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
"out{{out_num}}_safe_state": {
"title": "Output {{out_num}}",
"group": "gg_outputs_safe_state",
Expand Down Expand Up @@ -332,6 +385,98 @@
]
},
{% endfor -%}
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
{% endfor -%}
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
"out{{out_num}}_safe_mode_voltage_high_mode": {
"title": "Enable High voltage protection",
"group": "gg_protection_channel_{{out_num}}_high_voltage",
"order": 1,
"address": {{ 1326 + out_num - 1 }},
"reg_type": "holding",
"default": 0,
"enum": [0, 1],
"enum_titles": [
"Off",
"On"
]
},
"out{{out_num}}_safe_mode_voltage_high_value": {
"title": "Level of high voltage protection, V",
"group": "gg_protection_channel_{{out_num}}_high_voltage",
"order": 2,
"address": {{ 1318 + out_num - 1 }},
"reg_type": "holding",
"default": 260,
"min": 100,
"max": 400,
"order": 2,
"condition": "out{{out_num}}_safe_mode_voltage_high_mode==1"
},
{% endfor -%}
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
"out{{out_num}}_safe_mode_voltage_low_mode": {
"title": "Enable Low voltage protection",
"group": "gg_protection_channel_{{out_num}}_low_voltage",
"order": 1,
"address": {{ 1310 + out_num - 1 }},
"reg_type": "holding",
"default": 0,
"enum": [0, 1],
"enum_titles": [
"Off",
"On"
]
},
"out{{out_num}}_safe_mode_voltage_low_value": {
"title": "Level of low voltage protection, V",
"group": "gg_protection_channel_{{out_num}}_low_voltage",
"order": 2,
"address": {{ 1302 + out_num - 1 }},
"reg_type": "holding",
"default": 200,
"min": 80,
"max": 230,
"order": 2,
"condition": "out{{out_num}}_safe_mode_voltage_low_mode==1"
},
"out{{out_num}}_safe_mode_voltage_timeout_off": {
"title": "voltage_timeout_off",
"group": "gg_protection_channel_{{out_num}}_timeout",
"order": 2,
"address": {{ 1334 + out_num - 1 }},
"reg_type": "holding",
"default": 100,
"min": 10,
"max": 600,
"order": 2,
"condition": "out{{out_num}}_safe_mode_voltage_low_mode==1||out{{out_num}}_safe_mode_voltage_high_mode==1"
},
"out{{out_num}}_safe_mode_voltage_timeout_on": {
"title": "voltage_timeout_on",
"group": "gg_protection_channel_{{out_num}}_timeout",
"order": 2,
"address": {{ 1342 + out_num - 1 }},
"reg_type": "holding",
"default": 0,
"min": 0,
"max": 600,
"order": 2,
"condition": "out{{out_num}}_safe_mode_voltage_low_mode==1||out{{out_num}}_safe_mode_voltage_high_mode==1"
},
"out{{out_num}}_safe_mode_power_on": {
"title": "Enable auto power on",
"group": "gg_protection_channel_{{out_num}}_power_on",
"order": 1,
"address": {{ 1350 + out_num - 1 }},
"reg_type": "holding",
"default": 0,
"enum": [0, 1],
"enum_titles": [
"Off",
"On"
]
},
{% endfor -%}
"outputs_restore_state": {
"title": "Outputs State After Power On",
Expand Down Expand Up @@ -490,7 +635,28 @@
"group": "gg_outputs_channels"
},
{% endfor -%}
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут можно использовать consists_of вместе с enum/enum_titles:

"name": "out protection",
"type": "text",
"enum": [ "0;1", "1;0", "0;0", "1;1" ],
"enum_titles": [ "low voltage", "high voltage", ... ],
"consists_of": [
  {
    "reg_type": "discrete",
    ...
  },
  {
    "reg_type": "discrete",
    ...
  }
],

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

значительно изменил код (добавив enum_titles), к которому был комментарий, теперь не актуально.

{
"name": "out {{out_num}} protection high voltage",
"reg_type": "discrete",
"address": {{out_num -1 + 1310}},
"type": "switch",
"sporadic": true,
"group": "gg_outputs_channels"
},
{% endfor -%}
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
{
"name": "out {{out_num}} protection low voltage",
"reg_type": "discrete",
"address": {{out_num - 1 + 1302}},
"type": "switch",
"sporadic": true,
"group": "gg_outputs_channels"

},
{% endfor -%}
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
{
"name": "Urms L{{out_num}}",
"reg_type": "input",
Expand Down Expand Up @@ -619,6 +785,9 @@
"Input {{in_num}} Long Press Counter": "Счетчик длинных нажатий входа {{in_num}}",
"Input {{in_num}} Double Press Counter": "Счетчик двойных нажатий входа {{in_num}}",
"Input {{in_num}} Shortlong Press Counter": "Счетчик коротких, а затем длинных нажатий входа {{in_num}}",
"out {{in_num}} protection high voltage":"Превышено напряжение на выходе {{in_num}}",
"out {{in_num}} protection low voltage":"Занижено напряжение на выходе {{in_num}}",
"out {{in_num}} protection power":"Мощность превышена на выходе {{in_num}}",
{% endfor -%}

"Outputs": "Выходы",
Expand All @@ -631,6 +800,14 @@

"Actions for outputs when the input is closed / opened": "Действия для выходов при замыкании / размыкании входа",

"Protection Mode": "Режимы защит",
{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
"OutputPPP {{out_num}}": "Выход с защитой {{out_num}}",
"Output {{out_num}} Safe Mode Power": "Ограничение мощности на канале {{out_num}}",
"Output {{out_num}} Safe Mode HighVoltage": "Ограничение высокого напряжения на канале {{out_num}}",
"Output {{out_num}} Safe Mode LowVoltage": "Ограничение низкого напряжения на канале {{out_num}}",
{% endfor -%}

{% for out_num in range(1, OUTPUTS_NUMBER + 1) -%}
"Output {{out_num}}": "Выход {{out_num}}",
"Output {{out_num}} Actions": "Действия для выхода {{out_num}}",
Expand Down