Skip to content

Commit

Permalink
Fix Select options of web UI not properly displaying the saved value,…
Browse files Browse the repository at this point in the history
… update output names
  • Loading branch information
kizniche committed Mar 9, 2024
1 parent a43d5f9 commit fd837e5
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This release changes the install directory from ~/Mycodo to /opt/Mycodo. This ne

- Fix some Inputs potentially sending integers to influxdb when it should be float
- Fix influxdb client install if server is already installed
- Fix Select options of web UI not properly displaying the saved value

### Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,17 @@
<option value="">{{dict_translation['select_one']['title']}}</option>
{% for each_set in each_option['options_select'] %}
<option value="{{each_set[0]}}"
{%- if (channel_options and each_set[0] == custom_options_values[unique_id][channel][each_option['id']]) or (custom_options_values and each_set[0] == custom_options_values[unique_id][each_option['id']]) -%}
{{' selected'}}
{%- elif custom_options_values and
(each_set[0] == custom_options_values[unique_id][each_option['id']] or
(force_default_value and
'default_value' in each_option and
each_set[0] == each_option['default_value'])) %}
{{' selected'}}
{%- if channel_options -%}
{%- if each_set[0] == custom_options_values[unique_id][channel][each_option['id']] -%}
{{' selected'}}
{%- endif -%}
{%- elif custom_options_values -%}
{% if (each_set[0] == custom_options_values[unique_id][each_option['id']] or
(force_default_value and
'default_value' in each_option and
each_set[0] == each_option['default_value'])) %}
{{' selected'}}
{%- endif -%}
{%- endif -%}
>{{each_set[1]}}</option>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion mycodo/outputs/motor_stepper_bipolar_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# Output information
OUTPUT_INFORMATION = {
'output_name_unique': 'stepper_bipolar_generic',
'output_name': "{}: {}, {} ({})".format(lazy_gettext('Motor'), lazy_gettext('Stepper Motor'), lazy_gettext('Bipolar'), lazy_gettext('Generic')),
'output_name': "{}: {}, {} ({}) (Pi <= 4)".format(lazy_gettext('Motor'), lazy_gettext('Stepper Motor'), lazy_gettext('Bipolar'), lazy_gettext('Generic')),
'output_library': 'RPi.GPIO',
'measurements_dict': measurements_dict,
'channels_dict': channels_dict,
Expand Down
2 changes: 1 addition & 1 deletion mycodo/outputs/motor_stepper_uln2003.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# Output information
OUTPUT_INFORMATION = {
'output_name_unique': 'stepper_uln2003',
'output_name': "{}: ULN2003 {}, {}".format(lazy_gettext('Motor'), lazy_gettext('Stepper Motor'), lazy_gettext('Unipolar')),
'output_name': "{}: ULN2003 {}, {} (Pi <= 4)".format(lazy_gettext('Motor'), lazy_gettext('Stepper Motor'), lazy_gettext('Unipolar')),
'output_manufacturer': 'STMicroelectronics',
'output_library': 'RPi.GPIO, rpimotorlib',
'measurements_dict': measurements_dict,
Expand Down
2 changes: 1 addition & 1 deletion mycodo/outputs/on_off_wireless_rpi_rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Output information
OUTPUT_INFORMATION = {
'output_name_unique': 'wireless_rpi_rf',
'output_name': "{}: {} 315/433 MHz".format(lazy_gettext('On/Off'), lazy_gettext('Wireless')),
'output_name': "{}: {} 315/433 MHz (Pi <= 4)".format(lazy_gettext('On/Off'), lazy_gettext('Wireless')),
'output_library': 'rpi-rf',
'measurements_dict': measurements_dict,
'channels_dict': channels_dict,
Expand Down
2 changes: 1 addition & 1 deletion mycodo/outputs/pump_l298n.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
# Output information
OUTPUT_INFORMATION = {
'output_name_unique': 'DC_MOTOR_L298N',
'output_name': "{}: L298N DC Motor Controller".format(lazy_gettext('Peristaltic Pump')),
'output_name': "{}: L298N DC Motor Controller (Pi <= 4)".format(lazy_gettext('Peristaltic Pump')),
'output_manufacturer': 'STMicroelectronics',
'output_library': 'RPi.GPIO',
'measurements_dict': measurements_dict,
Expand Down
2 changes: 1 addition & 1 deletion mycodo/outputs/pwm_gpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Output information
OUTPUT_INFORMATION = {
'output_name_unique': 'pwm',
'output_name': "{}: Raspberry Pi GPIO".format(lazy_gettext('PWM')),
'output_name': "{}: Raspberry Pi GPIO (Pi <= 4)".format(lazy_gettext('PWM')),
'output_library': 'pigpio',
'measurements_dict': measurements_dict,
'channels_dict': channels_dict,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

OUTPUT_INFORMATION = {
'output_name_unique': 'OUTPUT_GP8403_DAC_0_10_VDC',
'output_name': "{}: GP8403 2-Channel DAC: 0-10 VDC".format(lazy_gettext('Value')),
'output_library': 'DFRobot-GP8403',
'output_name': "{}: GP8403 2-Channel DAC: 0-10 VDC (Pi <= 4)".format(lazy_gettext('Value')),
'output_library': 'DFRobot-GP8403, RPi.GPIO',
'output_manufacturer': 'Mycodo',
'measurements_dict': measurements_dict,
'channels_dict': channels_dict,
Expand All @@ -49,6 +49,7 @@
'message': 'Output a 0 to 10 VDC signal.',

'dependencies_module': [
('pip-pypi', 'RPi.GPIO', 'RPi.GPIO==0.7.1'),
('pip-pypi', 'DFRobot.DAC', 'DFRobot-GP8403==0.1.1')
],

Expand Down

0 comments on commit fd837e5

Please sign in to comment.