Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
16 changes: 8 additions & 8 deletions config/hspower/hspower_fei1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_FEIPickoff
2: 2_LSMHor
3: 3_LSMVer
4: 4_MSHor
5: 5_MSVer
6: 6_SMC100PP
7: 7_ATCP
8: 8_ATCL
1: FEIPickoff
2: LSMHor
3: LSMVer
4: MSHor
5: MSVer
6: SMC100PP
7: ATCP
8: ATCL
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_fei2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_ATCCryo
2: 2_RFAM
3: 3_BFAM
4: 4_PIAARet
5: 5_FEIComp
6: 6_NI9055plus
7: 7_RPIAAGim
8: 8_BPIAAGim
1: ATCCryo
2: RFAM
3: BFAM
4: PIAARet
5: FEIComp
6: NI9055plus
7: RPIAAGim
8: BPIAAGim
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_fei3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_ATCFW
2: 2_ATCArch
3: 3_Unused
4: 4_Unused
5: 5_Unused
6: 6_Unused
7: 7_FEIShut
8: 8_VIBLake
1: ATCFW
2: ATCArch
3: Unused
4: Unused
5: Unused
6: Unused
7: FEIShut
8: VIBLake
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_fei4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_Unused
2: 2_Inficon
3: 3_FSM
4: 4_Unused
5: 5_Unused
6: 6_Unused
7: 7_Unused
8: 8_Lantronix
1: Unused
2: Inficon
3: FSM
4: Unused
5: Unused
6: Unused
7: Unused
8: Lantronix
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_hk1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_Unused
2: 2_Unused
3: 3_Unused
4: 4_Unused
5: 5_Unused
6: 6_Unused
7: 7_Unused
8: 8_Unused
1: Unused
2: Unused
3: Unused
4: Unused
5: Unused
6: Unused
7: Unused
8: Unused
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_hkcal1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_Inficon
2: 2_SRS
3: 3_2_FW2
4: 4_3_IRIS
5: 5_1_FW1
6: 6_4_IRISETH
7: 7_5_EtLamp
8: 8_Lantronix
1: Inficon
2: SRS
3: 2_FW2
4: 3_IRIS
5: 1_FW1
6: 4_IRISETH
7: 5_EtLamp
8: Lantronix
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_hkcal2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_GammaVac
2: 2_NewPtFlat
3: 3_Aruba
4: 4_2_FWGC
5: 5_Lake1
6: 6_Lake2
7: 7_NewPtGCell
8: 8_HeatEx
1: GammaVac
2: NewPtFlat
3: Aruba
4: 2_FWGC
5: Lake1
6: Lake2
7: NewPtGCell
8: HeatEx
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_hkcal3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_Onewire
2: 2_Unused
3: 3_Unused
4: 4_Unused
5: 5_Unused
6: 6_Unused
7: 7_Unused
8: 8_Unused
1: Onewire
2: Unused
3: Unused
4: Unused
5: Unused
6: Unused
7: Unused
8: Unused
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_yj1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_Inficon
2: 2_Aruba
3: 3_Unused
4: 4_bluelake
5: 5_redlake
6: 6_Unused
7: 7_Unused
8: 8_Unused
1: Inficon
2: Aruba
3: Unused
4: bluelake
5: redlake
6: Unused
7: Unused
8: Unused
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_yjcal1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_Aruba
2: 2_Palomar_Comp
3: 3_5_EtLamp
4: 4_3_IRIS
5: 5_Unused
6: 6_FW1
7: 7_FW2
8: 8_Onewire
1: Aruba
2: Palomar_Comp
3: 5_EtLamp
4: 3_IRIS
5: Unused
6: FW1
7: FW2
8: Onewire
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
16 changes: 8 additions & 8 deletions config/hspower/hspower_yjcal2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ hardware:
# reports.
outlet_count: 8
outlet_names:
1: 1_FLPS
2: 2_Inficon
3: 3_GammaVac
4: 4_HeatEx
5: 5_PHOPS
6: 6_Unused
7: 7_SRS
8: 8_Lantronix
1: FLPS
2: Inficon
3: GammaVac
4: HeatEx
5: PHOPS
6: Unused
7: SRS
8: Lantronix
# Telnet login. The values never appear here: these name environment
# variables the daemon reads, set root-only in /etc/hispec/secrets.env (see
# docs/operations/systemd.md). All nine PDUs share one login today; point an instance
Expand Down
9 changes: 5 additions & 4 deletions daemons/hspower/dli_pdu
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ class DliPdu(PduDaemon): #pylint: disable = W0223

def set_outlet_switchable(self, n: int, switchable: bool) -> None:
switchable = bool(switchable)
self._confirm(self.controller.unlock_outlet(n) if switchable else self.controller.lock_outlet(n),
self._confirm(self.controller.unlock_outlet(n) if switchable
else self.controller.lock_outlet(n),
f"{'unlock' if switchable else 'lock'} outlet {n}")

def cycle_outlet(self, n: int) -> None:
"""Power cycle outlet ``n``: off, wait its cycle delay, then on."""
"""Power cycle outlet ``n``: off, wait for its cycle delay, then on."""
self._confirm(self.controller.outlet_cycle(n), f"cycle outlet {n}")

def get_outlet_cycledelay(self, n: int) -> int:
Expand All @@ -87,11 +88,11 @@ class DliPdu(PduDaemon): #pylint: disable = W0223

def register_outlet_keywords(self, n: int) -> None:
super().register_outlet_keywords(n)
self.keyword_registry.trigger(f"cycle{self.outlet_key(n)}",
self.keyword_registry.trigger(f"cycle{n}",
action=self.when_connected(self.cycle_outlet, n),
description=f"Power cycle outlet {n}: off, wait its cycle delay, "
"then on.")
self.keyword_registry.int(f"cycledelay{self.outlet_key(n)}",
self.keyword_registry.int(f"cycledelay{n}",
getter=self.when_connected(self.get_outlet_cycledelay, n),
units="seconds",
description=f"Outlet {n} off time during a power cycle.")
Expand Down
12 changes: 6 additions & 6 deletions daemons/hspower/eaton_pdu
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ from pdu_base import PduDaemon, main
from hispec.driver.pdu.src.emat08_10 import EatonEMAT # pylint: disable=E0611


class EatonPdu(PduDaemon): #pylint: disable = W0223
class EatonPdu(PduDaemon): # pylint: disable=too-many-public-methods
"""Daemon for one Eaton EMAT-08/10 PDU."""

default_port = 23
Expand Down Expand Up @@ -116,24 +116,24 @@ class EatonPdu(PduDaemon): #pylint: disable = W0223

def register_outlet_keywords(self, n: int) -> None:
super().register_outlet_keywords(n)
self.keyword_registry.float(f"current{self.outlet_key(n)}",
self.keyword_registry.float(f"current{n}",
getter=self.when_connected(self.get_outlet_current, n),
units="A",
description=f"Outlet {n} instantaneous current draw.")
self.keyword_registry.float(f"power{self.outlet_key(n)}",
self.keyword_registry.float(f"power{n}",
getter=self.when_connected(self.get_outlet_power, n),
units="W",
description=f"Outlet {n} instantaneous active power draw.")
self.keyword_registry.int(f"autorestart{self.outlet_key(n)}",
self.keyword_registry.int(f"autorestart{n}",
getter=self.when_connected(self.get_outlet_autorestart, n),
setter=self.when_connected(self.set_outlet_autorestart, n),
description=(f"Outlet {n} power-up behavior after a PDU restart: "
"0=not powered, 1=powered, 2=last state."))
self.keyword_registry.int(f"energy{self.outlet_key(n)}",
self.keyword_registry.int(f"energy{n}",
getter=self.when_connected(self.get_outlet_energy, n),
units="Wh",
description=f"Outlet {n} cumulative energy since the last reset.")
self.keyword_registry.trigger(f"resetstatistics{self.outlet_key(n)}",
self.keyword_registry.trigger(f"resetstatistics{n}",
action=self.when_connected(self.reset_outlet_statistics, n),
description=f"Reset the energy statistics for outlet {n}.")

Expand Down
22 changes: 14 additions & 8 deletions daemons/hspower/pdu_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ def register_device_keywords(self) -> None:

def register_outlet_keywords(self, n: int) -> None:
"""Register the keywords for outlet ``n``."""
self.keyword_registry.bool(f"state{self.outlet_key(n)}",
self.keyword_registry.bool(f"state{n}",
getter=self.when_connected(self.get_outlet_state, n),
setter=self.when_connected(self.set_outlet_state, n),
description=f"Outlet {n} power state; write true/false to switch on/off.")
self.keyword_registry.string(f"name{self.outlet_key(n)}",
self.keyword_registry.string(f"name{n}",
getter=self.when_connected(self.get_outlet_name, n),
setter=self.when_connected(self.set_outlet_name, n),
description=f"Outlet {n} name, as configured on the PDU.")
self.keyword_registry.bool(f"switchable{self.outlet_key(n)}",
description=f"Outlet {n} name")
self.keyword_registry.bool(f"switchable{n}",
getter=self.when_connected(self.get_outlet_switchable, n),
setter=self.when_connected(self.set_outlet_switchable, n),
description=f"Whether outlet {n} can be switched (True) or is locked "
Expand Down Expand Up @@ -267,6 +267,11 @@ def _initialize(self):
self.logger.warning(
"Configured hardware.outlet_count (%d) does not match hardware (%d)",
self.outlet_count, reported)
for key, value in self.outlet_names.items():
n = int(key) - 1
if self.controller.outlet_names[n] != value:
self.logger.warning("configured outlet %s (%s) does not match controller (%s)",
key, value, self.controller.outlet_names[n])
except Exception as e: # pylint: disable=W0718
return self._fail(str(e))
return {"ok": True}
Expand Down Expand Up @@ -316,7 +321,7 @@ def _opt_int(self, value) -> Optional[int]:

def _parse_outlet_names(self, raw, outlet_count: int) -> Dict[int, str]:
"""Validate hardware.outlet_names, a map of outlet number to the name
used in that outlet's keywords. Characters other than letters, digits
used in that outlet's name keyword. Characters other than letters, digits
and underscores become underscores. Raises ValueError on a bad entry.
"""
if raw is None:
Expand All @@ -339,9 +344,10 @@ def _parse_outlet_names(self, raw, outlet_count: int) -> Dict[int, str]:
raise ValueError(f"hardware.outlet_names: outlet {n} name is empty")
if name != raw_name:
self.logger.warning("hardware.outlet_names: outlet %d name '%s' is used as "
"'%s' in keywords", n, raw_name, name)
if name.lower() in (other.lower() for other in names.values()):
raise ValueError(f"hardware.outlet_names: name '{name}' is used twice")
"'%s' in name keyword", n, raw_name, name)
if "unused" not in name.lower():
if name.lower() in (other.lower() for other in names.values()):
raise ValueError(f"hardware.outlet_names: name '{name}' is used twice")
names[n] = name
return names

Expand Down
2 changes: 1 addition & 1 deletion src/hispec/driver/pdu
Submodule pdu updated 1 files
+5 −7 src/dli_dc3.py
Loading