ovos-PHAL-plugin-sync 0.0.1a2__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.
- ovos_phal_plugin_sync-0.0.1a2/LICENSE +203 -0
- ovos_phal_plugin_sync-0.0.1a2/PKG-INFO +184 -0
- ovos_phal_plugin_sync-0.0.1a2/README.md +156 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_PHAL_plugin_sync.egg-info/PKG-INFO +184 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_PHAL_plugin_sync.egg-info/SOURCES.txt +35 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_PHAL_plugin_sync.egg-info/dependency_links.txt +1 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_PHAL_plugin_sync.egg-info/entry_points.txt +2 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_PHAL_plugin_sync.egg-info/requires.txt +8 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_PHAL_plugin_sync.egg-info/top_level.txt +1 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/__init__.py +559 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/backends/__init__.py +63 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/backends/folder.py +41 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/backends/github.py +87 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/backends/webdav.py +72 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/controlpanel.json +315 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/controlpanel.svg +1 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/crypto.py +85 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/journal.py +166 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/local.py +143 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/ca-ES/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/da-DK/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/de-DE/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/en-US/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/es-ES/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/eu-ES/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/fr-FR/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/gl-ES/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/it-IT/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/nl-NL/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/pt-BR/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/ovos_phal_plugin_sync/locale/pt-PT/controlpanel.json +82 -0
- ovos_phal_plugin_sync-0.0.1a2/pyproject.toml +45 -0
- ovos_phal_plugin_sync-0.0.1a2/setup.cfg +4 -0
- ovos_phal_plugin_sync-0.0.1a2/tests/test_backends.py +75 -0
- ovos_phal_plugin_sync-0.0.1a2/tests/test_crypto.py +30 -0
- ovos_phal_plugin_sync-0.0.1a2/tests/test_devices.py +233 -0
- ovos_phal_plugin_sync-0.0.1a2/tests/test_panel_page.py +67 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2021 Casimiro Ferreira
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
203
|
+
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ovos-PHAL-plugin-sync
|
|
3
|
+
Version: 0.0.1a2
|
|
4
|
+
Summary: OpenVoiceOS PHAL plugin: several devices that are one assistant - settings, skills and skills' memory shared through a storage you choose, sealed with a secret only your devices know
|
|
5
|
+
Author: emkay-voice
|
|
6
|
+
Maintainer: Andreas Lorensen
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/emkay-voice/ovos-PHAL-plugin-sync
|
|
9
|
+
Project-URL: Issues, https://github.com/emkay-voice/ovos-PHAL-plugin-sync/issues
|
|
10
|
+
Project-URL: Emkay, https://github.com/emkay-voice/emkay
|
|
11
|
+
Project-URL: Icon, https://raw.githubusercontent.com/emkay-voice/ovos-PHAL-plugin-sync/dev/res/icon.png
|
|
12
|
+
Keywords: ovos,openvoiceos,plugin,phal,sync,privacy,multi-device,emkay
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Home Automation
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: ovos-plugin-manager
|
|
21
|
+
Requires-Dist: ovos-bus-client
|
|
22
|
+
Requires-Dist: ovos-utils
|
|
23
|
+
Requires-Dist: ovos-config
|
|
24
|
+
Requires-Dist: requests
|
|
25
|
+
Provides-Extra: test
|
|
26
|
+
Requires-Dist: pytest; extra == "test"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# <img src='res/icon.png' width='50' height='50' style='vertical-align:bottom'/> ovos-PHAL-plugin-sync
|
|
30
|
+
|
|
31
|
+
Several OpenVoiceOS devices that are **one assistant** – the one on the work
|
|
32
|
+
PC, the one in the living room and the one in the bedroom – without Home
|
|
33
|
+
Assistant, without a server of anybody's, and without them having to be on
|
|
34
|
+
the same network.
|
|
35
|
+
|
|
36
|
+
> **Status: first proposal (alpha).** Events, values, the skills' settings,
|
|
37
|
+
> language/location/units and installing/removing skills are shared;
|
|
38
|
+
> storages: a folder, WebDAV and a private GitHub repository; a page in the
|
|
39
|
+
> control panel with a QR code to add devices. It is here to try whether the
|
|
40
|
+
> idea is good – see [docs/DESIGN.md](docs/DESIGN.md) for what is open.
|
|
41
|
+
|
|
42
|
+
Made for [Emkay](https://github.com/emkay-voice/emkay) – where it is "My
|
|
43
|
+
Emkay" – and works with any OpenVoiceOS: it is a plain PHAL plugin that
|
|
44
|
+
talks on the bus, nothing in it is Emkay's.
|
|
45
|
+
|
|
46
|
+
## The idea
|
|
47
|
+
|
|
48
|
+
You do three workouts with the exercise coach in the bedroom in the morning.
|
|
49
|
+
At work you start a workout on the PC, and the coach says *"that's number four
|
|
50
|
+
today"*. You change the coach's music at work – the bedroom has it too.
|
|
51
|
+
|
|
52
|
+
They are **synced, not connected** – and they can be very different: an old
|
|
53
|
+
tablet in the bedroom cannot take what the work PC can. So skills are not
|
|
54
|
+
copied between them. Your skills are kept in a **library**, and you choose
|
|
55
|
+
which device gets which – from [my.emkay.ai](https://github.com/emkay-voice/my)
|
|
56
|
+
or with *Install here* on the device's own page.
|
|
57
|
+
|
|
58
|
+
- **You choose where the devices meet**: a private GitHub repository (free,
|
|
59
|
+
works everywhere, also in a browser – the default), your own Nextcloud or
|
|
60
|
+
NAS over WebDAV, or a folder all of them can reach.
|
|
61
|
+
- **Every device writes only its own file** there, and reads the others'. Two
|
|
62
|
+
devices never write the same file, so there is nothing to lock and nothing
|
|
63
|
+
to overwrite, and the simplest storage will do.
|
|
64
|
+
- **Everything is sealed** with a secret only your devices know (encrypted
|
|
65
|
+
and authenticated). The storage sees how many devices there are and when
|
|
66
|
+
they write – nothing else. A file nobody with the secret made is refused.
|
|
67
|
+
- **Offline is normal.** Each device works on its own and catches up when it
|
|
68
|
+
can reach the storage. The work PC that can only sometimes get out is not a
|
|
69
|
+
problem, it is the case this is built for.
|
|
70
|
+
- **Nothing gets lost.** What happened (a workout) is an *event*: appended,
|
|
71
|
+
never overwritten, so a device that was offline all morning still adds its
|
|
72
|
+
own when it comes back. What you *chose* (a setting) is a value: the newest
|
|
73
|
+
change wins.
|
|
74
|
+
|
|
75
|
+
## Adding a device
|
|
76
|
+
|
|
77
|
+
On the first device, open the control panel's **My devices** page and start
|
|
78
|
+
sharing – with the help on the page for making a private GitHub repository
|
|
79
|
+
and a token for it. Then **Show the code**: a QR code. On the next device,
|
|
80
|
+
scan it (or download the code as a file and paste it in) under **Join**.
|
|
81
|
+
The code is the key to everything you share, so it is never shown as text on
|
|
82
|
+
the page, only as a QR code or a file you ask for.
|
|
83
|
+
|
|
84
|
+
Who starts the group brings their settings; a device that joins takes the
|
|
85
|
+
group's, and keeps its own events.
|
|
86
|
+
|
|
87
|
+
## What is shared
|
|
88
|
+
|
|
89
|
+
| | | |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| The skills' **settings** | `settings.json` of every skill | newest change wins, per setting |
|
|
92
|
+
| Language, location, units | `lang`, `location`, `time_format`, `date_format`, `system_unit`, … in mycroft.conf | newest change wins |
|
|
93
|
+
| Your **library** of skills | a skill installed on any device (after it joined) or added from my.emkay.ai | never installed anywhere by itself |
|
|
94
|
+
| **Orders** | "install / uninstall this skill on the bedroom device", from my.emkay.ai | carried out once, by that device only, within 14 days |
|
|
95
|
+
| What **skills** share | events and values on the bus, below | events: all of them; values: newest wins |
|
|
96
|
+
|
|
97
|
+
Kept to each device, always: microphone and speaker, wake word, voices,
|
|
98
|
+
the listener, PHAL plugins' settings – anything that is about the device and
|
|
99
|
+
not about you. Settings whose name starts with `__` are never shared, and a
|
|
100
|
+
device can keep more to itself (`local_settings`).
|
|
101
|
+
|
|
102
|
+
## For skills
|
|
103
|
+
|
|
104
|
+
On the bus; every query is answered as `<type>.response`. `ns` is the
|
|
105
|
+
skill's own name, usually its skill id.
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
ovos.sync.event {"ns", "kind", "data"} -> {"id"} something happened
|
|
109
|
+
ovos.sync.events {"ns", "kind"?, "since"?} -> {"events": [{"id", "t", "kind", "data", "by", "device", "here"}]}
|
|
110
|
+
ovos.sync.set {"ns", "key", "value"} -> {} remember a value
|
|
111
|
+
ovos.sync.get {"ns", "key"?} -> {"value"} or {"values": {...}}
|
|
112
|
+
ovos.sync.changed {"ns": [...], "settings": [...], "config": [...]} another device changed something
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
It works on a device that shares with nobody too, so a skill can use it
|
|
116
|
+
always: it then simply remembers on the one device, and when the device
|
|
117
|
+
joins others, what it remembered comes along.
|
|
118
|
+
|
|
119
|
+
The exercise coach, counting today's workouts on all your devices:
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
import time
|
|
123
|
+
from ovos_bus_client.message import Message
|
|
124
|
+
|
|
125
|
+
def workouts_today(self):
|
|
126
|
+
midnight = time.mktime(time.localtime()[:3] + (0, 0, 0, 0, 0, -1))
|
|
127
|
+
answer = self.bus.wait_for_response(
|
|
128
|
+
Message("ovos.sync.events", {"ns": self.skill_id, "kind": "workout", "since": midnight}),
|
|
129
|
+
"ovos.sync.events.response", timeout=2)
|
|
130
|
+
return len(answer.data["events"]) if answer else None # None: no sync plugin
|
|
131
|
+
|
|
132
|
+
def workout_done(self, program):
|
|
133
|
+
self.bus.emit(Message("ovos.sync.event",
|
|
134
|
+
{"ns": self.skill_id, "kind": "workout", "data": {"program": program}}))
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## The control panel
|
|
138
|
+
|
|
139
|
+
The **My devices** page (in the Device group): whether this device shares and
|
|
140
|
+
where, the devices with their names (rename this one), your skills (*Install
|
|
141
|
+
here*), **Add another device**
|
|
142
|
+
(the QR code, or the code as a file), **Join**, **Start sharing** with help
|
|
143
|
+
choosing a storage, what the skills share, and what this device shares.
|
|
144
|
+
|
|
145
|
+
## Configuration
|
|
146
|
+
|
|
147
|
+
In mycroft.conf under `PHAL.ovos-PHAL-plugin-sync` – this device's own, never
|
|
148
|
+
shared. The page writes it.
|
|
149
|
+
|
|
150
|
+
| key | default | |
|
|
151
|
+
|---|---|---|
|
|
152
|
+
| `interval` | `60` | seconds between looks at the storage (a change here is written within seconds) |
|
|
153
|
+
| `share_settings` | `true` | the skills' settings |
|
|
154
|
+
| `share_config` | `true` | the keys in `config_keys` |
|
|
155
|
+
| `follow_orders` | `true` | install and uninstall skills when ordered to from my.emkay.ai |
|
|
156
|
+
| `config_keys` | language, location, units, formats | which mycroft.conf keys travel |
|
|
157
|
+
| `local_settings` | `[]` | `skill_id:key` or `*:key`: settings kept to this device |
|
|
158
|
+
| `keep_days` | `400` | events older than this are let go |
|
|
159
|
+
| `join_url` | `""` | makes the join code a link: Emkay sets `https://my.emkay.ai/#join=`, so scanning the QR code with a phone opens My Emkay already logged in. The code is after `#`, so it never leaves the browser that opens it |
|
|
160
|
+
|
|
161
|
+
The group's secret and the storage's token or password are kept in the
|
|
162
|
+
plugin's own state file (`~/.local/state/ovos-sync/state.json`, readable only
|
|
163
|
+
by the user), never in mycroft.conf, so they never show in the panel.
|
|
164
|
+
|
|
165
|
+
## Try it
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
pip install -e ".[test]"
|
|
169
|
+
python tools/three_devices.py # three devices, a workout counted across them, one offline
|
|
170
|
+
pytest tests
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Goes with
|
|
174
|
+
|
|
175
|
+
- [my.emkay.ai](https://github.com/emkay-voice/my) – My Emkay: your devices,
|
|
176
|
+
the skills on each, your library of skills and their settings, from any
|
|
177
|
+
browser. One more member of the group, with no server of its own.
|
|
178
|
+
- [ovos-skill-my-devices](https://github.com/emkay-voice/ovos-skill-my-devices)
|
|
179
|
+
– *"sync with my other devices"*, *"when did you last sync?"*, *"which
|
|
180
|
+
devices are you together with?"*
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
Apache-2.0. Made by [emkay-voice](https://github.com/emkay-voice), maintained by Andreas Lorensen.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# <img src='res/icon.png' width='50' height='50' style='vertical-align:bottom'/> ovos-PHAL-plugin-sync
|
|
2
|
+
|
|
3
|
+
Several OpenVoiceOS devices that are **one assistant** – the one on the work
|
|
4
|
+
PC, the one in the living room and the one in the bedroom – without Home
|
|
5
|
+
Assistant, without a server of anybody's, and without them having to be on
|
|
6
|
+
the same network.
|
|
7
|
+
|
|
8
|
+
> **Status: first proposal (alpha).** Events, values, the skills' settings,
|
|
9
|
+
> language/location/units and installing/removing skills are shared;
|
|
10
|
+
> storages: a folder, WebDAV and a private GitHub repository; a page in the
|
|
11
|
+
> control panel with a QR code to add devices. It is here to try whether the
|
|
12
|
+
> idea is good – see [docs/DESIGN.md](docs/DESIGN.md) for what is open.
|
|
13
|
+
|
|
14
|
+
Made for [Emkay](https://github.com/emkay-voice/emkay) – where it is "My
|
|
15
|
+
Emkay" – and works with any OpenVoiceOS: it is a plain PHAL plugin that
|
|
16
|
+
talks on the bus, nothing in it is Emkay's.
|
|
17
|
+
|
|
18
|
+
## The idea
|
|
19
|
+
|
|
20
|
+
You do three workouts with the exercise coach in the bedroom in the morning.
|
|
21
|
+
At work you start a workout on the PC, and the coach says *"that's number four
|
|
22
|
+
today"*. You change the coach's music at work – the bedroom has it too.
|
|
23
|
+
|
|
24
|
+
They are **synced, not connected** – and they can be very different: an old
|
|
25
|
+
tablet in the bedroom cannot take what the work PC can. So skills are not
|
|
26
|
+
copied between them. Your skills are kept in a **library**, and you choose
|
|
27
|
+
which device gets which – from [my.emkay.ai](https://github.com/emkay-voice/my)
|
|
28
|
+
or with *Install here* on the device's own page.
|
|
29
|
+
|
|
30
|
+
- **You choose where the devices meet**: a private GitHub repository (free,
|
|
31
|
+
works everywhere, also in a browser – the default), your own Nextcloud or
|
|
32
|
+
NAS over WebDAV, or a folder all of them can reach.
|
|
33
|
+
- **Every device writes only its own file** there, and reads the others'. Two
|
|
34
|
+
devices never write the same file, so there is nothing to lock and nothing
|
|
35
|
+
to overwrite, and the simplest storage will do.
|
|
36
|
+
- **Everything is sealed** with a secret only your devices know (encrypted
|
|
37
|
+
and authenticated). The storage sees how many devices there are and when
|
|
38
|
+
they write – nothing else. A file nobody with the secret made is refused.
|
|
39
|
+
- **Offline is normal.** Each device works on its own and catches up when it
|
|
40
|
+
can reach the storage. The work PC that can only sometimes get out is not a
|
|
41
|
+
problem, it is the case this is built for.
|
|
42
|
+
- **Nothing gets lost.** What happened (a workout) is an *event*: appended,
|
|
43
|
+
never overwritten, so a device that was offline all morning still adds its
|
|
44
|
+
own when it comes back. What you *chose* (a setting) is a value: the newest
|
|
45
|
+
change wins.
|
|
46
|
+
|
|
47
|
+
## Adding a device
|
|
48
|
+
|
|
49
|
+
On the first device, open the control panel's **My devices** page and start
|
|
50
|
+
sharing – with the help on the page for making a private GitHub repository
|
|
51
|
+
and a token for it. Then **Show the code**: a QR code. On the next device,
|
|
52
|
+
scan it (or download the code as a file and paste it in) under **Join**.
|
|
53
|
+
The code is the key to everything you share, so it is never shown as text on
|
|
54
|
+
the page, only as a QR code or a file you ask for.
|
|
55
|
+
|
|
56
|
+
Who starts the group brings their settings; a device that joins takes the
|
|
57
|
+
group's, and keeps its own events.
|
|
58
|
+
|
|
59
|
+
## What is shared
|
|
60
|
+
|
|
61
|
+
| | | |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| The skills' **settings** | `settings.json` of every skill | newest change wins, per setting |
|
|
64
|
+
| Language, location, units | `lang`, `location`, `time_format`, `date_format`, `system_unit`, … in mycroft.conf | newest change wins |
|
|
65
|
+
| Your **library** of skills | a skill installed on any device (after it joined) or added from my.emkay.ai | never installed anywhere by itself |
|
|
66
|
+
| **Orders** | "install / uninstall this skill on the bedroom device", from my.emkay.ai | carried out once, by that device only, within 14 days |
|
|
67
|
+
| What **skills** share | events and values on the bus, below | events: all of them; values: newest wins |
|
|
68
|
+
|
|
69
|
+
Kept to each device, always: microphone and speaker, wake word, voices,
|
|
70
|
+
the listener, PHAL plugins' settings – anything that is about the device and
|
|
71
|
+
not about you. Settings whose name starts with `__` are never shared, and a
|
|
72
|
+
device can keep more to itself (`local_settings`).
|
|
73
|
+
|
|
74
|
+
## For skills
|
|
75
|
+
|
|
76
|
+
On the bus; every query is answered as `<type>.response`. `ns` is the
|
|
77
|
+
skill's own name, usually its skill id.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
ovos.sync.event {"ns", "kind", "data"} -> {"id"} something happened
|
|
81
|
+
ovos.sync.events {"ns", "kind"?, "since"?} -> {"events": [{"id", "t", "kind", "data", "by", "device", "here"}]}
|
|
82
|
+
ovos.sync.set {"ns", "key", "value"} -> {} remember a value
|
|
83
|
+
ovos.sync.get {"ns", "key"?} -> {"value"} or {"values": {...}}
|
|
84
|
+
ovos.sync.changed {"ns": [...], "settings": [...], "config": [...]} another device changed something
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
It works on a device that shares with nobody too, so a skill can use it
|
|
88
|
+
always: it then simply remembers on the one device, and when the device
|
|
89
|
+
joins others, what it remembered comes along.
|
|
90
|
+
|
|
91
|
+
The exercise coach, counting today's workouts on all your devices:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import time
|
|
95
|
+
from ovos_bus_client.message import Message
|
|
96
|
+
|
|
97
|
+
def workouts_today(self):
|
|
98
|
+
midnight = time.mktime(time.localtime()[:3] + (0, 0, 0, 0, 0, -1))
|
|
99
|
+
answer = self.bus.wait_for_response(
|
|
100
|
+
Message("ovos.sync.events", {"ns": self.skill_id, "kind": "workout", "since": midnight}),
|
|
101
|
+
"ovos.sync.events.response", timeout=2)
|
|
102
|
+
return len(answer.data["events"]) if answer else None # None: no sync plugin
|
|
103
|
+
|
|
104
|
+
def workout_done(self, program):
|
|
105
|
+
self.bus.emit(Message("ovos.sync.event",
|
|
106
|
+
{"ns": self.skill_id, "kind": "workout", "data": {"program": program}}))
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## The control panel
|
|
110
|
+
|
|
111
|
+
The **My devices** page (in the Device group): whether this device shares and
|
|
112
|
+
where, the devices with their names (rename this one), your skills (*Install
|
|
113
|
+
here*), **Add another device**
|
|
114
|
+
(the QR code, or the code as a file), **Join**, **Start sharing** with help
|
|
115
|
+
choosing a storage, what the skills share, and what this device shares.
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
In mycroft.conf under `PHAL.ovos-PHAL-plugin-sync` – this device's own, never
|
|
120
|
+
shared. The page writes it.
|
|
121
|
+
|
|
122
|
+
| key | default | |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `interval` | `60` | seconds between looks at the storage (a change here is written within seconds) |
|
|
125
|
+
| `share_settings` | `true` | the skills' settings |
|
|
126
|
+
| `share_config` | `true` | the keys in `config_keys` |
|
|
127
|
+
| `follow_orders` | `true` | install and uninstall skills when ordered to from my.emkay.ai |
|
|
128
|
+
| `config_keys` | language, location, units, formats | which mycroft.conf keys travel |
|
|
129
|
+
| `local_settings` | `[]` | `skill_id:key` or `*:key`: settings kept to this device |
|
|
130
|
+
| `keep_days` | `400` | events older than this are let go |
|
|
131
|
+
| `join_url` | `""` | makes the join code a link: Emkay sets `https://my.emkay.ai/#join=`, so scanning the QR code with a phone opens My Emkay already logged in. The code is after `#`, so it never leaves the browser that opens it |
|
|
132
|
+
|
|
133
|
+
The group's secret and the storage's token or password are kept in the
|
|
134
|
+
plugin's own state file (`~/.local/state/ovos-sync/state.json`, readable only
|
|
135
|
+
by the user), never in mycroft.conf, so they never show in the panel.
|
|
136
|
+
|
|
137
|
+
## Try it
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
pip install -e ".[test]"
|
|
141
|
+
python tools/three_devices.py # three devices, a workout counted across them, one offline
|
|
142
|
+
pytest tests
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Goes with
|
|
146
|
+
|
|
147
|
+
- [my.emkay.ai](https://github.com/emkay-voice/my) – My Emkay: your devices,
|
|
148
|
+
the skills on each, your library of skills and their settings, from any
|
|
149
|
+
browser. One more member of the group, with no server of its own.
|
|
150
|
+
- [ovos-skill-my-devices](https://github.com/emkay-voice/ovos-skill-my-devices)
|
|
151
|
+
– *"sync with my other devices"*, *"when did you last sync?"*, *"which
|
|
152
|
+
devices are you together with?"*
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
Apache-2.0. Made by [emkay-voice](https://github.com/emkay-voice), maintained by Andreas Lorensen.
|