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

EATON HID: add missing usages and paths - ECO Mode #2637

Merged
merged 99 commits into from
Nov 15, 2024

Conversation

masterwishx
Copy link
Contributor

@masterwishx masterwishx commented Sep 23, 2024

Adding HE/ECO mode, Bypass On/Off for Eaton USB UPS Online Models + Adding Missing usages and paths

Continue work for #2636
Fixes #2485
Ref #2495

Added:

Variables: 

battery.charger.status: discharging
device.usb.version: 01.29
input.eco.switchable: normal
outlet.1.designator: AC OUTPUT
outlet.1.protect.status: protected
input.transfer.forced: enabled
input.eco.switchable: ECO
input.bypass.switch.on: off
etc ...

R/W variables:

input.eco.switchable
input.bypass.switch.on
etc ..

Commands: 

ecomode.disable - Take the UPS out of High Efficiency (aka ECO) mode
ecomode.enable - Put UPS in High Efficiency (aka ECO) mode
essmode.disable - Take the UPS out of Energy Saver System (aka ESS) mode
essmode.enable - Put UPS in Energy Saver System (aka ESS) mode
bypass.start - Put the UPS in bypass mode
bypass.stop - Take the UPS out of bypass mode

Signed-off-by: Arnaud Quette <arnaudquette@eaton.com>
Signed-off-by: Arnaud Quette <arnaudquette@eaton.com>
Signed-off-by: DaRK AnGeL <masterwishx@gmail.com>
@masterwishx masterwishx changed the title first trying to add values Ffirst trying to add values Sep 23, 2024
@masterwishx masterwishx changed the title Ffirst trying to add values First try to add values for #2636 Sep 23, 2024
/* { "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, stringid_conversion },*/

