pypck 0.8.7__tar.gz → 0.8.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypck
3
- Version: 0.8.7
3
+ Version: 0.8.9
4
4
  Summary: LCN-PCK library
5
5
  Home-page: https://github.com/alengwenus/pypck
6
6
  Author-email: Andre Lengwenus <alengwenus@gmail.com>
pypck-0.8.9/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.8.9
@@ -1173,7 +1173,7 @@ class ModStatusMotorPositionModule(ModInput):
1173
1173
  ModStatusMotorPositionModule(
1174
1174
  addr,
1175
1175
  int(motor) - 1,
1176
- float(position),
1176
+ 100 - float(position),
1177
1177
  )
1178
1178
  ]
1179
1179
 
@@ -174,19 +174,22 @@ class AbstractConnection:
174
174
  self.wants_ack, PckGenerator.rel_output(output_id, percent)
175
175
  )
176
176
 
177
- async def toggle_output(self, output_id: int, ramp: int) -> bool:
177
+ async def toggle_output(
178
+ self, output_id: int, ramp: int, to_memory: bool = False
179
+ ) -> bool:
178
180
  """Send a command that toggles a single output-port.
179
181
 
180
182
  Toggle mode: (on->off, off->on).
181
183
 
182
184
  :param int output_id: Output id 0..3
183
185
  :param int ramp: Ramp time in milliseconds
186
+ :param bool to_memory: If True, the dimming status is stored
184
187
 
185
188
  :returns: True if command was sent successfully, False otherwise
186
189
  :rtype: bool
187
190
  """
188
191
  return await self.send_command(
189
- self.wants_ack, PckGenerator.toggle_output(output_id, ramp)
192
+ self.wants_ack, PckGenerator.toggle_output(output_id, ramp, to_memory)
190
193
  )
191
194
 
192
195
  async def toggle_all_outputs(self, ramp: int) -> bool:
@@ -471,19 +471,21 @@ class PckGenerator:
471
471
  return pck
472
472
 
473
473
  @staticmethod
474
- def toggle_output(output_id: int, ramp: int) -> str:
474
+ def toggle_output(output_id: int, ramp: int, to_memory: bool = False) -> str:
475
475
  """Generate a command that toggles a single output-port.
476
476
 
477
477
  Toggle mode: (on->off, off->on).
478
478
 
479
479
  :param int output_id: Output id 0..3
480
480
  :param int ramp: Ramp value
481
+ :param bool to_memory: If True, the dimming status is stored
482
+
481
483
  :return: The PCK command (without address header) as text
482
484
  :rtype: str
483
485
  """
484
486
  if (output_id < 0) or (output_id > 3):
485
487
  raise ValueError("Invalid output_id.")
486
- return f"A{output_id + 1}TA{ramp:03d}"
488
+ return f"A{output_id + 1}{'MT' if to_memory else 'TA'}{ramp:03d}"
487
489
 
488
490
  @staticmethod
489
491
  def toggle_all_outputs(ramp: int) -> str:
@@ -645,7 +647,7 @@ class PckGenerator:
645
647
  return f"R8M{new_motor_id}{action}"
646
648
  elif mode == lcn_defs.MotorPositioningMode.MODULE:
647
649
  new_motor_id = 1 << motor_id
648
- return f"JH{position:03d}{new_motor_id:03d}"
650
+ return f"JH{100 - position:03d}{new_motor_id:03d}"
649
651
 
650
652
  return ""
651
653
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypck
3
- Version: 0.8.7
3
+ Version: 0.8.9
4
4
  Summary: LCN-PCK library
5
5
  Home-page: https://github.com/alengwenus/pypck
6
6
  Author-email: Andre Lengwenus <alengwenus@gmail.com>
@@ -165,6 +165,10 @@ COMMANDS = {
165
165
  f"A{output + 1:d}TA123": (PckGenerator.toggle_output, output, 123)
166
166
  for output in range(4)
167
167
  },
168
+ **{
169
+ f"A{output + 1:d}MT123": (PckGenerator.toggle_output, output, 123, True)
170
+ for output in range(4)
171
+ },
168
172
  "AU123": (PckGenerator.toggle_all_outputs, 123),
169
173
  # Relay state manipulation
170
174
  "R80-1U1-U0": (
@@ -254,10 +258,10 @@ COMMANDS = {
254
258
  50,
255
259
  MotorPositioningMode.MODULE,
256
260
  ),
257
- "JH100004": (
261
+ "JH030004": (
258
262
  PckGenerator.control_motor_relays_position,
259
263
  2,
260
- 100,
264
+ 70,
261
265
  MotorPositioningMode.MODULE,
262
266
  ),
263
267
  "X2001228000": (
@@ -261,11 +261,11 @@ MESSAGES = {
261
261
  ),
262
262
  ],
263
263
  # Status motor position via module
264
- ":M000010P1050": [
264
+ ":M000010P1070": [
265
265
  (
266
266
  ModStatusMotorPositionModule,
267
267
  0,
268
- 50,
268
+ 30,
269
269
  )
270
270
  ],
271
271
  # SKH
pypck-0.8.7/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.8.7
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes