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. Home Assistant
  4. Any plan to implement Ethernet GW?

Any plan to implement Ethernet GW?

Scheduled Pinned Locked Moved Home Assistant
69 Posts 5 Posters 18.3k Views 6 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.
  • Dave DanD Offline
    Dave DanD Offline
    Dave Dan
    wrote on last edited by Dave Dan
    #32

    Sure!

    Consistence file:

    {"156": {"sketch_version": null, "children": {}, "battery_level": 0, "sketch_name": null, "type": 17, "sensor_id": 156}, "102": {"sketch_version": null, "children": {}, "battery_level": 0, "sketch_name": null, "type": 17, "sensor_id": 102}}
    

    the Configuration is very light. Actually is the by default config and i just added this to test MySensors:

    mysensors:
      gateways:
        - device: 192.168.1.X
          persistence_file: '/home/pi/.homeassistant/MSPersistence.json'
          tcp_port: 5003
      debug: true
      persistence: true
      version: '1.5'
    

    let me know if you need anything else.

    1 Reply Last reply
    0
    • martinhjelmareM Offline
      martinhjelmareM Offline
      martinhjelmare
      Plugin Developer
      wrote on last edited by
      #33

      In the persistence file I can see two issues.

      Sketch name is null for both nodes.
      Both nodes don't have any children.

      Are you using a non default example sketch, if so can you post it?

      1 Reply Last reply
      0
      • Dave DanD Offline
        Dave DanD Offline
        Dave Dan
        wrote on last edited by
        #34

        hey Martin,

        that's correct, those are the 2 items I saw that was little curious about.

        The sketch I'm using, while custom, is a mix of different sketches that can be found in the MySensors page.

        As you'll see below, each node (which are identical) have all the information (Sketch name, version, etc). And all of them have 4 childs:
        - Ambient Humidity
        - Ambient Temperature
        - Ambient Light
        - Movement (Motion Sensor Trip).

        But I might have something wrong so ... happy to learn! :)

        #include <SPI.h>
        #include <MySensor.h>  
        #include <DHT.h>  
        
        #define NODE_ID 102
        
        #define SKETCH_NAME "dyaSensor (HTLM) v1.2"
        #define SKETCH_VERSION "1.2"
        
        #define CHILD_ID_HUM 0
        #define CHILD_ID_TEMP 1
        #define CHILD_ID_LIGHT 2
        #define CHILD_ID_MOV 3
        
        #define HUMIDITY_SENSOR_DIGITAL_PIN 4
        #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
        #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
        #define LIGHT_SENSOR_ANALOG_PIN 0
        
        #defin TEMP_CORRECTION 2
        
        unsigned long SLEEP_TIME = 1000; // Sleep time between reads (in milliseconds)
        
        MySensor gw;
        DHT dht;
        float lastTemp;
        float lastHum;
        int lastLightLevel;
        boolean metric = true; 
        
        //Building Messages
        MyMessage msgHum(CHILD_ID_HUM, V_HUM);            // Initialize humidity message
        MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);         // Initialize temperature message
        MyMessage msgLum(CHILD_ID_LIGHT, V_LIGHT_LEVEL);  // Initialize Light message
        MyMessage msgMov(CHILD_ID_MOV, V_TRIPPED);        // Initialize motion message
        
        void setup()  
        { 
        
          gw.begin(NULL, NODE_ID, false);
          dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
        
          // Send the Sketch Version Information to the Gateway
          gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
        
          pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
        
          // Register all sensors to gw (they will be created as child devices)
          Serial.println("Presenting Humidity Sensor");
          gw.present(CHILD_ID_HUM, S_HUM, "Humidity Sensor");
          
          Serial.println("Presenting Temperature Sensor");
          gw.present(CHILD_ID_TEMP, S_TEMP, "Temperature Sensor");
          
          Serial.println("Light Level Sensor");
          gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL, "Light Level Sensor");
          
          Serial.println("Presenting Motion Sensor");
          gw.present(CHILD_ID_MOV, S_MOTION, "Motion Sensor");
          
          metric = gw.getConfig().isMetric;
        }
        
        void loop()      
        {  
        
          // By calling process() you route messages in the background
          gw.process();
          
          delay(dht.getMinimumSamplingPeriod());
        
          float temperature = dht.getTemperature()-TEMP_CORRECTION;
          if (isnan(temperature)) {
              Serial.println("Failed reading temperature from DHT");
          } else if (temperature != lastTemp) {
            lastTemp = temperature;
            if (!metric) {
              temperature = dht.toFahrenheit(temperature);
            }
            gw.send(msgTemp.set(temperature, 1));
            Serial.print("- T: ");
            Serial.println(temperature);
          }
          
          float humidity = dht.getHumidity();
          if (isnan(humidity)) {
              Serial.println("Failed reading humidity from DHT");
          } else if (humidity != lastHum) {
              lastHum = humidity;
              gw.send(msgHum.set(humidity, 1));
              Serial.print("- H: ");
              Serial.println(humidity);
          }
        
          int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 
          if (lightLevel != lastLightLevel) {
            lastLightLevel = lightLevel;
            gw.send(msgLum.set(lightLevel));
            Serial.print("- L: ");
            Serial.println(lightLevel);    
          }
        
          // Read digital motion value
          boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
          gw.send(msgMov.set(tripped?"1":"0"));  // Send tripped value to gw 
          Serial.println(tripped?"- Movement Detected":"- No Movement Detected");
        
          gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
        }
        
        
        1 Reply Last reply
        0
        • martinhjelmareM martinhjelmare

          @drock1985

          :thumbsup:

          When you have time, can you run git log and tell me the top commit message, so I know which version you are using.

          Regarding autostart, no I don't think you can use the normal instructions together with the virtualenv. You could write a script, that changes to the virtualenv and starts hass, and run that script at login or similar.

          If you don't have another production install of home assistant on the computer, you can skip the virtualenv alltogether and just do:

          pip3 install --user "https://github.com/MartinHjelmare/home-assistant/archive/mysensors-tcp-gateway.zip"
          

          or if you want to install as root:

          sudo pip3 install "https://github.com/MartinHjelmare/home-assistant/archive/mysensors-tcp-gateway.zip"
          

          This way you should be able to autostart the usual way, per instructions on the web.

          But then if you want to test an update from me, you have to make sure you uninstall everything correctly and manually remove ~/.homeassistant/lib before you install again.

          Dave DanD Offline
          Dave DanD Offline
          Dave Dan
          wrote on last edited by Dave Dan
          #35

          Hey @martinhjelmare

          Does the above reply to @drock1985 means that I can do a basic installation as per https://home-assistant.io/

          pip3 install homeassistant
          hass --open-ui
          

          followed by

          sudo pip3 install "https://github.com/MartinHjelmare/home-assistant/archive/mysensors-tcp-gateway.zip"
          

          and will have a valid testing env without going into all the above steps of creating a virtualenv??

          If so I'd rather more this avenue because I can clean up everything with a new installation, install the zip and have a new testing env in minutes :)

          martinhjelmareM 2 Replies Last reply
          0
          • Dave DanD Dave Dan

            Hey @martinhjelmare

            Does the above reply to @drock1985 means that I can do a basic installation as per https://home-assistant.io/

            pip3 install homeassistant
            hass --open-ui
            

            followed by

            sudo pip3 install "https://github.com/MartinHjelmare/home-assistant/archive/mysensors-tcp-gateway.zip"
            

            and will have a valid testing env without going into all the above steps of creating a virtualenv??

            If so I'd rather more this avenue because I can clean up everything with a new installation, install the zip and have a new testing env in minutes :)

            martinhjelmareM Offline
            martinhjelmareM Offline
            martinhjelmare
            Plugin Developer
            wrote on last edited by
            #36

            @Dave-Dan

            I can't see any big issues with your sketch, just one small:

            I guess this is a typo:

            #defin TEMP_CORRECTION 2
            

            Since your sketch looks ok, I think something must have gone wrong with the communication between node and gateway. Have you been monitoring the comm, with a serial monitor, on the node side for example, to make sure all messages are sent ok?

            Dave DanD 1 Reply Last reply
            0
            • Dave DanD Dave Dan

              Hey @martinhjelmare

              Does the above reply to @drock1985 means that I can do a basic installation as per https://home-assistant.io/

              pip3 install homeassistant
              hass --open-ui
              

              followed by

              sudo pip3 install "https://github.com/MartinHjelmare/home-assistant/archive/mysensors-tcp-gateway.zip"
              

              and will have a valid testing env without going into all the above steps of creating a virtualenv??

              If so I'd rather more this avenue because I can clean up everything with a new installation, install the zip and have a new testing env in minutes :)

              martinhjelmareM Offline
              martinhjelmareM Offline
              martinhjelmare
              Plugin Developer
              wrote on last edited by
              #37

              @Dave-Dan

              The zip file you install from my github account, is the mysensors tcp gateway branch of home-assistant. So you shouldn't install home-assistant first, if you're going to install my branch.

              If you don't have any other version of home-assistant that you wish to keep, on the same computer, you can install my branch directly. You just have to make sure you uninstall it and remove ~/.homeassistant/lib before installing an update from me, if I commit some updates.

              Yeah, setting up a dev machine can be a hassle the first time, and not so useful if you're not developing with it.

              1 Reply Last reply
              0
              • martinhjelmareM martinhjelmare

                @Dave-Dan

                I can't see any big issues with your sketch, just one small:

                I guess this is a typo:

                #defin TEMP_CORRECTION 2
                

                Since your sketch looks ok, I think something must have gone wrong with the communication between node and gateway. Have you been monitoring the comm, with a serial monitor, on the node side for example, to make sure all messages are sent ok?

                Dave DanD Offline
                Dave DanD Offline
                Dave Dan
                wrote on last edited by
                #38

                @martinhjelmare

                thanks for the hint ... definetly a typo :$

                Yes, I'm monitoring the GW with MYSController as my GW is ethernet and I see all messages showing with no issue. But, I'll be happy to review again. :)

                martinhjelmareM 1 Reply Last reply
                0
                • Dave DanD Dave Dan

                  @martinhjelmare

                  thanks for the hint ... definetly a typo :$

                  Yes, I'm monitoring the GW with MYSController as my GW is ethernet and I see all messages showing with no issue. But, I'll be happy to review again. :)

                  martinhjelmareM Offline
                  martinhjelmareM Offline
                  martinhjelmare
                  Plugin Developer
                  wrote on last edited by
                  #39

                  @Dave-Dan

                  Yes, please start from the beginning:

                  Remove the persistence file
                  Start hass
                  Wait until you see that hass has (:smile:) connected to the gateway
                  Start a node
                  Start the next node

                  If you can post the serial log from that here, and also the log from hass, that would be great.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    drock1985
                    wrote on last edited by
                    #40

                    @martinhjelmare

                    Haven't had any issues with the sensors I have on my Dev unit; so far so good.

                    Are you thinking of releasing the ethernet GW code in this weeks update?

                    My Projects
                    2 Door Chime Sensor
                    Washing Machine Monitor

                    martinhjelmareM 1 Reply Last reply
                    0
                    • Andrew SanjanwalaA Offline
                      Andrew SanjanwalaA Offline
                      Andrew Sanjanwala
                      wrote on last edited by
                      #41

                      @martinhjelmare

                      Though I'm eager to try, I can't actually launch the Ethernet Gateway branch in a Windows environment. The best error I can provide is the generic failed to create process on calling hass. Platform is Windows Home Server 2011 running Python 3.5.1. All previous and current release branches of home assistant launch without error.

                      Any thoughts or other steps I can take to debug it further?

                      martinhjelmareM 1 Reply Last reply
                      0
                      • D drock1985

                        @martinhjelmare

                        Haven't had any issues with the sensors I have on my Dev unit; so far so good.

                        Are you thinking of releasing the ethernet GW code in this weeks update?

                        martinhjelmareM Offline
                        martinhjelmareM Offline
                        martinhjelmare
                        Plugin Developer
                        wrote on last edited by
                        #42

                        @drock1985

                        Good to hear. Have you tried connecting more than one node to the gateway at the same time?

                        Unfortunately I don't think it will make this release, cause I won't have time until Sunday, and the release might be finished before that. I will add some updates this weekend that you are welcome to try. After that we should be ready for release.

                        1 Reply Last reply
                        0
                        • Andrew SanjanwalaA Andrew Sanjanwala

                          @martinhjelmare

                          Though I'm eager to try, I can't actually launch the Ethernet Gateway branch in a Windows environment. The best error I can provide is the generic failed to create process on calling hass. Platform is Windows Home Server 2011 running Python 3.5.1. All previous and current release branches of home assistant launch without error.

                          Any thoughts or other steps I can take to debug it further?

                          martinhjelmareM Offline
                          martinhjelmareM Offline
                          martinhjelmare
                          Plugin Developer
                          wrote on last edited by
                          #43

                          @Andrew-Sanjanwala

                          My experience with python on Windows is very limited. How do you normally start home assistant?

                          1 Reply Last reply
                          0
                          • Andrew SanjanwalaA Offline
                            Andrew SanjanwalaA Offline
                            Andrew Sanjanwala
                            wrote on last edited by
                            #44

                            @martinhjelmare

                            I typically launch either using hass or hass --open-ui from an administrative powershell session. No-go in either of these two cases.

                            martinhjelmareM 1 Reply Last reply
                            0
                            • Andrew SanjanwalaA Andrew Sanjanwala

                              @martinhjelmare

                              I typically launch either using hass or hass --open-ui from an administrative powershell session. No-go in either of these two cases.

                              martinhjelmareM Offline
                              martinhjelmareM Offline
                              martinhjelmare
                              Plugin Developer
                              wrote on last edited by
                              #45

                              @Andrew-Sanjanwala

                              Did you install directly from my github branch using pip?

                              1 Reply Last reply
                              0
                              • Andrew SanjanwalaA Offline
                                Andrew SanjanwalaA Offline
                                Andrew Sanjanwala
                                wrote on last edited by
                                #46

                                Alright, false alarm. Root issue in my case was a faulty environment and/or operator that resulted in binaries being compiled for the wrong platform.

                                Once corrected, it compiled and launched your branch and connected to the gateway without incident. Next up is experimenting with the nodes and actuators. I'll see if the persistence file can be written to.

                                martinhjelmareM 1 Reply Last reply
                                0
                                • Andrew SanjanwalaA Andrew Sanjanwala

                                  Alright, false alarm. Root issue in my case was a faulty environment and/or operator that resulted in binaries being compiled for the wrong platform.

                                  Once corrected, it compiled and launched your branch and connected to the gateway without incident. Next up is experimenting with the nodes and actuators. I'll see if the persistence file can be written to.

                                  martinhjelmareM Offline
                                  martinhjelmareM Offline
                                  martinhjelmare
                                  Plugin Developer
                                  wrote on last edited by
                                  #47

                                  @Andrew-Sanjanwala

                                  :thumbsup:

                                  1 Reply Last reply
                                  0
                                  • Dave DanD Offline
                                    Dave DanD Offline
                                    Dave Dan
                                    wrote on last edited by
                                    #48

                                    Hey @martinhjelmare,

                                    I've been able to do some tests this time.

                                    From a Sensoring standpoint (retreive information from sensors to show in dashboard) works perfetly fine.

                                    I found the issue that I was referring before.

                                    Let's say you have already included a number of nodes and everything is working but for any reason you want to reset and start again. My logic was to remove the MSPersistance.json file, create a new one and the system will reconfigure again.

                                    What I'm seeing is that if you do that the system enters in a limbo situation where no nodes are added but those that were beforer are not added either. you can't see them in the dashboard nor in the Developers Tools section.

                                    Next step is to start testing relays, dimmers, etc.

                                    Let me know if you need more detils on the scenario.

                                    thanks!

                                    martinhjelmareM 1 Reply Last reply
                                    0
                                    • Dave DanD Dave Dan

                                      Hey @martinhjelmare,

                                      I've been able to do some tests this time.

                                      From a Sensoring standpoint (retreive information from sensors to show in dashboard) works perfetly fine.

                                      I found the issue that I was referring before.

                                      Let's say you have already included a number of nodes and everything is working but for any reason you want to reset and start again. My logic was to remove the MSPersistance.json file, create a new one and the system will reconfigure again.

                                      What I'm seeing is that if you do that the system enters in a limbo situation where no nodes are added but those that were beforer are not added either. you can't see them in the dashboard nor in the Developers Tools section.

                                      Next step is to start testing relays, dimmers, etc.

                                      Let me know if you need more detils on the scenario.

                                      thanks!

                                      martinhjelmareM Offline
                                      martinhjelmareM Offline
                                      martinhjelmare
                                      Plugin Developer
                                      wrote on last edited by
                                      #49

                                      @Dave-Dan said:

                                      My logic was to remove the MSPersistance.json file, create a new one and the system will reconfigure again.

                                      Can you describe more in detail how you did this? Do you have an example persistence file before and after your modifications?

                                      1 Reply Last reply
                                      0
                                      • Dave DanD Offline
                                        Dave DanD Offline
                                        Dave Dan
                                        wrote on last edited by
                                        #50

                                        Sure!

                                        the persistence once I've added some nodes looks like this:

                                        {"104": {"sketch_version": "1.0", "children": {"0": {"id": 0, "values": {"1": "38.0"}, "type": 7}, "1": {"id": 1, "values": {"0": "22.0"}, "type": 6}, "2": {"id": 2, "values": {"23": "34"}, "type": 16}, "3": {"id": 3, "values": {"16": "0"}, "type": 1}}, "battery_level": 0, "sensor_id": 104, "type": 17, "sketch_name": "dyaSensor (HTLM)"}, "106": {"sketch_version": "1.0", "children": {"0": {"id": 0, "values": {"1": "37.0"}, "type": 7}, "1": {"id": 1, "values": {"0": "22.0"}, "type": 6}, "2": {"id": 2, "values": {"23": "5"}, "type": 16}, "3": {"id": 3, "values": {"16": "0"}, "type": 1}}, "battery_level": 9, "sensor_id": 106, "type": 17, "sketch_name": "dyaSensor (HTLM)"}, "156": {"sketch_version": null, "children": {}, "battery_level": 0, "sensor_id": 156, "type": 17, "sketch_name": null}, "101": {"sketch_version": "1.2", "children": {"0": {"id": 0, "values": {"1": "34.0"}, "type": 7}, "1": {"id": 1, "values": {"0": "21.0"}, "type": 6}, "2": {"id": 2, "values": {}, "type": 16}, "3": {"id": 3, "values": {"16": "0"}, "type": 1}}, "battery_level": 0, "sensor_id": 101, "type": 17, "sketch_name": "dyaSensor (HTLM) v1.2"}, "102": {"sketch_version": "1.0", "children": {"0": {"id": 0, "values": {"1": "36.0"}, "type": 7}, "1": {"id": 1, "values": {"0": "18.0"}, "type": 6}, "2": {"id": 2, "values": {"23": "69"}, "type": 16}, "3": {"id": 3, "values": {"16": "0"}, "type": 1}}, "battery_level": 2, "sensor_id": 102, "type": 17, "sketch_name": "dyaSensor (HTLM)"}}
                                        

                                        after my modification (meaning, clear everything) looks this way:

                                        {}
                                        
                                        martinhjelmareM 1 Reply Last reply
                                        0
                                        • Dave DanD Dave Dan

                                          Sure!

                                          the persistence once I've added some nodes looks like this:

                                          {"104": {"sketch_version": "1.0", "children": {"0": {"id": 0, "values": {"1": "38.0"}, "type": 7}, "1": {"id": 1, "values": {"0": "22.0"}, "type": 6}, "2": {"id": 2, "values": {"23": "34"}, "type": 16}, "3": {"id": 3, "values": {"16": "0"}, "type": 1}}, "battery_level": 0, "sensor_id": 104, "type": 17, "sketch_name": "dyaSensor (HTLM)"}, "106": {"sketch_version": "1.0", "children": {"0": {"id": 0, "values": {"1": "37.0"}, "type": 7}, "1": {"id": 1, "values": {"0": "22.0"}, "type": 6}, "2": {"id": 2, "values": {"23": "5"}, "type": 16}, "3": {"id": 3, "values": {"16": "0"}, "type": 1}}, "battery_level": 9, "sensor_id": 106, "type": 17, "sketch_name": "dyaSensor (HTLM)"}, "156": {"sketch_version": null, "children": {}, "battery_level": 0, "sensor_id": 156, "type": 17, "sketch_name": null}, "101": {"sketch_version": "1.2", "children": {"0": {"id": 0, "values": {"1": "34.0"}, "type": 7}, "1": {"id": 1, "values": {"0": "21.0"}, "type": 6}, "2": {"id": 2, "values": {}, "type": 16}, "3": {"id": 3, "values": {"16": "0"}, "type": 1}}, "battery_level": 0, "sensor_id": 101, "type": 17, "sketch_name": "dyaSensor (HTLM) v1.2"}, "102": {"sketch_version": "1.0", "children": {"0": {"id": 0, "values": {"1": "36.0"}, "type": 7}, "1": {"id": 1, "values": {"0": "18.0"}, "type": 6}, "2": {"id": 2, "values": {"23": "69"}, "type": 16}, "3": {"id": 3, "values": {"16": "0"}, "type": 1}}, "battery_level": 2, "sensor_id": 102, "type": 17, "sketch_name": "dyaSensor (HTLM)"}}
                                          

                                          after my modification (meaning, clear everything) looks this way:

                                          {}
                                          
                                          martinhjelmareM Offline
                                          martinhjelmareM Offline
                                          martinhjelmare
                                          Plugin Developer
                                          wrote on last edited by
                                          #51

                                          @Dave-Dan

                                          Did you do it like this?

                                          1. Stop hass.
                                          2. Remove old persistence file.
                                          3. Create new persistence file with the same name and path, containing an empty JSON object, "{}".
                                          4. Start hass.
                                          5. Start node. Result: Messages are coming in to gateway, but node sensors are not added to entities nor shown in GUI.
                                          martinhjelmareM 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          22

                                          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