{ "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */
{ "device.usb.mode", ST_FLAG_STRING, 20, "UPS.System.USB.Mode", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this one is useful, and not a string (1 to set in bootloader )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

commented


{ "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */
{ "device.usb.mode", ST_FLAG_STRING, 20, "UPS.System.USB.Mode", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */
{ "device.gateway.power.rate", ST_FLAG_STRING, 20, "UPS.System.Gateway.PowerRate", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto above, don't think it's useful, and not a string (level of power provided by the UPS to the network card

Copy link
Contributor Author

Choose a reason for hiding this comment

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

commented

@@ -1292,7 +1294,7 @@ static hid_info_t mge_hid2nut[] =
/* Refer to Note 1 (This point will need more clarification!)
{ "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.PresentStatus.Used", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_enabled_legacy_info }, */
/* This data is the actual ABM status information */
{ "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.Mode", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_status_info },
{ "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.Status", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_status_info },
Copy link
Contributor

Choose a reason for hiding this comment

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

to be tested, may be avail on some units, not others. May need both Mode and Status

Unified charger info,bitmap with :
Status on bit 0-3:
0x0: Off
0x1: Charging
0x2: Floating
0x3: On, not charging
0x4: Discharging
0x5-0xF : Reserved
Mode on bit 4-6:
0: CC
1: ABM
2-7 : Reserved
Error on bit 7:
0: Good
1: In error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also ABM table commented needs to be changes?

@@ -1482,8 +1484,9 @@ static hid_info_t mge_hid2nut[] =
{ "outlet.1.id", 0, 0, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "%.0f", HU_FLAG_STATIC, NULL },
{ "outlet.1.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "PowerShare Outlet 1", HU_FLAG_ABSENT, NULL },
{ "outlet.1.switchable", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.Switchable", NULL, "%s", HU_FLAG_STATIC, yes_no_info },
{ "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.SwitchOn/Off", NULL, "%s", 0, on_off_info },
{ "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[1].Status", NULL, "%s", 0, on_off_info },
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto, may need both.... this one provides more than just on/off

Global status of the load segment :
0 : Not powered
1 : Not protected
2 : Protected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so to leave { "outlet.2.status", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.SwitchOn/Off", NULL, "%s", 0, on_off_info }, ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

0,1,2 thius mean = NULL, "%.2f", 0, NULL }, or NULL, "%.0f", HU_FLAG_STATIC, NULL },

Copy link
Contributor

Choose a reason for hiding this comment

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

means a lookup function, something like:

static info_lkp_t eaton_enable_disable_info[] = {
{ 0, "not powered", NULL, NULL },
{ 1, "not protected", NULL, NULL },
{ 2, "protected", NULL, NULL },
{ 0, NULL, NULL, NULL }
};

/* FIXME: should better use UPS.OutletSystem.Outlet.[1].Status? */
{ "outlet.1.idesignator", 0, 0, "UPS.OutletSystem.Outlet.[1].iDesignator", NULL, "%s", 0, on_off_info }, /* needs to check */
Copy link
Contributor

Choose a reason for hiding this comment

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

stringid_conversion (thats an iValue, so indexed string), not on_off ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

/* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info
{ "outlet.1.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[2].ECOControl", NULL, "%.2f", 0, NULL },*/
/* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info */
{ "outlet.1.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[2].ECOControl", NULL, "%.2f", 0, NULL },
Copy link
Contributor

Choose a reason for hiding this comment

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

nut suitable name to be found!
need a lookup function, like on_off, but for:
0 : The outlet is not ECO controlled.
1 : The outlet is ECO controlled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added function

Signed-off-by: DaRK AnGeL <masterwishx@gmail.com>
@arnaudquette-eaton
Copy link
Contributor

arnaudquette-eaton commented Sep 24, 2024

Ref: #2495

2nding @jimklimov comment to base of master, and include my base PR in yours

Copy link
Contributor Author

@masterwishx masterwishx left a comment

Choose a reason for hiding this comment

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

to be tested, may be avail on some units, not others. May need both Mode and Status

Unified charger info,bitmap with :
Status on bit 0-3:
0x0: Off
0x1: Charging
0x2: Floating
0x3: On, not charging
0x4: Discharging
0x5-0xF : Reserved
Mode on bit 4-6:
0: CC
1: ABM
2-7 : Reserved
Error on bit 7:
0: Good
1: In error

So this is not right table? and needs to change as you wrote above?

  • Charger ABM mode | Charging | Floating | Resting | Discharging | Disabled | Disabled
  • UPS.BatterySystem.Charger.Mode | 1 | 3 | 4 | 2 | 6 | 6

Signed-off-by: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com>
Signed-off-by: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com>
Signed-off-by: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com>
@jimklimov jimklimov marked this pull request as draft September 24, 2024 11:33
@jimklimov
Copy link
Member

jimklimov commented Sep 24, 2024

Found that "Editing" a PR now allows to change the target branch, so this instance is now the main one of the flock.

@jimklimov jimklimov mentioned this pull request Sep 24, 2024
@jimklimov jimklimov changed the base branch from work/2495-eaton-usb-ids to master September 24, 2024 11:38
@jimklimov jimklimov marked this pull request as ready for review September 24, 2024 11:38
@jimklimov jimklimov changed the title First try to add values for #2636 EATON HID: add missing usages and paths Sep 24, 2024
@jimklimov jimklimov added enhancement Eaton USB Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) impacts-release-2.8.2 Issues reported against NUT release 2.8.2 (maybe vanilla or with minor packaging tweaks) ECO mode labels Sep 24, 2024
@jimklimov jimklimov added this to the 2.8.4 milestone Sep 24, 2024
@masterwishx
Copy link
Contributor Author

@arnaudquette-eaton @jimklimov I made some changes from comments, please check when you have time

@@ -689,6 +689,12 @@ static info_lkp_t pegasus_yes_no_info[] = {
{ 0, NULL, NULL, NULL }
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added function like yes_no

@@ -864,17 +870,25 @@ static info_lkp_t eaton_converter_online_info[] = {
{ 0, NULL, NULL, NULL }
};

static info_lkp_t eaton_outlet_status_enable_disable_info[] = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added func for outlet_status

@jimklimov jimklimov modified the milestones: 2.8.4, 2.8.3 Oct 20, 2024
…'work/2495'

NOTE: ECO entries in code and docs go before the ALARM entries.

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
Copy link
Member

Bumped #2637 and #2660 against recent master changes (ALARM support landed into same spots almost everywhere).
NOTE: #2637 is still a strict subset of #2660.

So CI will spend some time re-checking them all...

@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

…andard as around [networkupstools#2637]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to masterwishx/nut that referenced this pull request Nov 14, 2024
jimklimov added a commit to masterwishx/nut that referenced this pull request Nov 14, 2024
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov added the ready / gonna merge The PR is in final cycles leading to merge unless someone logs an objection before we hit the button label Nov 14, 2024
@jimklimov
Copy link
Member

This PR is not as contended as the follow-up in #2660 with deeper changes into existing driver logic, so it was a good idea to separate the two :)

I intend to merge this one as soon as CI is satisfied with the recent revision.

drivers/mge-hid.c Outdated Show resolved Hide resolved
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ls#2637 (revised in later PR)

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@desertwitch
Copy link
Contributor

Just cross checked #2637 and #2660 branches against each other.
#2660 seems to introduce no more ECO-changes that would be relevant to this PR, only ABM - LGTM.
Might be worth renaming #2660 PR to reflect that those are ABM improvements rather than ECO-related.

@masterwishx
Copy link
Contributor Author

masterwishx commented Nov 14, 2024

Just cross checked #2637 and #2660 branches against each other. #2660 seems to introduce no more ECO-changes that would be relevant to this PR, only ABM - LGTM. Might be worth renaming #2660 PR to reflect that those are ABM improvements rather than ECO-related.

Confirm #2637 for ECO/bypass mode , #2660 added statuses for ABM , @jimklimov sorry again that not made a separate pr for ABM

@jimklimov
Copy link
Member

jimklimov commented Nov 14, 2024

Well, I hope to merge #2637 soon, and #2660 can then be rebased over the updated master branch or otherwise merged and reconciled, and renamed as fits the resulting change set.

@jimklimov jimklimov merged commit 7c4e55e into networkupstools:master Nov 15, 2024
30 checks passed
@masterwishx masterwishx deleted the work/2495 branch November 15, 2024 11:01
@masterwishx masterwishx changed the title EATON HID: add missing usages and paths EATON HID: add missing usages and paths - ECO Mode Nov 15, 2024
This was referenced Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DDL Eaton ECO mode enhancement impacts-release-2.8.2 Issues reported against NUT release 2.8.2 (maybe vanilla or with minor packaging tweaks) Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) ready / gonna merge The PR is in final cycles leading to merge unless someone logs an objection before we hit the button USB
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

How to Set ECO/HE mode in Eaton 9E model
5 participants