API first controller with OTA support, also exposes WebOfThings APIs for sensors



  • I have been working on this project for sometime now. It started as a project to do just OTA support with API first approach. But then moved on to expose WoT api's that can be used by Things Gateway by mozilla. It also acts as a proxy to work with other controllers.

    Currently supports Serial and TCP connection. MQTT support is in pipeline.

    UI for firmware management is still in progress.

    The project is open source and can be found here. Written completely in Rust Lang. Still at early stage. Feedbacks welcome.

    Screenshots of Integration with Things Gateway is attached

    0_1529733985398_screenshot1.png


  • Plugin Developer

    I can't believe nobody responded to this yet.

    Because this is awesome!! Thank you so much for working on this.

    If I understand correctly, your project translates MySensors into an API that follows the the Web of Things standard? And because of that the MySensors things can become visible in Mozilla's project?

    How far along are you? What do you have working?

    How can I test out your work?

    I love Mozilla's simple interface.


  • Plugin Developer

    I'm having a very hard time installing this on my Raspberry Pi.

    The apt-get route says:

    N: Skipping acquire of configured file 'main/binary-armhf/Packages' as repository 'http://dl.bintray.com/tsathishkumar/myscontroller-rs vivid InRelease' doesn't support architecture 'armhf'
    

    Building it locally gives other errors:

       Compiling migrations_macros v1.3.0
    error: linking with `cc` failed: exit code: 1
      |
      = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros0.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros1.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros10.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros11.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros12.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros13.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros14.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros15.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros2.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros3.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros4.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros5.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros6.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros7.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros8.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.migrations_macros9.rcgu.o" "-o" "/home/pi/MySController-rs/target/debug/deps/libmigrations_macros-14892f8c59589258.so" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.crate.metadata.rcgu.o" "/home/pi/MySController-rs/target/debug/deps/migrations_macros-14892f8c59589258.crate.allocator.rcgu.o" "-Wl,--gc-sections" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/pi/MySController-rs/target/debug/deps" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-Wl,-Bstatic" "/home/pi/MySController-rs/target/debug/deps/libsyn-769dfe81e95b621b.rlib" "/home/pi/MySController-rs/target/debug/deps/libsynom-bbd7e5b6eade6d2e.rlib" "/home/pi/MySController-rs/target/debug/deps/libunicode_xid-382752f6e510a484.rlib" "/home/pi/MySController-rs/target/debug/deps/libquote-b06e98a2c23096a7.rlib" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-Wl,-Bdynamic" "-lproc_macro-0f823fc7e3dbe196" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-lsyntax-08362484ffb56562" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-lrustc_target-8865050e923dae92" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-lrustc_errors-07e3b46b1c14decb" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-lsyntax_pos-5488ef3ce72b6e4d" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-larena-e9c1151de53a035f" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-lrustc_data_structures-044691f435f17065" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-lrustc_cratesio_shim-55eb22b1b1e3d315" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-lserialize-6f62c9cbc928e0a5" "-Wl,-Bstatic" "/home/pi/MySController-rs/target/debug/deps/libmigrations_internals-c5e0f439cc143973.rlib" "/home/pi/MySController-rs/target/debug/deps/libdiesel-5ee0bf083e68f663.rlib" "/home/pi/MySController-rs/target/debug/deps/libchrono-d37fdfdaff000753.rlib" "/home/pi/MySController-rs/target/debug/deps/libnum_integer-2430d5ae64669a51.rlib" "/home/pi/MySController-rs/target/debug/deps/libnum_traits-7c89c82cfeecdba3.rlib" "/home/pi/MySController-rs/target/debug/deps/libtime-48d258fb5dd37ff6.rlib" "/home/pi/MySController-rs/target/debug/deps/liblibc-3231f047758ca64f.rlib" "/home/pi/MySController-rs/target/debug/deps/liblibsqlite3_sys-800633d6d16b9d9f.rlib" "/home/pi/MySController-rs/target/debug/deps/libr2d2-95038fffa42c9e9e.rlib" "/home/pi/MySController-rs/target/debug/deps/libscheduled_thread_pool-94c8fa5a850f6022.rlib" "/home/pi/MySController-rs/target/debug/deps/liblog-6aa690ee5772ee80.rlib" "/home/pi/MySController-rs/target/debug/deps/libcfg_if-ccd202738e7dc507.rlib" "/home/pi/MySController-rs/target/debug/deps/libantidote-189834d637f47c4f.rlib" "/home/pi/MySController-rs/target/debug/deps/libbyteorder-ce0ca870d98f08f7.rlib" "-Wl,--start-group" "-L" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-Wl,-Bdynamic" "-lstd-c4f338a0e519f5e0" "-Wl,--end-group" "-Wl,-Bstatic" "/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcompiler_builtins-fe16a4dcdcd95bab.rlib" "-Wl,-Bdynamic" "-lutil" "-lutil" "-lutil" "-lutil" "-lsqlite3" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-shared"
      = note: /usr/bin/ld: cannot find -lsqlite3
              collect2: error: ld returned 1 exit status
              
    
    error: aborting due to previous error
    
    error: Could not compile `migrations_macros`.
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    
    
    

    // getting a bit further on the second one with "sudo apt-get install libsqlite3-dev", only to run into more issues.

    error[E0433]: failed to resolve. Use of undeclared type or module `PresentationType`
     --> src/core/message/presentation.rs:7:14
      |
    7 |     #[derive(DbEnum, Debug, PartialEq, Clone, Copy, Serialize, Deserialize)]
      |              ^^^^^^ Use of undeclared type or module `PresentationType`
    
    error[E0412]: cannot find type `PresentationType` in this scope
     --> src/core/message/presentation.rs:7:14
      |
    7 |     #[derive(DbEnum, Debug, PartialEq, Clone, Copy, Serialize, Deserialize)]
      |              ^^^^^^ not found in this scope
    
    warning: cannot find type `PresentationType` in this scope
     --> src/core/message/presentation.rs:7:14
      |
    7 |     #[derive(DbEnum, Debug, PartialEq, Clone, Copy, Serialize, Deserialize)]
      |              ^^^^^^ names from parent modules are not accessible without an explicit import
      |
      = note: #[warn(proc_macro_derive_resolution_fallback)] on by default
      = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
      = note: for more information, see issue #50504 <https://github.com/rust-lang/rust/issues/50504>
    
    // and then lots of warning, followed by:
    
    error[E0277]: the trait bound `core::message::presentation::PresentationType: diesel::Queryable<core::message::presentation::db_enum_impl_PresentationType::PresentationTypeMapping, _>` is not satisfied
      --> src/core/message_handler/presentation.rs:42:10
       |
    42 |         .first::<Sensor>(conn)
       |          ^^^^^ the trait `diesel::Queryable<core::message::presentation::db_enum_impl_PresentationType::PresentationTypeMapping, _>` is not implemented for `core::message::presentation::PresentationType`
    
    
    


  • @alowhum thanks for your interest in testing this out 🙂

    The current state of the project is about 90% complete. Missing support for few specific sensors. It would be great if I get some feedback and suggestions.



  • @alowhum Will add the deb package for raspbian soon.


  • Plugin Developer

    Awesome.

    There is a request to Mozilla to support this too.


  • Plugin Developer

    Good news: sounds like we can add a new controller to the list soon!

    Through the help and hard work of @Sathishkumar-Thangavel I got my first MySensors device to show up in the Mozilla Gateway yesterday.

    This is great news, as the software is really user friendly and has the force of Mozilla behind it.


  • Plugin Developer

    This new MCS-lite open source IOT gateway, created by Mediatek, also supports Web of things.

    Homepage
    https://mcslite.netlify.com/en-US

    Github
    https://github.com/MCS-Lite/mcs-lite

    Documentation
    https://mcs-lite-introduction.netlify.com/en/

    I wonder if it will also support MySensors by using this project.


  • Plugin Developer

    Some progress.

    • Nodes with fixed node ID's work. Automatic node ID's are not yet supported, but I believe they should be in the near future. Once that is done I think this becomes a viable controller.
    • Already existing: support for switches, locks, temperature, humidity. Today support for air quality and barometric sensors was added. The full list is here.

  • Plugin Developer

    Automatic node ID's are now also supported!

    There is a step-by-step install guide here:
    https://github.com/tsathishkumar/MySController-rs/issues/30

    You can easily run this alongside Domoticz.

    • Burn an image for the Mozilla Gateway onto an SD card.
    • Follow the guide above to install MySController-rs.
    • Install Domoticz at port 8081 and 444 (instead of 8080 and 443, as the Mozilla Gateway is already at those ports).


Suggested Topics

13
Online

11.4k
Users

11.1k
Topics

112.7k
Posts