changeset 1492:7c7415cfbc02

iot2: WIP still. more messages schema Ignore-this: ef94336852ff8885df861146fc1b01b darcs-hash:f5e1ffe61ecff1a7430b58a7504e35dcc809b1f8
author drewp <drewp@bigasterisk.com>
date Wed, 29 Jan 2020 01:03:40 -0800
parents 6cd9341f0a28
children 391140f53dfd
files service/iot2/messages.capnp service/iot2/tasks.py
diffstat 2 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/service/iot2/messages.capnp	Wed Jan 29 01:02:06 2020 -0800
+++ b/service/iot2/messages.capnp	Wed Jan 29 01:03:40 2020 -0800
@@ -6,3 +6,27 @@
   sensor @0 :Data;
   value @1 :Float32;
 }
+
+# node is at config version n (config pusher will update it)
+# replace node config
+# node component returns interesting sensor reports
+# node component periodically returns state
+# send 'command' updates to components
+
+# from node: <node>/announce
+# (<node> is picked by the node itself, often hostname or an id compiled into esp code)
+struct NodeAnnounce {
+  config_version @0 :Int32;
+  hostname @1 :Data;
+  mac_address @2 :UInt64; # 48-bit
+}
+
+# to node: <node>/configure
+struct ConfigureNode {
+  config_version @0 :Int32;
+  components @0 :List(Component)
+  struct Component {
+    id :Text
+
+  }
+}
--- a/service/iot2/tasks.py	Wed Jan 29 01:02:06 2020 -0800
+++ b/service/iot2/tasks.py	Wed Jan 29 01:03:40 2020 -0800
@@ -44,7 +44,9 @@
     if all(Path(f'~/.nimble/pkgs/{pkg[1]}').expanduser().exists() for pkg in pkgs):
         return
     plain_names = ' '.join(p[0] for p in pkgs)
-    ctx.run(f'{NIM_BIN}/nimble install -y {plain_names}', pty=True)
+    print('todo: on initial install, this may need to be run a few times')
+    ctx.run(f'{NIM_BIN}/nimble install -y {plain_names}',
+            pty=True, env={'PATH': f'/usr/bin:{NIM_BIN}'})
     ctx.run(f'ln -s ~/.nimble/bin/capnpc ~/.nimble/bin/capnpc-nim')