Skip to content
  • MySensors
  • 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. Controllers
  3. Node-RED
  4. node-red-contrib-mysensors release thread

node-red-contrib-mysensors release thread

Scheduled Pinned Locked Moved Node-RED
36 Posts 6 Posters 5.6k 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.
  • tbowmoT tbowmo

    @magpern this module is more if you want to only use nodered for your home automation, without Hass.io or the likes.

    Most of the standard controllers (domoticz, openhab, home assistant etc) are all able to handle the mysensors network directly (more or less), and handle the device registration for you.

    My module for nodered is implementing a crude controller, that only handles out node id's to the mysensors network, when asked for, and then leaves everything else up to your imagination, for how to wire things together behind the scenes.

    That being said, if you only need to convert your serial mysensors gateway into mqtt, I do have a small python script that I use for that particular case, as my nodered instance can't access the serial Ports from my docker swarm setup. So this script is running besides everything else. I can post it tomorrow if interested, as my pc is closed for the night now.

    / Thomas

    magpernM Offline
    magpernM Offline
    magpern
    wrote on last edited by
    #22

    @tbowmo said in node-red-contrib-mysensors release thread:

    That being said, if you only need to convert your serial mysensors gateway into mqtt, I do have a small python script that I use for that particular case, as my nodered instance can't access the serial Ports from my docker swarm setup. So this script is running besides everything else. I can post it tomorrow if interested, as my pc is closed for the night now.

    / Thomas

    I'd love to try the script! /Magnus

    tbowmoT 1 Reply Last reply
    0
    • magpernM magpern

      @tbowmo said in node-red-contrib-mysensors release thread:

      That being said, if you only need to convert your serial mysensors gateway into mqtt, I do have a small python script that I use for that particular case, as my nodered instance can't access the serial Ports from my docker swarm setup. So this script is running besides everything else. I can post it tomorrow if interested, as my pc is closed for the night now.

      / Thomas

      I'd love to try the script! /Magnus

      tbowmoT Offline
      tbowmoT Offline
      tbowmo
      Admin
      wrote on last edited by
      #23

      @magpern

      It's more or less the script below, I removed some stuff from my utility meter, that I also handles in my script (but isn't needed for just mysensors).

      #!/usr/bin/python3
      
      import serial
      import paho.mqtt.client as mqtt
      import time
      
      mysensors = serial.serial_for_url('/dev/ttyNRF24', 115200, rtscts=0, timeout=1000)
      mysensors.isOpen()
      mqtt_connect = False
      
      def mqtt_reception(client, userdata, msg):
          payload = msg.payload.decode("ascii")
          topic = msg.topic.split('/')
          topic.remove('mys-out')
          mymsg = ';'.join(topic) + ';' + payload + '\n'
          print("out <- ", mymsg)
          mysensors.write(str.encode(mymsg))
      
      def mqtt_connect(client, userdata, flags, rc):
          print('Connected')
          mqtt_connect = True
          client.subscribe('mys-out/#')
      
      def mqtt_disconnect(client, userdata, rc):
          print(rc)
          
      client = mqtt.Client('mys')
      client.on_connect = mqtt_connect
      client.on_message = mqtt_reception
      client.on_disconnect = mqtt_disconnect
      
      client.connect('192.168.1.64')
      
      def handle_data(data):
          print("in -> ", data)
          s = data.split(';')
          payload = s[-1]
          s.remove(payload)
          topic = 'mys-in/' + '/'.join(s)
          if mqtt_connect: 
              client.publish(topic, payload.rstrip())
      
      if __name__ == "__main__":
          client.loop_start()
          mys_data_str = '';
          util_data_str = '';
          while (True):
              if (mysensors.inWaiting()>0):
                  char = mysensors.read(1).decode('ascii')
                  mys_data_str += char
                  if (char == '\n'):
                      handle_data(mys_data_str)
                      mys_data_str = ''
              time.sleep(0.01)
      
      1 Reply Last reply
      0
      • D Offline
        D Offline
        DenisJ
        wrote on last edited by
        #24

        Hi there all,
        I just try to install the node in my Node-Red (Home Assistant)
        and I got error:

        -----------------------------------------------------------
        2021-04-30T07:18:09.293Z Install : node-red-contrib-mysensors 3.3.1
        
        2021-04-30T07:18:07.624Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-mysensors@3.3.1
        2021-04-30T07:18:11.638Z [err] npm WARN deprecated @types/moment-timezone@0.5.30: This is a stub types definition. moment-timezone provides its own type definitions, so you do not need this installed.
        2021-04-30T07:18:14.813Z [err] npm WARN
        2021-04-30T07:18:14.813Z [err]  deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
        2021-04-30T07:18:19.176Z [out] 
        2021-04-30T07:18:19.176Z [out] > sqlite3@4.2.0 install /config/node-red/node_modules/sqlite3
        2021-04-30T07:18:19.176Z [out] > node-pre-gyp install --fallback-to-build
        2021-04-30T07:18:19.176Z [out] 
        2021-04-30T07:18:19.551Z [err] node-pre-gyp
        2021-04-30T07:18:19.552Z [err]  WARN Using request for node-pre-gyp https download 
        2021-04-30T07:18:20.511Z [err] node-pre-gyp
        2021-04-30T07:18:20.512Z [err]  WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v83-linux-x64.tar.gz 
        2021-04-30T07:18:20.512Z [err] node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.2.0 and node@14.16.1 (node-v83 ABI, musl) (falling back to source compile with node-gyp) 
        2021-04-30T07:18:21.714Z [err] gyp
        2021-04-30T07:18:21.715Z [err]  
        2021-04-30T07:18:21.715Z [err] ERR!
        2021-04-30T07:18:21.715Z [err]  
        2021-04-30T07:18:21.716Z [err] build error
        2021-04-30T07:18:21.716Z [err]  
        2021-04-30T07:18:21.716Z [err] gyp
        2021-04-30T07:18:21.717Z [err]  
        2021-04-30T07:18:21.717Z [err] ERR!
        2021-04-30T07:18:21.717Z [err]  
        2021-04-30T07:18:21.717Z [err] stack
        2021-04-30T07:18:21.717Z [err]  Error: not found: make
        2021-04-30T07:18:21.717Z [err] gyp
        2021-04-30T07:18:21.717Z [err]  
        2021-04-30T07:18:21.717Z [err] ERR!
        2021-04-30T07:18:21.717Z [err]  
        2021-04-30T07:18:21.717Z [err] stack
        2021-04-30T07:18:21.717Z [err]      at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
        2021-04-30T07:18:21.718Z [err] gyp
        2021-04-30T07:18:21.718Z [err]  
        2021-04-30T07:18:21.718Z [err] ERR!
        2021-04-30T07:18:21.718Z [err]  
        2021-04-30T07:18:21.718Z [err] stack
        2021-04-30T07:18:21.718Z [err]      at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
        2021-04-30T07:18:21.718Z [err] gyp
        2021-04-30T07:18:21.718Z [err]  
        2021-04-30T07:18:21.718Z [err] ERR!
        2021-04-30T07:18:21.718Z [err]  
        2021-04-30T07:18:21.718Z [err] stack
        2021-04-30T07:18:21.719Z [err]      at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
        2021-04-30T07:18:21.719Z [err] gyp
        2021-04-30T07:18:21.719Z [err]  
        2021-04-30T07:18:21.719Z [err] ERR!
        2021-04-30T07:18:21.719Z [err]  
        2021-04-30T07:18:21.719Z [err] stack
        2021-04-30T07:18:21.719Z [err]      at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
        2021-04-30T07:18:21.719Z [err] gyp
        2021-04-30T07:18:21.719Z [err]  
        2021-04-30T07:18:21.719Z [err] ERR!
        2021-04-30T07:18:21.720Z [err]  
        2021-04-30T07:18:21.720Z [err] stack
        2021-04-30T07:18:21.720Z [err]      at /usr/lib/node_modules/npm/node_modules/isexe/index.js:42:5
        2021-04-30T07:18:21.720Z [err] gyp
        2021-04-30T07:18:21.720Z [err]  
        2021-04-30T07:18:21.720Z [err] ERR!
        2021-04-30T07:18:21.720Z [err]  
        2021-04-30T07:18:21.720Z [err] stack
        2021-04-30T07:18:21.720Z [err]      at /usr/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
        2021-04-30T07:18:21.720Z [err] gyp
        2021-04-30T07:18:21.720Z [err]  
        2021-04-30T07:18:21.721Z [err] ERR!
        2021-04-30T07:18:21.721Z [err]  
        2021-04-30T07:18:21.721Z [err] stack
        2021-04-30T07:18:21.721Z [err]      at FSReqCallback.oncomplete (fs.js:183:21)
        2021-04-30T07:18:21.721Z [err] gyp
        2021-04-30T07:18:21.721Z [err]  
        2021-04-30T07:18:21.721Z [err] ERR!
        2021-04-30T07:18:21.721Z [err]  
        2021-04-30T07:18:21.721Z [err] System
        2021-04-30T07:18:21.722Z [err]  Linux 5.0.0-27-generic
        2021-04-30T07:18:21.722Z [err] gyp
        2021-04-30T07:18:21.722Z [err]  
        2021-04-30T07:18:21.722Z [err] ERR!
        2021-04-30T07:18:21.722Z [err]  
        2021-04-30T07:18:21.722Z [err] command
        2021-04-30T07:18:21.722Z [err]  "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/config/node-red/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/config/node-red/node_modules/sqlite3/lib/binding/node-v83-linux-x64" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
        2021-04-30T07:18:21.722Z [err] gyp
        2021-04-30T07:18:21.722Z [err]  
        2021-04-30T07:18:21.722Z [err] ERR!
        2021-04-30T07:18:21.723Z [err]  
        2021-04-30T07:18:21.723Z [err] cwd
        2021-04-30T07:18:21.723Z [err]  /config/node-red/node_modules/sqlite3
        2021-04-30T07:18:21.723Z [err] gyp
        2021-04-30T07:18:21.723Z [err]  
        2021-04-30T07:18:21.723Z [err] ERR!
        2021-04-30T07:18:21.723Z [err]  
        2021-04-30T07:18:21.723Z [err] node -v
        2021-04-30T07:18:21.724Z [err]  v14.16.1
        2021-04-30T07:18:21.724Z [err] gyp
        2021-04-30T07:18:21.724Z [err]  
        2021-04-30T07:18:21.724Z [err] ERR!
        2021-04-30T07:18:21.724Z [err]  
        2021-04-30T07:18:21.724Z [err] node-gyp -v
        2021-04-30T07:18:21.725Z [err]  v5.1.0
        2021-04-30T07:18:21.725Z [err] gyp
        2021-04-30T07:18:21.725Z [err]  
        2021-04-30T07:18:21.725Z [err] ERR!
        2021-04-30T07:18:21.725Z [err]  
        2021-04-30T07:18:21.725Z [err] not ok
        2021-04-30T07:18:21.725Z [err]  
        2021-04-30T07:18:21.730Z [err] node-pre-gyp
        2021-04-30T07:18:21.730Z [err]  ERR! build error 
        2021-04-30T07:18:21.731Z [err] node-pre-gyp ERR! 
        2021-04-30T07:18:21.731Z [err] stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/config/node-red/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/config/node-red/node_modules/sqlite3/lib/binding/node-v83-linux-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
        2021-04-30T07:18:21.731Z [err] node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/config/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
        2021-04-30T07:18:21.731Z [err] node-pre-gyp 
        2021-04-30T07:18:21.731Z [err] ERR! stack     at ChildProcess.emit (events.js:315:20)
        2021-04-30T07:18:21.731Z [err] node-pre-gyp ERR! 
        2021-04-30T07:18:21.731Z [err] stack     at maybeClose (internal/child_process.js:1048:16)
        2021-04-30T07:18:21.731Z [err] node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
        2021-04-30T07:18:21.731Z [err] node-pre-gyp ERR! 
        2021-04-30T07:18:21.731Z [err] System Linux 5.0.0-27-generic
        2021-04-30T07:18:21.731Z [err] node-pre-gyp
        2021-04-30T07:18:21.731Z [err]  ERR! command "/usr/bin/node" "/config/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
        2021-04-30T07:18:21.731Z [err] node-pre-gyp
        2021-04-30T07:18:21.731Z [err]  ERR! cwd /config/node-red/node_modules/sqlite3
        2021-04-30T07:18:21.731Z [err] node-pre-gyp
        2021-04-30T07:18:21.731Z [err]  ERR! node -v v14.16.1
        2021-04-30T07:18:21.732Z [err] node-pre-gyp ERR! node-pre-gyp -v v0.11.0
        2021-04-30T07:18:21.732Z [err] node-pre-gyp ERR! not ok 
        2021-04-30T07:18:21.732Z [out] Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/config/node-red/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/config/node-red/node_modules/sqlite3/lib/binding/node-v83-linux-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
        2021-04-30T07:18:22.158Z [err] npm ERR!
        2021-04-30T07:18:22.158Z [err]  code ELIFECYCLE
        2021-04-30T07:18:22.158Z [err] npm ERR! errno 1
        2021-04-30T07:18:22.164Z [err] npm ERR!
        2021-04-30T07:18:22.164Z [err]  sqlite3@4.2.0 install: `node-pre-gyp install --fallback-to-build`
        2021-04-30T07:18:22.164Z [err] npm ERR! Exit status 1
        2021-04-30T07:18:22.164Z [err] npm ERR! 
        2021-04-30T07:18:22.164Z [err] npm 
        2021-04-30T07:18:22.164Z [err] ERR! Failed at the sqlite3@4.2.0 install script.
        2021-04-30T07:18:22.164Z [err] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
        2021-04-30T07:18:22.178Z [err] 
        2021-04-30T07:18:22.178Z [err] npm ERR! A complete log of this run can be found in:
        2021-04-30T07:18:22.178Z [err] npm ERR!     /root/.npm/_logs/2021-04-30T07_18_22_169Z-debug.log
        2021-04-30T07:18:22.201Z rc=1
        

        Is there still possibility to install it please ?
        Thanks a lot
        Denis

        1 Reply Last reply
        0
        • tbowmoT Offline
          tbowmoT Offline
          tbowmo
          Admin
          wrote on last edited by
          #25

          NPM is trying to build sqlite, because it cannot find a suitable pre-built one for your architecture, it fails because you do not have the needed tools installed for this on your machine.

          Might help if you install build-essentials (sudo apt-get install build-essentials, assuming you are on a debian like install)

          I currently use it on node-red 1.1.2, without problems. But I'm using plain node-red in a docker container..

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DenisJ
            wrote on last edited by
            #26

            @tbowmo said in node-red-contrib-mysensors release thread:

            ed 1.1.2, without problem

            Thanks for the answer.
            I have now Node-Red 1.3.3 under Home Assistant installed.
            But I must search on net how can I install the build-essentials from the docker console.

            Do you know if is there some other node that I can install from the palette that maybe incluse the build-essentials please ?

            Thanks again
            Denis

            1 Reply Last reply
            0
            • tbowmoT Offline
              tbowmoT Offline
              tbowmo
              Admin
              wrote on last edited by
              #27

              What I did way back when I got it up and running in docker, was to jump into the container shell, and install the package manually (So you are using the same node.js version that node-red is using).

              You could also (in that docker shell) do a apt install (given that it builds upon a debian based image).

              something in the line of:

              $ docker exec -it <id of container running node-red> /bin/bash
              # now you are in docker..
              $ apt install build-essentials
              $ cd <to your node-red data directory>
              $ npm install node-red-contrib-mysensors
              $ exit
              

              Above is taken purely from what I think is the right commands, as I have not tried working with home-assistant for a while.

              1 Reply Last reply
              1
              • D Offline
                D Offline
                DenisJ
                wrote on last edited by
                #28

                @tbowmo said in node-red-contrib-mysensors release thread:

                apt install build-essentials

                I think I have not the apt inside of Node_red docker.
                04b55f00-fe0e-4ab0-b0a3-a2e4762158f8-image.png

                Can I install it from outside in this case.
                Sorry but I'm very beginner so I need some basic info in this case.

                Thanks a lot again
                Denis

                1 Reply Last reply
                0
                • electrikE Offline
                  electrikE Offline
                  electrik
                  wrote on last edited by
                  #29

                  In Home Assistant you have the Node Red configuration (under supervisor). There you can add packages to be installed under system_packages: []

                  1 Reply Last reply
                  1
                  • D Offline
                    D Offline
                    DenisJ
                    wrote on last edited by
                    #30

                    @electrik said in node-red-contrib-mysensors release thread:

                    system_packages
                    I have try to insert in the system_packages like this:

                    86f16d43-4072-42b7-8a5b-a0eaf72ed908-image.png

                    But it give me errore when start:
                    cff61c5d-af7d-433f-b61b-4020f2bd7858-image.png

                    I think I'll make some translate node by my self
                    Thanks a lot again

                    Denis

                    1 Reply Last reply
                    0
                    • electrikE Offline
                      electrikE Offline
                      electrik
                      wrote on last edited by electrik
                      #31

                      Shouldn't it be

                      build-essentials
                      

                      ?

                      1 Reply Last reply
                      1
                      • D Offline
                        D Offline
                        DenisJ
                        wrote on last edited by
                        #32

                        @electrik said in node-red-contrib-mysensors release thread:

                        build-essentials

                        I try it but it give me same errore.
                        efe0a31c-b22f-4edb-b186-f4e0157e0eb4-image.png

                        I think that that package must be here in this link like the error log tell
                        Do you have Home Assistant installed ? if yes... do you have this "essentials" installed also ?
                        Thanks again
                        Denis

                        1 Reply Last reply
                        0
                        • electrikE Offline
                          electrikE Offline
                          electrik
                          wrote on last edited by
                          #33

                          Yes I have home assistant but don't have the build essentials. I did some more reading and it seems like a package of build tools. Perhaps @tbowmo knows which specific one is needed?

                          tbowmoT 1 Reply Last reply
                          1
                          • D Offline
                            D Offline
                            DenisJ
                            wrote on last edited by
                            #34

                            No problem @electrik I have already set the Node-Red to translate my node sensor in human leggibile data :-)
                            d1a67cd0-fb8d-4e79-833f-a246ef208f5b-image.png

                            And now I can see it like this:
                            681efe88-e2e9-4ff8-8090-835fe1763a20-image.png

                            All ok and thanks a lot for the help
                            Denis

                            1 Reply Last reply
                            0
                            • electrikE electrik

                              Yes I have home assistant but don't have the build essentials. I did some more reading and it seems like a package of build tools. Perhaps @tbowmo knows which specific one is needed?

                              tbowmoT Offline
                              tbowmoT Offline
                              tbowmo
                              Admin
                              wrote on last edited by
                              #35

                              @electrik

                              When I said that you needed the package "build-essentials" I assumed that you where running on a barebone ubuntu distribution, and not in docker. This complicates things, but it seems that others do have the same issue with node-red and sqlite on home-assistant forum.

                              One solution is given here: https://community.home-assistant.io/t/how-to-get-access-to-sqlite-on-hassio/241439/3

                              As said earlier I do not know anything about the internals in home-assistant and their specific docker / node-red setup.

                              1 Reply Last reply
                              1
                              • D Offline
                                D Offline
                                DenisJ
                                wrote on last edited by
                                #36

                                @tbowmo said in node-red-contrib-mysensors release thread:

                                e-assistant and their spe

                                Thanks a lot @tbowmo

                                Denis

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


                                20

                                Online

                                11.7k

                                Users

                                11.2k

                                Topics

                                113.1k

                                Posts


                                Copyright 2025 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
                                • MySensors
                                • OpenHardware.io
                                • Categories
                                • Recent
                                • Tags
                                • Popular