moat-kv-ow 0.9.4__tar.gz → 0.9.7__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.
- moat_kv_ow-0.9.7/LICENSE.txt +14 -0
- {moat-kv-ow-0.9.4/moat_kv_ow.egg-info → moat_kv_ow-0.9.7}/PKG-INFO +6 -5
- moat_kv_ow-0.9.7/debian/.gitignore +8 -0
- moat_kv_ow-0.9.7/debian/changelog +215 -0
- moat_kv_ow-0.9.7/debian/control +24 -0
- moat_kv_ow-0.9.7/debian/rules +16 -0
- moat_kv_ow-0.9.7/debian/source/format +1 -0
- moat_kv_ow-0.9.7/debian/watch +4 -0
- moat_kv_ow-0.9.7/pyproject.toml +37 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7/src}/moat/kv/ow/__init__.py +2 -0
- moat_kv_ow-0.9.7/src/moat/kv/ow/_cfg.yaml +2 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7/src}/moat/kv/ow/_main.py +19 -10
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7/src}/moat/kv/ow/mock.py +11 -6
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7/src}/moat/kv/ow/model.py +33 -12
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7/src}/moat/kv/ow/task.py +5 -1
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7/src/moat_kv_ow.egg-info}/PKG-INFO +6 -5
- moat_kv_ow-0.9.7/src/moat_kv_ow.egg-info/SOURCES.txt +27 -0
- moat_kv_ow-0.9.7/src/moat_kv_ow.egg-info/requires.txt +1 -0
- moat_kv_ow-0.9.7/systemd/moat-kv-ow@.service +19 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7}/tools/update-0-4.py +7 -3
- moat-kv-ow-0.9.4/.gitignore +0 -8
- moat-kv-ow-0.9.4/.pylintrc +0 -3
- moat-kv-ow-0.9.4/moat/kv/ow/_config.yaml +0 -4
- moat-kv-ow-0.9.4/moat_kv_ow.egg-info/SOURCES.txt +0 -24
- moat-kv-ow-0.9.4/moat_kv_ow.egg-info/requires.txt +0 -1
- moat-kv-ow-0.9.4/pyproject.toml +0 -98
- moat-kv-ow-0.9.4/tests/__init__.py +0 -0
- moat-kv-ow-0.9.4/tests/conftest.py +0 -5
- moat-kv-ow-0.9.4/tests/test_alarm.py +0 -75
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7}/Makefile +0 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7}/README.rst +0 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7}/TODO.rst +0 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7}/USAGE.rst +0 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7}/moat-kv-ow@.service +0 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7}/setup.cfg +0 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7/src}/moat_kv_ow.egg-info/dependency_links.txt +0 -0
- {moat-kv-ow-0.9.4 → moat_kv_ow-0.9.7/src}/moat_kv_ow.egg-info/top_level.txt +0 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
The code in this repository, and all MoaT submodules it refers to,
|
2
|
+
is part of the MoaT project.
|
3
|
+
|
4
|
+
Unless a submodule's LICENSE.txt states otherwise, all included files are
|
5
|
+
licensed under the LGPL V3, as published by the FSF at
|
6
|
+
https://www.gnu.org/licenses/lgpl-3.0.html .
|
7
|
+
|
8
|
+
In addition to the LGPL's terms, the author(s) respectfully ask all users of
|
9
|
+
this code to contribute any bug fixes or enhancements. Also, please link back to
|
10
|
+
https://M-o-a-T.org.
|
11
|
+
|
12
|
+
Thank you.
|
13
|
+
|
14
|
+
Copyright © 2021 ff.: the MoaT contributor(s), as per the git changelog(s).
|
@@ -1,20 +1,21 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: moat-kv-ow
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.7
|
4
4
|
Summary: 1wire connector for MoaT-KV
|
5
5
|
Author-email: Matthias Urlichs <matthias@urlichs.de>
|
6
6
|
Project-URL: homepage, https://m-o-a-t.org
|
7
|
-
Project-URL: repository, https://github.com/M-o-a-T/moat
|
7
|
+
Project-URL: repository, https://github.com/M-o-a-T/moat
|
8
8
|
Keywords: MoaT
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
10
10
|
Classifier: Intended Audience :: Information Technology
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
12
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
13
11
|
Classifier: Programming Language :: Python :: 3
|
14
12
|
Classifier: Topic :: Database
|
15
13
|
Classifier: Topic :: Home Automation
|
16
14
|
Requires-Python: >=3.8
|
17
15
|
Description-Content-Type: text/x-rst
|
16
|
+
License-File: LICENSE.txt
|
17
|
+
Requires-Dist: moat-kv~=0.70.24
|
18
|
+
Dynamic: license-file
|
18
19
|
|
19
20
|
==========
|
20
21
|
MoaT-KV-OW
|
@@ -0,0 +1,215 @@
|
|
1
|
+
moat-kv-ow (0.9.7-1) unstable; urgency=medium
|
2
|
+
|
3
|
+
* New release for 25.1.24
|
4
|
+
|
5
|
+
-- Matthias Urlichs <matthias@urlichs.de> Tue, 06 May 2025 11:32:51 +0200
|
6
|
+
|
7
|
+
moat-kv-ow (0.9.6-5) unstable; urgency=medium
|
8
|
+
|
9
|
+
* New release for 25.1.13
|
10
|
+
|
11
|
+
-- Matthias Urlichs <matthias@urlichs.de> Tue, 06 May 2025 02:05:48 +0200
|
12
|
+
|
13
|
+
moat-kv-ow (0.9.6-4) unstable; urgency=medium
|
14
|
+
|
15
|
+
* New release for 25.1.10
|
16
|
+
|
17
|
+
-- Matthias Urlichs <matthias@urlichs.de> Mon, 05 May 2025 06:34:17 +0200
|
18
|
+
|
19
|
+
moat-kv-ow (0.9.6-2) unstable; urgency=medium
|
20
|
+
|
21
|
+
* New release for 25.1.8
|
22
|
+
|
23
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sun, 04 May 2025 19:50:13 +0200
|
24
|
+
|
25
|
+
moat-kv-ow (0.9.6-1) unstable; urgency=medium
|
26
|
+
|
27
|
+
* New release for 25.1.2
|
28
|
+
|
29
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sun, 04 May 2025 16:22:16 +0200
|
30
|
+
|
31
|
+
moat-kv-ow (0.9.5-1) unstable; urgency=medium
|
32
|
+
|
33
|
+
* New release for 25.0.2
|
34
|
+
|
35
|
+
-- Matthias Urlichs <matthias@urlichs.de> Fri, 21 Mar 2025 12:03:16 +0100
|
36
|
+
|
37
|
+
distkv-owfs (0.7.4-1) unstable; urgency=medium
|
38
|
+
|
39
|
+
* Merge
|
40
|
+
|
41
|
+
-- Matthias Urlichs <matthias@urlichs.de> Wed, 30 Nov 2022 16:44:36 +0100
|
42
|
+
|
43
|
+
distkv-owfs (0.7.3-1) unstable; urgency=medium
|
44
|
+
|
45
|
+
* Merge
|
46
|
+
|
47
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 19 Nov 2022 20:16:02 +0100
|
48
|
+
|
49
|
+
distkv-owfs (0.7.2-1) unstable; urgency=medium
|
50
|
+
|
51
|
+
* Merge
|
52
|
+
|
53
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 19 Nov 2022 15:39:03 +0100
|
54
|
+
|
55
|
+
distkv-owfs (0.7.1-1) unstable; urgency=medium
|
56
|
+
|
57
|
+
* Merge
|
58
|
+
|
59
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 19 Nov 2022 15:36:22 +0100
|
60
|
+
|
61
|
+
distkv-owfs (0.7.1-1) unstable; urgency=medium
|
62
|
+
|
63
|
+
* Merge
|
64
|
+
|
65
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 19 Nov 2022 15:35:41 +0100
|
66
|
+
|
67
|
+
distkv-owfs (0.7.0-1) unstable; urgency=medium
|
68
|
+
|
69
|
+
* Merge
|
70
|
+
|
71
|
+
-- Matthias Urlichs <matthias@urlichs.de> Fri, 04 Nov 2022 18:32:06 +0100
|
72
|
+
|
73
|
+
distkv-owfs (0.6.2-1) unstable; urgency=medium
|
74
|
+
|
75
|
+
* Merge
|
76
|
+
|
77
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 28 Aug 2021 14:04:01 +0200
|
78
|
+
|
79
|
+
distkv-owfs (0.6.0-1) unstable; urgency=medium
|
80
|
+
|
81
|
+
* Merge
|
82
|
+
|
83
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sun, 07 Feb 2021 18:55:25 +0100
|
84
|
+
|
85
|
+
distkv-owfs (0.6.0-1) unstable; urgency=medium
|
86
|
+
|
87
|
+
* Merge
|
88
|
+
|
89
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sun, 07 Feb 2021 18:53:09 +0100
|
90
|
+
|
91
|
+
distowfs (0.4.5-1) unstable; urgency=medium
|
92
|
+
|
93
|
+
* Merge
|
94
|
+
|
95
|
+
-- Matthias Urlichs <matthias@urlichs.de> Thu, 30 Jul 2020 03:02:26 +0200
|
96
|
+
|
97
|
+
distowfs (0.4.4-1) unstable; urgency=medium
|
98
|
+
|
99
|
+
* Merge
|
100
|
+
|
101
|
+
-- Matthias Urlichs <matthias@urlichs.de> Wed, 29 Jul 2020 16:30:23 +0200
|
102
|
+
|
103
|
+
distowfs (0.4.3-1) unstable; urgency=medium
|
104
|
+
|
105
|
+
* Merge
|
106
|
+
|
107
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 11 Jul 2020 13:10:18 +0200
|
108
|
+
|
109
|
+
distowfs (0.4.2-1) unstable; urgency=medium
|
110
|
+
|
111
|
+
* Merge
|
112
|
+
|
113
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 11 Jul 2020 11:46:35 +0200
|
114
|
+
|
115
|
+
distowfs (0.4.1-1) unstable; urgency=medium
|
116
|
+
|
117
|
+
* Merge
|
118
|
+
|
119
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 11 Jul 2020 10:14:52 +0200
|
120
|
+
|
121
|
+
distowfs (0.4.0-1) unstable; urgency=medium
|
122
|
+
|
123
|
+
* Merge
|
124
|
+
|
125
|
+
-- Matthias Urlichs <matthias@urlichs.de> Fri, 10 Jul 2020 19:28:29 +0200
|
126
|
+
|
127
|
+
distowfs (0.3.5-1) unstable; urgency=medium
|
128
|
+
|
129
|
+
* Merge
|
130
|
+
|
131
|
+
-- Matthias Urlichs <matthias@urlichs.de> Tue, 07 Jul 2020 19:03:43 +0200
|
132
|
+
|
133
|
+
distowfs (0.3.4-2) unstable; urgency=medium
|
134
|
+
|
135
|
+
* Tighten requirements
|
136
|
+
|
137
|
+
-- Matthias Urlichs <matthias@urlichs.de> Tue, 07 Jul 2020 13:54:22 +0200
|
138
|
+
|
139
|
+
distowfs (0.3.4-1) unstable; urgency=medium
|
140
|
+
|
141
|
+
* Merge
|
142
|
+
|
143
|
+
-- Matthias Urlichs <matthias@urlichs.de> Tue, 07 Jul 2020 13:52:39 +0200
|
144
|
+
|
145
|
+
distowfs (0.3.3-1) unstable; urgency=medium
|
146
|
+
|
147
|
+
* Merge
|
148
|
+
|
149
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sun, 05 Jul 2020 13:51:44 +0200
|
150
|
+
|
151
|
+
distowfs (0.3.2-1) unstable; urgency=medium
|
152
|
+
|
153
|
+
* Merge
|
154
|
+
|
155
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sun, 05 Jul 2020 12:09:18 +0200
|
156
|
+
|
157
|
+
distowfs (0.3.1-1) unstable; urgency=medium
|
158
|
+
|
159
|
+
* Merge
|
160
|
+
|
161
|
+
-- Matthias Urlichs <matthias@urlichs.de> Tue, 30 Jun 2020 18:11:13 +0200
|
162
|
+
|
163
|
+
distowfs (0.2.2-5) unstable; urgency=medium
|
164
|
+
|
165
|
+
* debian/compat, dammit
|
166
|
+
|
167
|
+
-- Matthias Urlichs <matthias@urlichs.de> Mon, 29 Jun 2020 14:24:53 +0200
|
168
|
+
|
169
|
+
distowfs (0.2.2-4) unstable; urgency=medium
|
170
|
+
|
171
|
+
* install service file
|
172
|
+
|
173
|
+
-- Matthias Urlichs <matthias@urlichs.de> Mon, 29 Jun 2020 14:09:54 +0200
|
174
|
+
|
175
|
+
distowfs (0.2.2-3) unstable; urgency=medium
|
176
|
+
|
177
|
+
* *sigh*
|
178
|
+
|
179
|
+
-- Matthias Urlichs <matthias@urlichs.de> Mon, 29 Jun 2020 13:46:23 +0200
|
180
|
+
|
181
|
+
distowfs (0.2.2-2) unstable; urgency=medium
|
182
|
+
|
183
|
+
* Stupidity
|
184
|
+
|
185
|
+
-- Matthias Urlichs <matthias@urlichs.de> Mon, 29 Jun 2020 12:46:52 +0200
|
186
|
+
|
187
|
+
distowfs (0.2.2-1) unstable; urgency=medium
|
188
|
+
|
189
|
+
* Merge
|
190
|
+
|
191
|
+
-- Matthias Urlichs <matthias@urlichs.de> Mon, 29 Jun 2020 12:45:52 +0200
|
192
|
+
|
193
|
+
distowfs (0.2.1-1) unstable; urgency=medium
|
194
|
+
|
195
|
+
* Merge 0.2.1
|
196
|
+
|
197
|
+
-- Matthias Urlichs <matthias@urlichs.de> Tue, 27 Aug 2019 13:41:06 +0200
|
198
|
+
|
199
|
+
distowfs (0.2.0-3) unstable; urgency=medium
|
200
|
+
|
201
|
+
* Rename binary package
|
202
|
+
|
203
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 10 Aug 2019 19:19:32 +0200
|
204
|
+
|
205
|
+
distowfs (0.2.0-2) unstable; urgency=medium
|
206
|
+
|
207
|
+
* Deps
|
208
|
+
|
209
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 10 Aug 2019 19:16:23 +0200
|
210
|
+
|
211
|
+
distowfs (0.2.0-1) unstable; urgency=low
|
212
|
+
|
213
|
+
* source package automatically created by stdeb 0.8.5
|
214
|
+
|
215
|
+
-- Matthias Urlichs <matthias@urlichs.de> Sat, 10 Aug 2019 19:10:20 +0200
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Source: moat-kv-ow
|
2
|
+
Maintainer: Matthias Urlichs <matthias@urlichs.de>
|
3
|
+
Section: python
|
4
|
+
Priority: optional
|
5
|
+
Build-Depends: dh-python, python3-all, debhelper (>= 13), debhelper-compat (= 13),
|
6
|
+
python3-setuptools,
|
7
|
+
python3-wheel,
|
8
|
+
Standards-Version: 3.9.6
|
9
|
+
Homepage: https://github.com/smurfix/distowfs
|
10
|
+
|
11
|
+
Package: moat-kv-ow
|
12
|
+
Architecture: all
|
13
|
+
Depends: ${misc:Depends}, ${python3:Depends},
|
14
|
+
moat-kv,
|
15
|
+
python3-asyncowfs (>= 0.12.0),
|
16
|
+
Replaces: python3-distowfs
|
17
|
+
Conflicts: python3-distowfs
|
18
|
+
Description: A distributed no-master key-value store
|
19
|
+
DistOWFS is a link between 1wire and DistKV.
|
20
|
+
.
|
21
|
+
It will add all discovered 1wire devices, poll these devices as specified,
|
22
|
+
write values that it reads from 1wire to some DistKV entry, monitor a DistKV
|
23
|
+
entry and write any updates to 1wire, and work with DistKV's runner system,
|
24
|
+
either centrally or distributed.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/make -f
|
2
|
+
|
3
|
+
# This file was automatically generated by stdeb 0.8.5 at
|
4
|
+
# Sat, 10 Aug 2019 19:10:20 +0200
|
5
|
+
export PYBUILD_NAME=moat-kv-ow
|
6
|
+
%:
|
7
|
+
dh $@ --with python3 --buildsystem=pybuild
|
8
|
+
|
9
|
+
debian/moat-kv-ow@.service: systemd/moat-kv-ow@.service
|
10
|
+
cp $< $@
|
11
|
+
|
12
|
+
override_dh_auto_install: debian/moat-kv-ow@.service
|
13
|
+
dh_auto_install
|
14
|
+
|
15
|
+
override_dh_auto_test:
|
16
|
+
: skip
|
@@ -0,0 +1 @@
|
|
1
|
+
3.0 (quilt)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
[build-system]
|
2
|
+
build-backend = "setuptools.build_meta"
|
3
|
+
requires = [ "setuptools", "wheel",]
|
4
|
+
|
5
|
+
[project]
|
6
|
+
classifiers = [
|
7
|
+
"Development Status :: 4 - Beta",
|
8
|
+
"Intended Audience :: Information Technology",
|
9
|
+
"Programming Language :: Python :: 3",
|
10
|
+
"Topic :: Database",
|
11
|
+
"Topic :: Home Automation",
|
12
|
+
]
|
13
|
+
dependencies = [
|
14
|
+
"moat-kv ~= 0.70.24",
|
15
|
+
]
|
16
|
+
version = "0.9.7"
|
17
|
+
keywords = [ "MoaT",]
|
18
|
+
requires-python = ">=3.8"
|
19
|
+
name = "moat-kv-ow"
|
20
|
+
description = "1wire connector for MoaT-KV"
|
21
|
+
readme = "README.rst"
|
22
|
+
|
23
|
+
[[project.authors]]
|
24
|
+
email = "matthias@urlichs.de"
|
25
|
+
name = "Matthias Urlichs"
|
26
|
+
|
27
|
+
[project.urls]
|
28
|
+
homepage = "https://m-o-a-t.org"
|
29
|
+
repository = "https://github.com/M-o-a-T/moat"
|
30
|
+
|
31
|
+
[tool.setuptools]
|
32
|
+
[tool.setuptools.packages.find]
|
33
|
+
where = ["src"]
|
34
|
+
|
35
|
+
[tool.setuptools.package-data]
|
36
|
+
"*" = ["*.yaml"]
|
37
|
+
|
@@ -1,7 +1,17 @@
|
|
1
1
|
# command line interface
|
2
|
+
from __future__ import annotations
|
2
3
|
|
3
4
|
import asyncclick as click
|
4
|
-
from moat.util import
|
5
|
+
from moat.util import (
|
6
|
+
yprint,
|
7
|
+
attrdict,
|
8
|
+
NotGiven,
|
9
|
+
P,
|
10
|
+
Path,
|
11
|
+
as_service,
|
12
|
+
attr_args,
|
13
|
+
ensure_cfg,
|
14
|
+
)
|
5
15
|
from moat.kv.data import data_get, node_attr
|
6
16
|
from .model import OWFSroot
|
7
17
|
|
@@ -17,6 +27,7 @@ async def cli(obj):
|
|
17
27
|
List Onewire devices, modify device handling …
|
18
28
|
"""
|
19
29
|
obj.data = await OWFSroot.as_handler(obj.client)
|
30
|
+
ensure_cfg("moat.kv.ow", obj.cfg)
|
20
31
|
|
21
32
|
|
22
33
|
@cli.command("list")
|
@@ -36,7 +47,7 @@ async def list_(obj, device, family):
|
|
36
47
|
def pm(p):
|
37
48
|
if len(p) < 1:
|
38
49
|
return path
|
39
|
-
return Path("
|
50
|
+
return Path(f"{f:02x}.{p[0]:12x}", *p[1:])
|
40
51
|
|
41
52
|
elif device:
|
42
53
|
f, d = device.split(".", 2)[0:2]
|
@@ -56,9 +67,10 @@ async def list_(obj, device, family):
|
|
56
67
|
elif len(p) == 1:
|
57
68
|
return Path("%02x" % p[0])
|
58
69
|
else:
|
59
|
-
return Path("
|
70
|
+
return Path(f"{p[0]:02x}.{p[1]:12x}") + p[2:]
|
60
71
|
|
61
72
|
if obj.meta:
|
73
|
+
|
62
74
|
def pm(p):
|
63
75
|
return Path(str(prefix + path)) + p
|
64
76
|
|
@@ -127,7 +139,7 @@ async def attr__(obj, device, family, write, attr, interval, path, attr_):
|
|
127
139
|
@attr_args
|
128
140
|
@click.argument("subpath", nargs=1, type=P, default=P(":"))
|
129
141
|
@click.pass_obj
|
130
|
-
async def set_(obj, device, family, subpath,
|
142
|
+
async def set_(obj, device, family, subpath, **kw):
|
131
143
|
"""Set or delete some random attribute.
|
132
144
|
|
133
145
|
For deletion, use '-e ATTR -'.
|
@@ -143,7 +155,7 @@ async def set_(obj, device, family, subpath, vars_, eval_, path_):
|
|
143
155
|
f, d = device.split(".", 2)[0:2]
|
144
156
|
fd = (int(f, 16), int(d, 16))
|
145
157
|
|
146
|
-
res = await node_attr(obj, obj.cfg.kv.ow.prefix + fd + subpath,
|
158
|
+
res = await node_attr(obj, obj.cfg.kv.ow.prefix + fd + subpath, **kw)
|
147
159
|
if res and obj.meta:
|
148
160
|
yprint(res, stream=obj.stdout)
|
149
161
|
|
@@ -164,9 +176,7 @@ async def server_(obj, name, host, port, delete):
|
|
164
176
|
if not name:
|
165
177
|
if host or port or delete:
|
166
178
|
raise click.UsageError("Use a server name to set parameters")
|
167
|
-
async for r in obj.client.get_tree(
|
168
|
-
prefix | "server", min_depth=1, max_depth=1
|
169
|
-
):
|
179
|
+
async for r in obj.client.get_tree(prefix | "server", min_depth=1, max_depth=1):
|
170
180
|
print(r.path[-1], file=obj.stdout)
|
171
181
|
return
|
172
182
|
elif len(name) > 1:
|
@@ -190,8 +200,7 @@ async def server_(obj, name, host, port, delete):
|
|
190
200
|
return
|
191
201
|
else:
|
192
202
|
value = None
|
193
|
-
res = await node_attr(
|
194
|
-
obj, prefix | "server" | name, ((P("server"), value),),(),())
|
203
|
+
res = await node_attr(obj, prefix | "server" | name, ((P("server"), value),), (), ())
|
195
204
|
if res and obj.meta:
|
196
205
|
yprint(res, stream=obj.stdout)
|
197
206
|
|
@@ -1,31 +1,36 @@
|
|
1
|
+
from __future__ import annotations
|
1
2
|
import os
|
2
3
|
import anyio
|
3
4
|
from functools import partial
|
4
5
|
from asyncowfs.mock import some_server
|
6
|
+
from moat.util import ensure_cfg
|
5
7
|
|
6
8
|
from .task import task
|
9
|
+
import contextlib
|
7
10
|
|
8
11
|
PORT = ((os.getpid() + 101) % 9999) + 40000
|
9
12
|
|
10
13
|
|
11
14
|
async def server(client, tree={}, options={}, evt=None): # pylint: disable=dangerous-default-value
|
12
|
-
|
13
15
|
async with anyio.create_task_group() as tg:
|
14
16
|
listener = await anyio.create_tcp_listener(
|
15
|
-
local_host="127.0.0.1",
|
17
|
+
local_host="127.0.0.1",
|
18
|
+
local_port=PORT,
|
19
|
+
reuse_port=True,
|
16
20
|
)
|
17
21
|
|
18
22
|
async def may_close():
|
19
|
-
|
23
|
+
with contextlib.suppress(anyio.ClosedResourceError, anyio.BrokenResourceError):
|
20
24
|
await listener.serve(partial(some_server, tree, options))
|
21
|
-
except (anyio.ClosedResourceError, anyio.BrokenResourceError):
|
22
|
-
pass
|
23
25
|
|
24
26
|
addr = listener.extra(anyio.abc.SocketAttribute.raw_socket).getsockname()
|
25
27
|
tg.start_soon(may_close)
|
26
28
|
|
29
|
+
cfg = {"kv": client._cfg}
|
30
|
+
ensure_cfg("moat.kv.ow", cfg)
|
31
|
+
|
27
32
|
await client.set(
|
28
|
-
client._cfg.
|
33
|
+
client._cfg.ow.prefix + ("server", "127.0.0.1"),
|
29
34
|
value=dict(server=dict(host="127.0.0.1", port=addr[1])),
|
30
35
|
)
|
31
36
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
"""
|
2
2
|
Moat-KV client data model for 1wire
|
3
3
|
"""
|
4
|
+
|
5
|
+
from __future__ import annotations
|
6
|
+
|
4
7
|
import anyio
|
5
8
|
|
6
9
|
from moat.util import combine_dict, attrdict
|
@@ -67,7 +70,9 @@ class OWFSattr(ClientEntry):
|
|
67
70
|
await self.root._tg.start(self._watch_src)
|
68
71
|
else:
|
69
72
|
await self.root.err.record_working(
|
70
|
-
"owfs",
|
73
|
+
"owfs",
|
74
|
+
self.subpath + ("write",),
|
75
|
+
comment="dropped",
|
71
76
|
)
|
72
77
|
|
73
78
|
# poll OWFS
|
@@ -88,7 +93,9 @@ class OWFSattr(ClientEntry):
|
|
88
93
|
await dev.set_polling_interval(self.attr, intv)
|
89
94
|
else:
|
90
95
|
await self.root.err.record_working(
|
91
|
-
"owfs",
|
96
|
+
"owfs",
|
97
|
+
self.subpath + ("read",),
|
98
|
+
comment="dropped",
|
92
99
|
)
|
93
100
|
except RuntimeError as exc:
|
94
101
|
await self.root.err.record_error("owfs", self.subpath + ("read",), exc=exc)
|
@@ -136,7 +143,10 @@ class OWFSattr(ClientEntry):
|
|
136
143
|
with anyio.CancelScope() as sc:
|
137
144
|
try:
|
138
145
|
async with self.client.watch(
|
139
|
-
self.watch_src,
|
146
|
+
self.watch_src,
|
147
|
+
min_depth=0,
|
148
|
+
max_depth=0,
|
149
|
+
fetch=True,
|
140
150
|
) as wp:
|
141
151
|
if self.watch_src_scope is not None:
|
142
152
|
self.watch_src_scope.cancel()
|
@@ -157,19 +167,27 @@ class OWFSattr(ClientEntry):
|
|
157
167
|
"owfs",
|
158
168
|
self.subpath + ("write",),
|
159
169
|
comment="Attribute missing",
|
160
|
-
data={
|
170
|
+
data={
|
171
|
+
"key": k,
|
172
|
+
"attr": self.watch_src_attr,
|
173
|
+
"msg": msg,
|
174
|
+
},
|
161
175
|
)
|
162
176
|
return
|
163
177
|
else:
|
164
178
|
dev = self.node.dev
|
165
179
|
if dev is None:
|
166
180
|
await self.root.err.record_error(
|
167
|
-
"owfs",
|
181
|
+
"owfs",
|
182
|
+
self.subpath + ("write",),
|
183
|
+
comment="device missing",
|
168
184
|
)
|
169
185
|
return
|
170
186
|
await dev.set(*self.attr, value=val)
|
171
187
|
await self.root.err.record_working(
|
172
|
-
"owfs",
|
188
|
+
"owfs",
|
189
|
+
self.subpath + ("write",),
|
190
|
+
comment="write OK",
|
173
191
|
)
|
174
192
|
|
175
193
|
except Exception as exc:
|
@@ -237,7 +255,7 @@ class OWFSfamily(ClientEntry):
|
|
237
255
|
def child_type(cls, name):
|
238
256
|
if not isinstance(name, int):
|
239
257
|
return ClientEntry
|
240
|
-
if name <= 0 or name > 16
|
258
|
+
if name <= 0 or name > 16**12:
|
241
259
|
return ClientEntry
|
242
260
|
return cls.cls
|
243
261
|
|
@@ -297,19 +315,22 @@ class OWFSroot(ClientRoot):
|
|
297
315
|
class FamilyX(OWFSfamily):
|
298
316
|
cls = kls.reg.get(name, OWFSnode)
|
299
317
|
|
300
|
-
FamilyX.__name__ = "OWFSfamily_
|
318
|
+
FamilyX.__name__ = f"OWFSfamily_{name:02X}"
|
301
319
|
kls.cls[name] = FamilyX
|
302
320
|
return FamilyX
|
303
321
|
|
322
|
+
|
304
323
|
class BrokenDict:
|
305
324
|
def __getattr__(self, k, v=None):
|
306
|
-
import pdb
|
307
|
-
|
308
|
-
|
325
|
+
import pdb
|
326
|
+
|
327
|
+
pdb.set_trace()
|
328
|
+
return object.__getattribute__(self, k, v)
|
329
|
+
|
309
330
|
|
310
331
|
@OWFSroot.register(0x10)
|
311
332
|
class TempNode(OWFSnode):
|
312
|
-
CFG = BrokenDict()
|
333
|
+
CFG = BrokenDict() # {"temperature": 30}
|
313
334
|
|
314
335
|
@classmethod
|
315
336
|
def child_type(cls, name):
|
@@ -2,6 +2,8 @@
|
|
2
2
|
OWFS task for DistKV
|
3
3
|
"""
|
4
4
|
|
5
|
+
from __future__ import annotations
|
6
|
+
|
5
7
|
import anyio
|
6
8
|
from asyncowfs import OWFS
|
7
9
|
from asyncowfs.event import (
|
@@ -51,7 +53,9 @@ async def mon(ow, hd):
|
|
51
53
|
if isinstance(msg.attribute, str):
|
52
54
|
attr = (attr,)
|
53
55
|
await node.root.err.record_error(
|
54
|
-
"onewire",
|
56
|
+
"onewire",
|
57
|
+
Path.build(node.subpath) + attr,
|
58
|
+
exc=msg.exception,
|
55
59
|
)
|
56
60
|
|
57
61
|
elif isinstance(msg, DeviceValue):
|
@@ -1,20 +1,21 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: moat-kv-ow
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.7
|
4
4
|
Summary: 1wire connector for MoaT-KV
|
5
5
|
Author-email: Matthias Urlichs <matthias@urlichs.de>
|
6
6
|
Project-URL: homepage, https://m-o-a-t.org
|
7
|
-
Project-URL: repository, https://github.com/M-o-a-T/moat
|
7
|
+
Project-URL: repository, https://github.com/M-o-a-T/moat
|
8
8
|
Keywords: MoaT
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
10
10
|
Classifier: Intended Audience :: Information Technology
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
12
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
13
11
|
Classifier: Programming Language :: Python :: 3
|
14
12
|
Classifier: Topic :: Database
|
15
13
|
Classifier: Topic :: Home Automation
|
16
14
|
Requires-Python: >=3.8
|
17
15
|
Description-Content-Type: text/x-rst
|
16
|
+
License-File: LICENSE.txt
|
17
|
+
Requires-Dist: moat-kv~=0.70.24
|
18
|
+
Dynamic: license-file
|
18
19
|
|
19
20
|
==========
|
20
21
|
MoaT-KV-OW
|
@@ -0,0 +1,27 @@
|
|
1
|
+
LICENSE.txt
|
2
|
+
Makefile
|
3
|
+
README.rst
|
4
|
+
TODO.rst
|
5
|
+
USAGE.rst
|
6
|
+
moat-kv-ow@.service
|
7
|
+
pyproject.toml
|
8
|
+
setup.cfg
|
9
|
+
debian/.gitignore
|
10
|
+
debian/changelog
|
11
|
+
debian/control
|
12
|
+
debian/rules
|
13
|
+
debian/watch
|
14
|
+
debian/source/format
|
15
|
+
src/moat/kv/ow/__init__.py
|
16
|
+
src/moat/kv/ow/_cfg.yaml
|
17
|
+
src/moat/kv/ow/_main.py
|
18
|
+
src/moat/kv/ow/mock.py
|
19
|
+
src/moat/kv/ow/model.py
|
20
|
+
src/moat/kv/ow/task.py
|
21
|
+
src/moat_kv_ow.egg-info/PKG-INFO
|
22
|
+
src/moat_kv_ow.egg-info/SOURCES.txt
|
23
|
+
src/moat_kv_ow.egg-info/dependency_links.txt
|
24
|
+
src/moat_kv_ow.egg-info/requires.txt
|
25
|
+
src/moat_kv_ow.egg-info/top_level.txt
|
26
|
+
systemd/moat-kv-ow@.service
|
27
|
+
tools/update-0-4.py
|
@@ -0,0 +1 @@
|
|
1
|
+
moat-kv~=0.70.24
|
@@ -0,0 +1,19 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=Moat-KV OWFS server
|
3
|
+
After=moat-kv.service
|
4
|
+
Requires=moat-kv.service
|
5
|
+
|
6
|
+
ConditionFileNotEmpty=/etc/moat/moat.cfg
|
7
|
+
|
8
|
+
[Install]
|
9
|
+
WantedBy=multi-user.target
|
10
|
+
|
11
|
+
[Service]
|
12
|
+
Type=notify
|
13
|
+
ExecStart=/usr/bin/moat kv ow monitor %I
|
14
|
+
|
15
|
+
TimeoutSec=300
|
16
|
+
WatchdogSec=10
|
17
|
+
|
18
|
+
Restart=always
|
19
|
+
RestartSec=30
|
@@ -4,17 +4,21 @@ import anyio
|
|
4
4
|
from moat.util import P
|
5
5
|
from moat.kv.client import open_client
|
6
6
|
|
7
|
+
|
7
8
|
async def mod_owfs():
|
8
9
|
async with open_client() as c:
|
9
|
-
async for r in c.get_tree(
|
10
|
+
async for r in c.get_tree(
|
11
|
+
P(":.distkv.onewire"), min_depth=2, max_depth=2, nchain=2
|
12
|
+
):
|
10
13
|
try:
|
11
14
|
at = r.value.pop("attr")
|
12
15
|
except KeyError:
|
13
16
|
continue
|
14
|
-
await c.set(P(":.distkv.onewire")+r.path,value=r.value,chain=r.chain)
|
17
|
+
await c.set(P(":.distkv.onewire") + r.path, value=r.value, chain=r.chain)
|
18
|
+
|
19
|
+
|
15
20
|
# for k,v in at.items():
|
16
21
|
# print(r.path+P(k.replace('/',':')),v)
|
17
22
|
# await c.set(P(":.distkv.onewire")+r.path+P(k.replace('/',':')),value=v)
|
18
23
|
|
19
24
|
anyio.run(mod_owfs)
|
20
|
-
|
moat-kv-ow-0.9.4/.gitignore
DELETED
moat-kv-ow-0.9.4/.pylintrc
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
.gitignore
|
2
|
-
.pylintrc
|
3
|
-
Makefile
|
4
|
-
README.rst
|
5
|
-
TODO.rst
|
6
|
-
USAGE.rst
|
7
|
-
moat-kv-ow@.service
|
8
|
-
pyproject.toml
|
9
|
-
setup.cfg
|
10
|
-
moat/kv/ow/__init__.py
|
11
|
-
moat/kv/ow/_config.yaml
|
12
|
-
moat/kv/ow/_main.py
|
13
|
-
moat/kv/ow/mock.py
|
14
|
-
moat/kv/ow/model.py
|
15
|
-
moat/kv/ow/task.py
|
16
|
-
moat_kv_ow.egg-info/PKG-INFO
|
17
|
-
moat_kv_ow.egg-info/SOURCES.txt
|
18
|
-
moat_kv_ow.egg-info/dependency_links.txt
|
19
|
-
moat_kv_ow.egg-info/requires.txt
|
20
|
-
moat_kv_ow.egg-info/top_level.txt
|
21
|
-
tests/__init__.py
|
22
|
-
tests/conftest.py
|
23
|
-
tests/test_alarm.py
|
24
|
-
tools/update-0-4.py
|
@@ -1 +0,0 @@
|
|
1
|
-
moat-kv~=0.70.2
|
moat-kv-ow-0.9.4/pyproject.toml
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
[build-system]
|
2
|
-
build-backend = "setuptools.build_meta"
|
3
|
-
requires = [ "setuptools", "wheel", "setuptools-scm",]
|
4
|
-
|
5
|
-
[project]
|
6
|
-
classifiers = [
|
7
|
-
"Development Status :: 4 - Beta",
|
8
|
-
"Intended Audience :: Information Technology",
|
9
|
-
"License :: OSI Approved :: MIT License",
|
10
|
-
"License :: OSI Approved :: Apache Software License",
|
11
|
-
"Programming Language :: Python :: 3",
|
12
|
-
"Topic :: Database",
|
13
|
-
"Topic :: Home Automation",
|
14
|
-
]
|
15
|
-
dependencies = [
|
16
|
-
"moat-kv ~= 0.70.2",
|
17
|
-
]
|
18
|
-
dynamic = [ "version",]
|
19
|
-
keywords = [ "MoaT",]
|
20
|
-
requires-python = ">=3.8"
|
21
|
-
name = "moat-kv-ow"
|
22
|
-
description = "1wire connector for MoaT-KV"
|
23
|
-
readme = "README.rst"
|
24
|
-
[[project.authors]]
|
25
|
-
email = "matthias@urlichs.de"
|
26
|
-
name = "Matthias Urlichs"
|
27
|
-
|
28
|
-
[project.license]
|
29
|
-
file = "LICENSE"
|
30
|
-
|
31
|
-
[project.urls]
|
32
|
-
homepage = "https://m-o-a-t.org"
|
33
|
-
repository = "https://github.com/M-o-a-T/moat-kv-ow"
|
34
|
-
|
35
|
-
[tool.flake8]
|
36
|
-
max-line-length = 99
|
37
|
-
ignore = [ "F841", "F401", "E731", "E502", "E402", "E127", "E123", "W503", "E231", "E203", "E501" ]
|
38
|
-
|
39
|
-
[tool.isort]
|
40
|
-
line_length = 99
|
41
|
-
multi_line_output = 3
|
42
|
-
profile = "black"
|
43
|
-
|
44
|
-
[tool.setuptools]
|
45
|
-
packages = [ "moat.kv.ow",]
|
46
|
-
[tool.setuptools.package-data]
|
47
|
-
"*" = ["*.yaml"]
|
48
|
-
|
49
|
-
[tool.setuptools_scm]
|
50
|
-
|
51
|
-
[tool.black]
|
52
|
-
line-length = 99
|
53
|
-
|
54
|
-
[tool.tox]
|
55
|
-
legacy_tox_ini = """
|
56
|
-
[tox]
|
57
|
-
isolated_build = True
|
58
|
-
envlist = py310,check
|
59
|
-
|
60
|
-
[testenv]
|
61
|
-
setenv =
|
62
|
-
PYTHONPATH = {env:PYTHONPATH}{:}{toxinidir}
|
63
|
-
deps =
|
64
|
-
anyio
|
65
|
-
asyncwebsockets
|
66
|
-
asyncclick
|
67
|
-
asyncscope
|
68
|
-
trio
|
69
|
-
pytest
|
70
|
-
commands =
|
71
|
-
python3 -mpytest tests/
|
72
|
-
|
73
|
-
[testenv:check]
|
74
|
-
commands =
|
75
|
-
pylint moat tests
|
76
|
-
flake8p moat tests
|
77
|
-
black --check moat tests
|
78
|
-
deps =
|
79
|
-
pytest
|
80
|
-
pylint
|
81
|
-
black
|
82
|
-
flake8-pyproject
|
83
|
-
flake8
|
84
|
-
|
85
|
-
"""
|
86
|
-
|
87
|
-
[tool.pytest]
|
88
|
-
filterwarnings = [
|
89
|
-
"error",
|
90
|
-
"ignore:unclosed:ResourceWarning",
|
91
|
-
]
|
92
|
-
addopts = "--verbose"
|
93
|
-
|
94
|
-
[tool.pylint]
|
95
|
-
[tool.pylint.messages_control]
|
96
|
-
disable = "wrong-import-order,ungrouped-imports,too-many-nested-blocks,use-dict-literal,unspecified-encoding,too-many-statements,too-many-return-statements,too-many-locals,too-many-instance-attributes,too-many-branches,too-many-arguments,too-few-public-methods,superfluous-parens,no-else-return,no-else-continue,invalid-name,fixme"
|
97
|
-
|
98
|
-
[tool.moat]
|
File without changes
|
@@ -1,75 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Test program cloned from asyncowfs, but using MoaT-KV for end-to-semi-end testing.
|
3
|
-
"""
|
4
|
-
import sys
|
5
|
-
import anyio
|
6
|
-
from copy import deepcopy
|
7
|
-
from functools import partial
|
8
|
-
|
9
|
-
from asyncowfs.mock import structs
|
10
|
-
from moat.kv.mock.mqtt import stdtest
|
11
|
-
|
12
|
-
from moat.util import attrdict, Path, P, load_ext
|
13
|
-
from moat.kv.data import data_get
|
14
|
-
|
15
|
-
owfs_mock = load_ext("moat.kv.ow.mock")
|
16
|
-
|
17
|
-
import logging
|
18
|
-
|
19
|
-
logger = logging.getLogger(__name__)
|
20
|
-
|
21
|
-
# We can just use 'async def test_*' to define async tests.
|
22
|
-
# This also uses a virtual clock fixture, so time passes quickly and
|
23
|
-
# predictably.
|
24
|
-
|
25
|
-
basic_tree = {
|
26
|
-
"bus.0": {
|
27
|
-
"alarm": {},
|
28
|
-
"simultaneous": {"temperature": 0},
|
29
|
-
"10.345678.90": {
|
30
|
-
"latesttemp": "12.5",
|
31
|
-
"temperature": "12.5",
|
32
|
-
"templow": "15",
|
33
|
-
"temphigh": "20",
|
34
|
-
"foo": {"bar": 123, "plugh.A": 1, "plugh.B": 2, "plugh.C": 3},
|
35
|
-
},
|
36
|
-
},
|
37
|
-
"structure": structs,
|
38
|
-
}
|
39
|
-
|
40
|
-
|
41
|
-
async def test_alarm(mock_clock):
|
42
|
-
mock_clock.autojump_threshold = 0.1
|
43
|
-
my_tree = deepcopy(basic_tree)
|
44
|
-
dt = my_tree["bus.0"]["10.345678.90"]
|
45
|
-
async with stdtest(test_0={"init": 125}, n=1, tocks=200) as st, st.client(0) as client:
|
46
|
-
evt = anyio.Event()
|
47
|
-
obj = attrdict(client=client, meta=0, stdout=sys.stdout)
|
48
|
-
st.tg.start_soon(partial(owfs_mock.server, client, tree=my_tree, evt=evt))
|
49
|
-
await evt.wait()
|
50
|
-
assert dt["foo"]["bar"] == 123
|
51
|
-
await st.run("owfs attr -d 10.345678.90 -i 5 temperature test.foo.temp")
|
52
|
-
await st.run("owfs attr -d 10.345678.90 -w templow test.foo.low")
|
53
|
-
await st.run("owfs attr -d 10.345678.90 -w foo.bar -a bar:1 test.foo.what.ever")
|
54
|
-
await st.run("owfs attr -d 10.345678.90 -i 4 -a baz:2 foo.plugh:1 test.foo.this")
|
55
|
-
res = await client.set(P("test.foo.this"), value={"this": "is", "baz": {3: 33}})
|
56
|
-
await anyio.sleep(10)
|
57
|
-
await data_get(obj, Path())
|
58
|
-
|
59
|
-
await client.set(P("test.foo.low"), 11)
|
60
|
-
await client.set(P("test.foo.what.ever"), {"Hello": "No", "bar": {0: 99, 1: 13}})
|
61
|
-
await anyio.sleep(1)
|
62
|
-
res = await client.get(P("test.foo.temp"))
|
63
|
-
assert res.value == 12.5
|
64
|
-
dt["latesttemp"] = 42
|
65
|
-
dt["temperature"] = 42
|
66
|
-
dt["foo"]["plugh.B"] = 22
|
67
|
-
await anyio.sleep(6)
|
68
|
-
res = await client.get(P("test.foo.temp"))
|
69
|
-
await data_get(obj, Path())
|
70
|
-
assert res.value == 42
|
71
|
-
assert dt["foo"]["bar"] == "13"
|
72
|
-
res = await client.get(P("test.foo.this"))
|
73
|
-
assert res.value == {"this": "is", "baz": {2: 22, 3: 33}}
|
74
|
-
|
75
|
-
await st.tg.cancel_scope.cancel()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|