dbus2mqtt 0.5.0__py3-none-any.whl → 0.5.1__py3-none-any.whl

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.

Potentially problematic release.


This version of dbus2mqtt might be problematic. Click here for more details.

@@ -3,9 +3,9 @@ import uuid
3
3
  import warnings
4
4
 
5
5
  from dataclasses import dataclass, field
6
- from typing import Annotated, Any, Literal
6
+ from typing import Any, Literal
7
7
 
8
- from pydantic import Field, SecretStr
8
+ from jsonargparse.typing import SecretStr
9
9
 
10
10
  from dbus2mqtt.template.templating import TemplateEngine
11
11
 
@@ -98,10 +98,15 @@ class FlowTriggerMqttMessageConfig:
98
98
  return template_engine.render_template(self.filter, bool, trigger_context)
99
99
  return True
100
100
 
101
- FlowTriggerConfig = Annotated[
102
- FlowTriggerScheduleConfig | FlowTriggerDbusSignalConfig | FlowTriggerBusNameAddedConfig | FlowTriggerBusNameRemovedConfig | FlowTriggerObjectAddedConfig | FlowTriggerObjectRemovedConfig | FlowTriggerMqttMessageConfig,
103
- Field(discriminator="type")
104
- ]
101
+ FlowTriggerConfig = (
102
+ FlowTriggerScheduleConfig
103
+ | FlowTriggerDbusSignalConfig
104
+ | FlowTriggerBusNameAddedConfig
105
+ | FlowTriggerBusNameRemovedConfig
106
+ | FlowTriggerObjectAddedConfig
107
+ | FlowTriggerObjectRemovedConfig
108
+ | FlowTriggerMqttMessageConfig
109
+ )
105
110
 
106
111
  @dataclass
107
112
  class FlowActionContextSetConfig:
@@ -124,10 +129,11 @@ class FlowActionLogConfig:
124
129
  type: Literal["log"] = "log"
125
130
  level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "INFO"
126
131
 
127
- FlowActionConfig = Annotated[
128
- FlowActionMqttPublishConfig | FlowActionContextSetConfig | FlowActionLogConfig,
129
- Field(discriminator="type")
130
- ]
132
+ FlowActionConfig = (
133
+ FlowActionMqttPublishConfig
134
+ | FlowActionContextSetConfig
135
+ | FlowActionLogConfig
136
+ )
131
137
 
132
138
  @dataclass
133
139
  class FlowConfig:
@@ -1,32 +1,38 @@
1
+ from typing import Any
2
+
1
3
  import jsonargparse
2
4
 
5
+ from yaml import YAMLError
3
6
 
4
- def _custom_yaml_load(stream):
5
- if isinstance(stream, str):
6
- v = stream.strip()
7
+ default_yaml_loader = jsonargparse.get_loader("yaml")
8
+ def _custom_yaml_load(stream: str) -> Any:
7
9
 
8
- # jsonargparse tries to parse yaml 1.1 boolean like values
9
- # Without this, str:"{'PlaybackStatus': 'Off'}" would become dict:{'PlaybackStatus': False}
10
- if v in ['on', 'On', 'off', 'Off', 'TRUE', 'FALSE', 'True', 'False']:
11
- return stream
10
+ v = stream.strip()
12
11
 
13
- # Anoyingly, values starting with {{ and ending with }} are working with the default yaml_loader
14
- # from jsonargparse. Somehow its not when we use the custom yaml loader.
15
- # This fixes it
16
- first_line = v.splitlines()[0].strip()
17
- if "#" not in first_line and ("{{" in first_line or first_line.startswith("{%")):
18
- return stream
12
+ # jsonargparse tries to parse yaml 1.1 boolean like values
13
+ # Without this, str:"{'PlaybackStatus': 'Off'}" would become dict:{'PlaybackStatus': False}
14
+ if v in ['on', 'On', 'off', 'Off', 'TRUE', 'FALSE', 'True', 'False']:
15
+ return stream
19
16
 
20
17
  # Delegate to default yaml loader from jsonargparse
21
- yaml_loader = jsonargparse.get_loader("yaml")
22
- return yaml_loader(stream)
18
+ return default_yaml_loader(stream)
23
19
 
24
20
  def new_argument_parser() -> jsonargparse.ArgumentParser:
25
21
 
26
22
  # register out custom yaml loader for jsonargparse
27
- jsonargparse.set_loader("yaml_custom", _custom_yaml_load)
23
+ jsonargparse.set_loader(
24
+ mode="yaml_custom",
25
+ loader_fn=_custom_yaml_load,
26
+ exceptions=(YAMLError,),
27
+ json_superset=True
28
+ )
28
29
 
29
30
  # unless specified otherwise, load config from config.yaml
30
- parser = jsonargparse.ArgumentParser(default_config_files=["config.yaml"], default_env=True, env_prefix=False, parser_mode="yaml_custom")
31
+ parser = jsonargparse.ArgumentParser(
32
+ default_config_files=["config.yaml"],
33
+ default_env=True,
34
+ env_prefix=False,
35
+ parser_mode="yaml_custom"
36
+ )
31
37
 
32
38
  return parser
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dbus2mqtt
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: General purpose DBus to MQTT bridge - expose signals, methods and properties over MQTT - featuring jinja based templating, payload enrichment and MPRIS / BlueZ / Home Assistant ready examples
5
5
  Project-URL: Documentation, https://jwnmulder.github.io/dbus2mqtt
6
6
  Project-URL: Source, https://github.com/jwnmulder/dbus2mqtt
@@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
20
21
  Classifier: Topic :: Home Automation
21
22
  Requires-Python: >=3.10
22
23
  Requires-Dist: apscheduler>=3.11.0
@@ -27,7 +28,6 @@ Requires-Dist: jinja2-ansible-filters>=1.3.2
27
28
  Requires-Dist: jinja2>=3.1.6
28
29
  Requires-Dist: jsonargparse>=4.38.0
29
30
  Requires-Dist: paho-mqtt>=2.1.0
30
- Requires-Dist: pydantic>=2.11.3
31
31
  Requires-Dist: python-dotenv>=1.1.0
32
32
  Requires-Dist: pyyaml>=6.0.2
33
33
  Description-Content-Type: text/markdown
@@ -122,4 +122,4 @@ See [subscriptions](https://jwnmulder.github.io/dbus2mqtt/subscriptions.html) fo
122
122
 
123
123
  For more advanced use-cases, dbus2mqtt has support for flows and Jinja2 based templates. A reference of all supported flow triggers and actions can be found on [flows](https://jwnmulder.github.io/dbus2mqtt/flows/index.html)
124
124
 
125
- Jinja templating documentation can be found here: [templating](templating/index.md)
125
+ Jinja templating documentation can be found here: [templating](https://jwnmulder.github.io/dbus2mqtt/templating/index.html)
@@ -2,8 +2,8 @@ dbus2mqtt/__init__.py,sha256=VunubKEH4_lne9Ttd2YRpyXjZMIAzyD2eiJ2sfvvTFU,362
2
2
  dbus2mqtt/__main__.py,sha256=NAoa3nwgBSQI22eWzzRx61SIDThDwXmUofWWZU3_4-Q,71
3
3
  dbus2mqtt/event_broker.py,sha256=8Iw1PNpH4IxQbpcFtNvPDc8_M8kuGarN6Kvz_a2aFfc,1468
4
4
  dbus2mqtt/main.py,sha256=Kr2LRVxWcPDtNwCj8Eqz9TxtGLAVrV4q0nizKh1pLXc,4539
5
- dbus2mqtt/config/__init__.py,sha256=tMAQ3JyoTgm4HziFew82SbdYIHMw7sNuEHN1kh4ZixA,5953
6
- dbus2mqtt/config/jsonarparse.py,sha256=XK7CrMCGiHZK2tq1IqSpzJ3hdV0gCOixJq3LXUDiEjg,1298
5
+ dbus2mqtt/config/__init__.py,sha256=daqVzuSxNnUNKtMoMYs73AdlkfS6goXUsxF1wnKi7y0,5894
6
+ dbus2mqtt/config/jsonarparse.py,sha256=-wcJW-O-Coqs0uqr5VVvk9mj6DWEm45NylSLkOhCECs,1084
7
7
  dbus2mqtt/dbus/dbus_client.py,sha256=PDZiscCF4imn7cxo5bDLmhQ8g9ZL-6RbGu5had1xiso,44832
8
8
  dbus2mqtt/dbus/dbus_types.py,sha256=NmPD9um499e49Pk8DWH4IrIPQh1BinHYQgoXllCNiDw,777
9
9
  dbus2mqtt/dbus/dbus_util.py,sha256=NUe_9Aohcib_bU8RUa19UPFteDZ0_WsmgCbbnmTUvcY,5814
@@ -17,8 +17,8 @@ dbus2mqtt/flow/actions/mqtt_publish.py,sha256=psNkTvaR3JZwAwpM4AqiZTDnA5UQX9r4CU
17
17
  dbus2mqtt/mqtt/mqtt_client.py,sha256=qvhaxtftdE7uS5Vhw-Dvhaicro4pWGtGlk254m2nEtI,8076
18
18
  dbus2mqtt/template/dbus_template_functions.py,sha256=oYXJ4HC1XCFGarf_tRzNGhvx2ECXDoT9J4Mz-cxqoJg,2447
19
19
  dbus2mqtt/template/templating.py,sha256=QLar09NinZO8rYGbVs9EThX-SOyTeBVCOppueU7VYdo,4483
20
- dbus2mqtt-0.5.0.dist-info/METADATA,sha256=n1EGYCUprF0KVqifoD1hXN0nwQZa78_qGphx14H2up8,5334
21
- dbus2mqtt-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
- dbus2mqtt-0.5.0.dist-info/entry_points.txt,sha256=pmmacoHCsvTTUB5dIPaY4i0H9gX7BQlpd3rBU-Jbv3A,50
23
- dbus2mqtt-0.5.0.dist-info/licenses/LICENSE,sha256=a4bIEgyA9rrnAfUN90CgbgZ6BQIFHeABkk0JihiBaxM,1074
24
- dbus2mqtt-0.5.0.dist-info/RECORD,,
20
+ dbus2mqtt-0.5.1.dist-info/METADATA,sha256=bvfnVoBAYjKCvTYwqyBpVlX98ObW9gjg1bWhYtfUBWg,5393
21
+ dbus2mqtt-0.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
+ dbus2mqtt-0.5.1.dist-info/entry_points.txt,sha256=pmmacoHCsvTTUB5dIPaY4i0H9gX7BQlpd3rBU-Jbv3A,50
23
+ dbus2mqtt-0.5.1.dist-info/licenses/LICENSE,sha256=a4bIEgyA9rrnAfUN90CgbgZ6BQIFHeABkk0JihiBaxM,1074
24
+ dbus2mqtt-0.5.1.dist-info/RECORD,,