API Reference¶
Everything below is auto-generated from the source docstrings. The public
surface is curated via __all__ in
myviolet.__init__,
so anything importable as from myviolet import … shows up here.
Top-level package¶
Async Python library for the Pooldigital Violet pool controller.
VioletClient ¶
Async client for one Violet controller.
| PARAMETER | DESCRIPTION |
|---|---|
session
|
A reusable
TYPE:
|
host
|
Hostname or IP of the controller (e.g.
TYPE:
|
username
|
Optional. Required for write endpoints and
TYPE:
|
password
|
Optional. Required if
TYPE:
|
timeout
|
Default per-request timeout in seconds.
TYPE:
|
scheme
|
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
if |
Source code in src/myviolet/client.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
dosing_parameters
cached
property
¶
/setDosingParameters writes. Distinct from client.control.dosing,
which dispatches per-channel ON/OFF/AUTO commands.
CoverState ¶
DmxSceneState ¶
DosingType ¶
OnewireState ¶
Bases: StrEnum
Fault state of a 1-wire temperature sensor.
Note: DATA_MISSMATCH (sic) is spelled with two s letters to match
the wire value emitted verbatim by the controller firmware.
Source code in src/myviolet/enums.py
OutputState ¶
Bases: IntEnum
State of any binary output controlled by the Violet controller.
These seven values are emitted by every relay-style output: pump, heater, solar, light, refill, eco, backwash, backwash rinse, the five dosing channels, and both extension relay buses.
Source code in src/myviolet/enums.py
PvSurplusState ¶
RuleState ¶
SimpleOnOff ¶
YesNo ¶
BadCredentialsException ¶
Bases: VioletApiException
The controller rejected the supplied credentials (HTTP 401 or 403).
Source code in src/myviolet/exceptions.py
BadStatusCodeException ¶
Bases: VioletApiException
The controller returned an unexpected non-auth error HTTP status.
Source code in src/myviolet/exceptions.py
InvalidPayloadException ¶
Bases: VioletApiException
The controller's response was malformed, truncated, or unparseable.
SetpointValidationError ¶
Bases: VioletApiException, ValueError
A setpoint value was outside its documented valid range.
Subclasses both VioletApiException (for blanket library catches) and
ValueError (so generic input-validation code keeps working).
Source code in src/myviolet/exceptions.py
TimeoutException ¶
Bases: VioletApiException
An HTTP request to the controller exceeded the configured timeout.
UnsafeOperationException ¶
Bases: VioletApiException
A potentially unsafe operation was attempted without acknowledgment.
Currently raised by cover open/close calls when the caller has not passed
acknowledge_unsafe=True.
Source code in src/myviolet/exceptions.py
VioletApiException ¶
HardwareProfile
dataclass
¶
A summary of which controller hardware is present and configured.
Source code in src/myviolet/hardware.py
BackwashStatus
dataclass
¶
Backwash-process status flags plus the free-form raw state string.
The vendor's BACKWASH_STATE field mixes several different message types
(e.g. NEXT_BW_IN 2 BW_DAY5, BW_RUNNING_SINCE 123). Rather than try to
parse all variants, we expose it verbatim as raw_state.
Source code in src/myviolet/models/system_states.py
BathingAi
dataclass
¶
Bathing-AI overflow-vessel surveillance state.
The vendor's spec documents surveillance_state as YES/NO; the live
controller emits a third value (TRIGGERED) too, so we keep it as a
plain string instead of a strict enum.
Source code in src/myviolet/models/system_states.py
Cover
dataclass
¶
Pool cover state (read-only; control is via client.control.cover_*).
Source code in src/myviolet/models/cover.py
from_raw
classmethod
¶
Build from COVER_STATE. Unknown firmware values return None.
Source code in src/myviolet/models/cover.py
DmxScene
dataclass
¶
DosingChannel
dataclass
¶
One dosing channel. Optional DOSAGE-keyword fields default to None.
Source code in src/myviolet/models/dosing.py
ExtensionRelay
dataclass
¶
One relay on a relay-extension board. Bus 1 is documented; bus 2 is observed.
Source code in src/myviolet/models/extension.py
Heater
dataclass
¶
Heater output, including the optional postrun-timer remaining time.
Source code in src/myviolet/models/outputs.py
MeasuredValue
dataclass
¶
A sensor reading plus its daily min/max envelope.
Many sensor categories (water chemistry, 1-wire temperatures, analog
inputs) expose <KEY>_value, <KEY>_value_min, <KEY>_value_max
triplets. MeasuredValue is the typed wrapper.
Source code in src/myviolet/models/_common.py
from_raw
classmethod
¶
Assemble from <key_base>_value/_value_min/_value_max siblings.
Returns None when the canonical <key_base>_value key is absent,
which lets callers distinguish "sensor not installed" from "value zero".
Source code in src/myviolet/models/_common.py
OneWireSensor
dataclass
¶
A single 1-wire temperature sensor (12 slots, only configured ones).
Source code in src/myviolet/models/sensors.py
measured
property
¶
Expose the reading as a MeasuredValue for uniform processing.
OutputBase
dataclass
¶
Shared shape for the ~30 binary outputs (pump, heater, relays, ...).
Every documented binary output (PUMP, HEATER, SOLAR, LIGHT, REFILL, ECO, BACKWASH, BACKWASHRINSE, EXT1_, EXT2_) emits the same four siblings: a state integer, two epoch-seconds timestamps, and a runtime string.
Source code in src/myviolet/models/_common.py
from_raw
classmethod
¶
Assemble from <key_base>, _LAST_ON, _LAST_OFF, _RUNTIME.
Returns None when the canonical state key is absent (output not
installed) or when the controller emits an OutputState value
not in our documented enum — that lets the typed view layer stay
forward-compatible with future firmware revisions instead of
crashing the entire snapshot.
Source code in src/myviolet/models/_common.py
OverflowState
dataclass
¶
Overflow-vessel control flags (dryrun, overfill, refill triggers).
Source code in src/myviolet/models/system_states.py
Pump
dataclass
¶
Main pump output plus its 4 speed sub-outputs.
Source code in src/myviolet/models/outputs.py
PumpSpeed
dataclass
¶
One of the pump's 4 speed sub-outputs (RPM 0=stop, 1-3=speeds).
The vendor documents PUMP_RPM_*_LAST_ON/OFF as always "00:00:00" and
not useful, so they are surfaced as None rather than parsed.
Source code in src/myviolet/models/outputs.py
PvSurplus
dataclass
¶
PV-surplus function: off, on-by-input, or on-by-HTTP.
Source code in src/myviolet/models/system_states.py
SystemInfo
dataclass
¶
Top-level system metadata from /getReadings.
Covers the spec's "System informations" section plus a few undocumented
extras the live demo controller emits (HW_*_CARRIER, MEMORY_USED,
CURRENT_TIME_UNIX).
Source code in src/myviolet/models/system.py
WaterChemistry
dataclass
¶
Pool water chemistry readings (pH, ORP, free chlorine).
Source code in src/myviolet/models/chemistry.py
VioletReadings ¶
Typed read-only view of one /getReadings snapshot.
Wraps the parsed JSON dict from the controller. Every typed accessor is
lazy and memoized; the underlying dict remains accessible as .raw so
callers can still reach undocumented or firmware-specific keys.
Source code in src/myviolet/readings.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
raw
property
¶
Read-only view of the original /getReadings JSON dict.
Returned as a MappingProxyType so callers can read any key
(including undocumented or firmware-future ones) but cannot mutate
the underlying dict in a way that would corrupt cached typed views.
Async client (myviolet.client)¶
client ¶
VioletClient — the public async client for the Violet pool controller.
The client is constructed once per controller and exposes domain-grouped
namespaces (readings, control, targets, config, dosing_parameters,
history, calibration). Per-channel dosing ON/OFF/AUTO lives under
client.control.dosing; client.dosing_parameters handles
/setDosingParameters writes. All namespaces share a single
VioletTransport instance, so retries / observability hooks can be added
in one place.
VioletClient ¶
Async client for one Violet controller.
| PARAMETER | DESCRIPTION |
|---|---|
session
|
A reusable
TYPE:
|
host
|
Hostname or IP of the controller (e.g.
TYPE:
|
username
|
Optional. Required for write endpoints and
TYPE:
|
password
|
Optional. Required if
TYPE:
|
timeout
|
Default per-request timeout in seconds.
TYPE:
|
scheme
|
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
if |
Source code in src/myviolet/client.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
dosing_parameters
cached
property
¶
/setDosingParameters writes. Distinct from client.control.dosing,
which dispatches per-channel ON/OFF/AUTO commands.
Readings & typed views (myviolet.readings)¶
readings ¶
VioletReadings — the typed facade over a raw /getReadings JSON dict.
All typed views are computed lazily and memoized via cached_property so
that repeatedly accessing the same view on a snapshot is free and returns
the same object identity.
VioletReadings ¶
Typed read-only view of one /getReadings snapshot.
Wraps the parsed JSON dict from the controller. Every typed accessor is
lazy and memoized; the underlying dict remains accessible as .raw so
callers can still reach undocumented or firmware-specific keys.
Source code in src/myviolet/readings.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
raw
property
¶
Read-only view of the original /getReadings JSON dict.
Returned as a MappingProxyType so callers can read any key
(including undocumented or firmware-future ones) but cannot mutate
the underlying dict in a way that would corrupt cached typed views.
Shared enums (myviolet.enums)¶
enums ¶
Shared enums for fields returned by the Violet controller API.
Each enum mirrors a documented value table from the vendor's getReadings.xlsx
specification. The OutputState enum is reused across ~30 binary outputs
(pump, heater, solar, light, refill, eco, backwash, backwash rinse, all dosing
channels, and all extension relays).
OutputState ¶
Bases: IntEnum
State of any binary output controlled by the Violet controller.
These seven values are emitted by every relay-style output: pump, heater, solar, light, refill, eco, backwash, backwash rinse, the five dosing channels, and both extension relay buses.
Source code in src/myviolet/enums.py
DmxSceneState ¶
RuleState ¶
CoverState ¶
OnewireState ¶
Bases: StrEnum
Fault state of a 1-wire temperature sensor.
Note: DATA_MISSMATCH (sic) is spelled with two s letters to match
the wire value emitted verbatim by the controller firmware.
Source code in src/myviolet/enums.py
SimpleOnOff ¶
YesNo ¶
DosingType ¶
Exceptions (myviolet.exceptions)¶
exceptions ¶
Exception hierarchy for the myviolet client.
All exceptions raised by the client (transport-level HTTP errors, payload
problems, validation failures, deliberate safety guards) subclass
VioletApiException so callers can catch the entire library's failure modes
with a single blanket clause, or narrow to a specific subclass when needed.
VioletApiException ¶
BadCredentialsException ¶
Bases: VioletApiException
The controller rejected the supplied credentials (HTTP 401 or 403).
Source code in src/myviolet/exceptions.py
BadStatusCodeException ¶
Bases: VioletApiException
The controller returned an unexpected non-auth error HTTP status.
Source code in src/myviolet/exceptions.py
TimeoutException ¶
Bases: VioletApiException
An HTTP request to the controller exceeded the configured timeout.
InvalidPayloadException ¶
Bases: VioletApiException
The controller's response was malformed, truncated, or unparseable.
UnsafeOperationException ¶
Bases: VioletApiException
A potentially unsafe operation was attempted without acknowledgment.
Currently raised by cover open/close calls when the caller has not passed
acknowledge_unsafe=True.
Source code in src/myviolet/exceptions.py
SetpointValidationError ¶
Bases: VioletApiException, ValueError
A setpoint value was outside its documented valid range.
Subclasses both VioletApiException (for blanket library catches) and
ValueError (so generic input-validation code keeps working).