Skip to content
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Modular sketch to be configured with JSON (idea)
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

Modular sketch to be configured with JSON (idea)

Scheduled Pinned Locked Moved Development
jsonnrf52fota
12 Posts 7 Posters 124 Views 8 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mfalkviddM mfalkvidd

    @monte with the large flash space on the nrf5, what you are suggesting should be quite feasible. I have no experience with NodeManager, but from what I've understand it is a nice abstraction. Maybe NodeManager can be used to also switch between different features in a formware? Or maybe it is possible to draw inspiration from the NodeManager to create something new, without having to start from scratch.

    monteM Offline
    monteM Offline
    monte
    wrote on last edited by
    #3

    @mfalkvidd I neither have any experience with NodeManager. I shall look into it, but I expect it will be too big addition to merge.But who knows.
    Do you know who maintains this project, maybe we can hear his thoughts on the matter?

    mtiutiuM U 2 Replies Last reply
    0
    • monteM monte

      @mfalkvidd I neither have any experience with NodeManager. I shall look into it, but I expect it will be too big addition to merge.But who knows.
      Do you know who maintains this project, maybe we can hear his thoughts on the matter?

      mtiutiuM Offline
      mtiutiuM Offline
      mtiutiu
      Hardware Contributor
      wrote on last edited by mtiutiu
      #4

      @monte

      Are you suggesting to implement something like esphome has? If that's the case then I would prefer yaml instead of json as it's easier to read and maintain imho.
      The idea to have code generated from a configuration file is pretty neat and it simplifies tedious and repeating tasks a lot besides abstraction.
      NodeManager should help as it seems to be pretty modular.

      1 Reply Last reply
      2
      • mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #5

        NodeManager was created by @user2684

        1 Reply Last reply
        0
        • monteM monte

          @mfalkvidd I neither have any experience with NodeManager. I shall look into it, but I expect it will be too big addition to merge.But who knows.
          Do you know who maintains this project, maybe we can hear his thoughts on the matter?

          U Offline
          U Offline
          user2684
          Contest Winner
          wrote on last edited by
          #6

          @monte first of all I like the idea of having a multi-purpose sensor which can embody different "personalities" on the fly. NodeManager came in exactly for the purpose of providing a simple to configure, modular firmware with a set of predefined sensor ready to use.

          BUT this is defined at compilation time not at runtime as you are suggesting. Reason is simple: since there are 60+ ready-to-use sensors in NodeManager, accommodating everything especially in a small arduino is not feasible, also considering the dependencies some sensors bring in. I see usually up to 3-4 sensors can fit the flash, no more. But I expect in different environments the situation could be different or at least for a subset of those.

          All of this to say I believe NodeManager is a good starting point for what you are intended to do since you already have modular code for a good number of sensors, hooks for the different phases of the lifecycle and a way for communicating with the node through a "service" channel if you need to send something and act upon it. So feel free to fork the project (preferred way) or start from there.
          All of NodeManager's details can be found on https://github.com/mysensors/NodeManager
          Thanks

          1 Reply Last reply
          1
          • K Offline
            K Offline
            kimot
            wrote on last edited by
            #7

            Super...
            You add software for relay, switch or new temperature sensor through FOTA...
            And then go to your node, remove it and connect this devices to it in fact.
            No, you really do not need FOTA for this.
            But for repairing some bugs in your program yes.
            Other case is for example node ID, mqtt topic, some calibrations, offsets, Domoticz sensor IDX etc.

            B 1 Reply Last reply
            0
            • K kimot

              Super...
              You add software for relay, switch or new temperature sensor through FOTA...
              And then go to your node, remove it and connect this devices to it in fact.
              No, you really do not need FOTA for this.
              But for repairing some bugs in your program yes.
              Other case is for example node ID, mqtt topic, some calibrations, offsets, Domoticz sensor IDX etc.

              B Offline
              B Offline
              boozz
              wrote on last edited by
              #8

              @kimot @monte
              It appears to me as what has been described by @monte is almost completely covered by the Tasmota project: https://github.com/arendst/Tasmota

              5f9e2e02-884c-488c-ac0f-c57ee4db3df5-afbeelding.png

              monteM 1 Reply Last reply
              1
              • B boozz

                @kimot @monte
                It appears to me as what has been described by @monte is almost completely covered by the Tasmota project: https://github.com/arendst/Tasmota

                5f9e2e02-884c-488c-ac0f-c57ee4db3df5-afbeelding.png

                monteM Offline
                monteM Offline
                monte
                wrote on last edited by
                #9

                @boozz yes, exactly I had this in mind, but with specifics of Mysensors framework. Not everyone wants to rely on WiFi with their home automation.

                @mtiutiu I mentioned JSON because I've used JSON library for Arduino and know that it exists, it well may be YAML if it's more suitable.

                @user2684 said in Modular sketch to be configured with JSON (idea):

                BUT this is defined at compilation time not at runtime as you are suggesting. Reason is simple: since there are 60+ ready-to-use sensors in NodeManager, accommodating everything especially in a small arduino is not feasible, also considering the dependencies some sensors bring in. I see usually up to 3-4 sensors can fit the flash, no more. But I expect in different environments the situation could be different or at least for a subset of those.

                We are talking about nRF52 use case, which has abundance of available flash space. And my thought was a bit different then you described.
                Imagine you have base firmwares for most sensor types, or it can be generated with NodeManager. But key parameters are configured with externally loaded JSON (or YAML) file, so it can be modified after flashing initial firmware.
                I'm not completely sure how much use does this solution has, that's why I started discussion here, to see if anyone thinks it would be a good idea.
                Thanks for your reply :)

                U 1 Reply Last reply
                2
                • M Offline
                  M Offline
                  Michał Szura
                  wrote on last edited by
                  #10

                  I personally would love that 😀
                  I still begging my friend for code to some simple nodes where I want to avoid esphome. I use mysensors only through cables with serial and planning on rs485 or maybe pjon if tests are finished.
                  The yaml support will be nothing new for homeassistant user and probably.not much learning for others.

                  1 Reply Last reply
                  1
                  • monteM monte

                    @boozz yes, exactly I had this in mind, but with specifics of Mysensors framework. Not everyone wants to rely on WiFi with their home automation.

                    @mtiutiu I mentioned JSON because I've used JSON library for Arduino and know that it exists, it well may be YAML if it's more suitable.

                    @user2684 said in Modular sketch to be configured with JSON (idea):

                    BUT this is defined at compilation time not at runtime as you are suggesting. Reason is simple: since there are 60+ ready-to-use sensors in NodeManager, accommodating everything especially in a small arduino is not feasible, also considering the dependencies some sensors bring in. I see usually up to 3-4 sensors can fit the flash, no more. But I expect in different environments the situation could be different or at least for a subset of those.

                    We are talking about nRF52 use case, which has abundance of available flash space. And my thought was a bit different then you described.
                    Imagine you have base firmwares for most sensor types, or it can be generated with NodeManager. But key parameters are configured with externally loaded JSON (or YAML) file, so it can be modified after flashing initial firmware.
                    I'm not completely sure how much use does this solution has, that's why I started discussion here, to see if anyone thinks it would be a good idea.
                    Thanks for your reply :)

                    U Offline
                    U Offline
                    user2684
                    Contest Winner
                    wrote on last edited by
                    #11

                    @monte said in Modular sketch to be configured with JSON (idea):

                    Imagine you have base firmwares for most sensor types, or it can be generated with NodeManager.

                    I don't see specific technical limitations to have this working. On the NodeManager side would be:

                    • Include in the sketch all the sensors you want, which is already there
                    • Have a logic to configure sensors remotely, which is mostly there through SensorConfiguration (https://github.com/mysensors/NodeManager/blob/master/sensors/SensorConfiguration.h). If then the configuration is through individual messages or json, it makes little difference. There might be some configuration settings missing since not all are available OTA
                    • Implement a logic for configuring only specific sensors. Shouldn't be that difficult, probably best is to have a enable/disable switch for each sensor (https://github.com/mysensors/NodeManager/issues/500), having all the sensors disabled by default and then dynamically enabling them

                    Bottomline not something to put in place in a few minutes but all the building blocks are there. I do not have at this time spare cycle to spend unfortunately but feel free to start looking at it if you like.

                    U 1 Reply Last reply
                    2
                    • U user2684

                      @monte said in Modular sketch to be configured with JSON (idea):

                      Imagine you have base firmwares for most sensor types, or it can be generated with NodeManager.

                      I don't see specific technical limitations to have this working. On the NodeManager side would be:

                      • Include in the sketch all the sensors you want, which is already there
                      • Have a logic to configure sensors remotely, which is mostly there through SensorConfiguration (https://github.com/mysensors/NodeManager/blob/master/sensors/SensorConfiguration.h). If then the configuration is through individual messages or json, it makes little difference. There might be some configuration settings missing since not all are available OTA
                      • Implement a logic for configuring only specific sensors. Shouldn't be that difficult, probably best is to have a enable/disable switch for each sensor (https://github.com/mysensors/NodeManager/issues/500), having all the sensors disabled by default and then dynamically enabling them

                      Bottomline not something to put in place in a few minutes but all the building blocks are there. I do not have at this time spare cycle to spend unfortunately but feel free to start looking at it if you like.

                      U Offline
                      U Offline
                      user2684
                      Contest Winner
                      wrote on last edited by
                      #12

                      @monte, I've implemented in PR https://github.com/mysensors/NodeManager/pull/517 something going in the direction you pointed out. Before explaining just a simple assumption first: NodeManager is intended to run on a number of different boards, most of them with limited memory so this capability has to take this constraint into consideration (hence no json parsing, reuse of existing communication mechanism, capability disabled by default, etc.)

                      Apart from this, I found a sort of compromise to enable/disable sensors, even remotely and optionally persisting the status across a reboot. All the implementation details are within the PR (down below, the PR also include other enhancements) feel free to provide comments here or on Github. Hope it could be useful to avoid reimplementing the entire logic from scratch

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      6

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.0k

                      Posts


                      Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular