|
13 | 13 | <script src="_static/documentation_options.js?v=5929fcd5"></script>
|
14 | 14 | <script src="_static/doctools.js?v=9bcbadda"></script>
|
15 | 15 | <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
16 |
| - <script type=" module" src=" https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs" ></script> |
17 |
| - <script type=" module" src=" https://cdn.jsdelivr.net/npm/@mermaid-js/[email protected]/dist/mermaid-layout-elk.esm.min.mjs" ></script> |
18 |
| - <script type=" module" >import mermaid from "https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs";import elkLayouts from "https://cdn.jsdelivr.net/npm/@mermaid-js/[email protected]/dist/mermaid-layout-elk.esm.min.mjs";mermaid.registerLayoutLoaders(elkLayouts);mermaid.initialize({startOnLoad: false});</script> |
19 |
| - <script src=" https://cdn.jsdelivr.net/npm/[email protected]/dist/d3.min.js" ></script> |
20 |
| - <script type="module"> |
21 |
| -import mermaid from "https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs"; |
22 |
| -const load = async () => { |
23 |
| - await mermaid.run(); |
24 |
| - const all_mermaids = document.querySelectorAll(".mermaid"); |
25 |
| - const mermaids_to_add_zoom = 1 === -1 ? all_mermaids.length : 1; |
26 |
| - const mermaids_processed = document.querySelectorAll(".mermaid[data-processed='true']"); |
27 |
| - if(mermaids_to_add_zoom > 0) { |
28 |
| - var svgs = d3.selectAll(".mermaid[data-zoom-id=id-905389ca-75e0-4f38-8925-742894cb8329] svg"); |
29 |
| - if(all_mermaids.length !== mermaids_processed.length) { |
30 |
| - // try again in a sec, wait for mermaids to load |
31 |
| - setTimeout(load, 200); |
32 |
| - return; |
33 |
| - } else if(svgs.size() !== mermaids_to_add_zoom) { |
34 |
| - // try again in a sec, wait for mermaids to load |
35 |
| - setTimeout(load, 200); |
36 |
| - return; |
37 |
| - } else { |
38 |
| - svgs.each(function() { |
39 |
| - var svg = d3.select(this); |
40 |
| - svg.html("<g class='wrapper'>" + svg.html() + "</g>"); |
41 |
| - var inner = svg.select("g"); |
42 |
| - var zoom = d3.zoom().on("zoom", function(event) { |
43 |
| - inner.attr("transform", event.transform); |
44 |
| - }); |
45 |
| - svg.call(zoom); |
46 |
| - }); |
47 |
| - } |
48 |
| - } |
49 |
| -}; |
50 |
| - |
51 |
| -window.addEventListener("load", load); |
52 |
| -</script> |
53 | 16 |
|
54 | 17 |
|
55 | 18 | <!-- bundled in js (rollup iife) -->
|
|
208 | 171 |
|
209 | 172 | <section id="powermon-logic">
|
210 | 173 | <h1>Powermon Logic<a class="headerlink" href="#powermon-logic" title="Link to this heading">¶</a></h1>
|
211 |
| -<pre data-zoom-id="id-905389ca-75e0-4f38-8925-742894cb8329" class="mermaid"> |
212 |
| - --- |
213 |
| -config: |
214 |
| - theme: base |
215 |
| - |
216 |
| ---- |
217 |
| -classDiagram |
218 |
| - direction LR |
219 |
| - Device "1" --o "1" Port |
220 |
| - Device "1" --o "1" MqttBroker |
221 |
| - Device "1" --o "*" Command |
222 |
| - class Device{ |
223 |
| - name |
224 |
| - device_id |
225 |
| - model |
226 |
| - manufacturer |
227 |
| - commands: list[Command] |
228 |
| - port: Port |
229 |
| - mqtt_broker: MqttBroker |
230 |
| - add_command(Command) |
231 |
| - run() |
232 |
| - } |
233 |
| - class Port{ |
234 |
| - protocol: Protocol |
235 |
| - run_command(Command) |
236 |
| - send_and_receive(Command) "called from run_command" |
237 |
| - } |
238 |
| - class Protocol{ |
239 |
| - protocol_id: str |
240 |
| - command_definitions: dict[int, CommandDefinition] |
241 |
| - add_command_definitions(command_definitions_config, result_type) |
242 |
| - get_command_definition(command: str) -> CommandDefinition |
243 |
| - get_full_command(command: str) -> bytes |
244 |
| - } |
245 |
| - Port "1" --o "1" Protocol |
246 |
| - class Command{ |
247 |
| - code: str |
248 |
| - type: str |
249 |
| - override: dict |
250 |
| - outputs: list[Output] |
251 |
| - trigger: Trigger |
252 |
| - command_definition: CommandDefinition |
253 |
| - is_due() -> bool |
254 |
| - build_result(raw_response: bytes, protocol: Protocol) -> Result |
255 |
| - } |
256 |
| - Command "1" --o "*" Output |
257 |
| - Command "1" --o "1" Trigger |
258 |
| - Command "1" --o "1" CommandDefinition |
259 |
| - Command "1" --o "1" Result |
260 |
| - class CommandDefinition{ |
261 |
| - code |
262 |
| - description |
263 |
| - help_text: str |
264 |
| - result_type: ResultType |
265 |
| - reading_definitions: list[ReadingDefinition] |
266 |
| - test_responses: list |
267 |
| - regex: str |
268 |
| - get_reading_definition(lookup: str|int) -> ReadingDefinition |
269 |
| - } |
270 |
| - CommandDefinition"1" --o "*" ReadingDefinition |
271 |
| - class ReadingDefinition{ |
272 |
| - index |
273 |
| - response_type: ResponseType |
274 |
| - description: str |
275 |
| - device_class: str |
276 |
| - state_class: str |
277 |
| - icon: str |
278 |
| - unit: str |
279 |
| - options: list | dict |
280 |
| - default: int | str |
281 |
| - format_template: str |
282 |
| - reading_from_raw_response(raw_value) -> list[Reading] |
283 |
| - translate_raw_response(raw_value) "calls reading_from_raw_response" |
284 |
| - } |
285 |
| - class Result{ |
286 |
| - result_type: ResultType |
287 |
| - command_definition: CommandDefinition |
288 |
| - raw_response: bytes |
289 |
| - readings: list[Reading] |
290 |
| - decode_responses(self, responses) -> list[Reading] |
291 |
| - readings_from_response(response, reading_definition: ReadingDefinition) -> list[Reading] |
292 |
| - } |
293 |
| - class Output{ |
294 |
| - name: str |
295 |
| - process(Command, Result, mqtt_broker, device_info) |
296 |
| - multiple_from_config() -> list[Output] |
297 |
| - } |
298 |
| - </pre><p>Notes:</p> |
| 174 | +<p>Notes:</p> |
299 | 175 | </section>
|
300 | 176 |
|
301 | 177 |
|
|
0 commit comments