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. MySensor on Hass.io - can't get it work

MySensor on Hass.io - can't get it work

Scheduled Pinned Locked Moved Home Assistant
28 Posts 6 Posters 9.9k 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.
  • archiijsA Offline
    archiijsA Offline
    archiijs
    wrote on last edited by
    #4

    @maty said in MySensor on Hass.io - can't get it work:

    /config/mysensor

    Default path seems to be generic and not really useful, at the beginning I had problems with understanding this as well. Take a look at the full location where your home assistant configuration files are located, this could be a good location. and add "mysensors.json" at the end (this file will be created and you can name it anything.yson).
    like mine is "/root/.homeassistant/mysensors.json"

    MaTyM 1 Reply Last reply
    1
    • MaTyM Offline
      MaTyM Offline
      MaTy
      wrote on last edited by
      #5

      Wait, do I need to install an addon from reposytory, to make it work? Isn't it included in Hass.io? I cant see any repo :/

      1 Reply Last reply
      0
      • archiijsA archiijs

        @maty said in MySensor on Hass.io - can't get it work:

        /config/mysensor

        Default path seems to be generic and not really useful, at the beginning I had problems with understanding this as well. Take a look at the full location where your home assistant configuration files are located, this could be a good location. and add "mysensors.json" at the end (this file will be created and you can name it anything.yson).
        like mine is "/root/.homeassistant/mysensors.json"

        MaTyM Offline
        MaTyM Offline
        MaTy
        wrote on last edited by MaTy
        #6

        I think i found the answer ... https://forum.mysensors.org/topic/7360/hass-io-and-ethernet-gateway-on-pi

        It looks like I need docker add-on to run MySensors gateway on Hass.io, and it doesn't exist so far, what a shame :(

        martinhjelmareM 1 Reply Last reply
        0
        • Tom CarpenterT Offline
          Tom CarpenterT Offline
          Tom Carpenter
          wrote on last edited by
          #7

          I don't have a light switch on my sensors but I do have a couple of temp sensors running on my hassio installation with no problem.

          MaTyM 1 Reply Last reply
          0
          • Tom CarpenterT Tom Carpenter

            I don't have a light switch on my sensors but I do have a couple of temp sensors running on my hassio installation with no problem.

            MaTyM Offline
            MaTyM Offline
            MaTy
            wrote on last edited by
            #8

            @tom-carpenter
            How did You make it? Is it via serial gateway?

            Tom CarpenterT 1 Reply Last reply
            0
            • MaTyM MaTy

              I think i found the answer ... https://forum.mysensors.org/topic/7360/hass-io-and-ethernet-gateway-on-pi

              It looks like I need docker add-on to run MySensors gateway on Hass.io, and it doesn't exist so far, what a shame :(

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

              @maty

              That thread is about attaching the radio directly to the RPi GPIO in combination with Hass.io. You're using an arduino as gateway that has the radio if I understand correctly. So you shouldn't need an addon for your case.

              I suggest looking at the Z-wave documentation for Hass.io where they also connect a USB device. It's the same principle as the mysensors serial gateway when you use an arduino as gateway.

              https://home-assistant.io/hassio/zwave/

              MaTyM 1 Reply Last reply
              0
              • martinhjelmareM martinhjelmare

                @maty

                That thread is about attaching the radio directly to the RPi GPIO in combination with Hass.io. You're using an arduino as gateway that has the radio if I understand correctly. So you shouldn't need an addon for your case.

                I suggest looking at the Z-wave documentation for Hass.io where they also connect a USB device. It's the same principle as the mysensors serial gateway when you use an arduino as gateway.

                https://home-assistant.io/hassio/zwave/

                MaTyM Offline
                MaTyM Offline
                MaTy
                wrote on last edited by
                #10

                @martinhjelmare

                Oh, sorry, im so confused after I moved from domoticz to Hass.io. But I don't need Z-wave. What I have is serial gateway based on arduino mega 2560, with a sketch (example) https://hastebin.com/cinokiraka.cpp which controles all lights in my house. The arduino mega is connected to my RPI3 (with Hass.io) via usb (ttyUSB0). It worked perfectly on Domoticz, all lights was discovered automatically. I've checked the documentation of MySensors implementation on Hass.io web site, and read plenty of forums and still nothing :/
                I'm still getting errors. https://pastebin.com/VDaVRKkV

                martinhjelmareM 1 Reply Last reply
                0
                • N Offline
                  N Offline
                  nelsonov
                  wrote on last edited by
                  #11

                  Are you sure that's the right device? It's /dev/ttyUSB0 that is the source of the error in your output. Maybe the device is something like /dev/ttyAMA0 or /dev/ttyACM0?

                  https://keybase.io/nelsonov

                  MaTyM 1 Reply Last reply
                  0
                  • N nelsonov

                    Are you sure that's the right device? It's /dev/ttyUSB0 that is the source of the error in your output. Maybe the device is something like /dev/ttyAMA0 or /dev/ttyACM0?

                    MaTyM Offline
                    MaTyM Offline
                    MaTy
                    wrote on last edited by MaTy
                    #12

                    @nelsonov
                    when i use "hassio homeassistant hardware" command it displays only ttyUSB0 and ttyUSB1. I have RFLink connected to USB1 and it works great, so MySensors gateway must be the ttyUSB0.
                    https://pastebin.com/wTn72d1D Am I right?

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      nelsonov
                      wrote on last edited by nelsonov
                      #13

                      What do you get from ls -l /dev/tty*?

                      https://keybase.io/nelsonov

                      MaTyM 1 Reply Last reply
                      0
                      • N nelsonov

                        What do you get from ls -l /dev/tty*?

                        MaTyM Offline
                        MaTyM Offline
                        MaTy
                        wrote on last edited by MaTy
                        #14

                        @nelsonov resault
                        https://ibb.co/cyPQqG

                        1 Reply Last reply
                        0
                        • MaTyM Offline
                          MaTyM Offline
                          MaTy
                          wrote on last edited by
                          #15

                          After I disconnected gateway and connected it again, I checked command "dmesg | grep usb" and this showed up
                          https://hastebin.com/leqocowaco.vbs before there was nothing after command. Command ls -l /dev/tty* still the same.

                          1 Reply Last reply
                          0
                          • N Offline
                            N Offline
                            nelsonov
                            wrote on last edited by nelsonov
                            #16

                            You might need to take this to the [Home Assistant Forum]
                            (https://community.home-assistant.io). Something strange is going on at the OS level. Your kernel is recognizing the USB device, but the OS isn't creating the tty. You can try lsusb just to see if it's still there, but beyond that I'm out of advice. The error you are getting from Home Assistant has awkward wording, but it means that it can't find the serial device.

                            https://keybase.io/nelsonov

                            1 Reply Last reply
                            0
                            • MaTyM MaTy

                              @martinhjelmare

                              Oh, sorry, im so confused after I moved from domoticz to Hass.io. But I don't need Z-wave. What I have is serial gateway based on arduino mega 2560, with a sketch (example) https://hastebin.com/cinokiraka.cpp which controles all lights in my house. The arduino mega is connected to my RPI3 (with Hass.io) via usb (ttyUSB0). It worked perfectly on Domoticz, all lights was discovered automatically. I've checked the documentation of MySensors implementation on Hass.io web site, and read plenty of forums and still nothing :/
                              I'm still getting errors. https://pastebin.com/VDaVRKkV

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

                              @maty
                              If you read the Z-wave documentation I linked to you will get instructions how to add a specific USB device to Hass.io docker. My guess is this could solve your problem.

                              For some devices the /dev/ttyAMA0 device is not detected by udev and is therefore not mapped by Docker. To explicitly set this device for mapping to Home-Assistant, execute the following command using the ssh add-on:

                              $ curl -d '{"devices": ["ttyAMA0"]}' http://hassio/homeassistant/options
                              

                              Replace ttyAMA0 above with the correct device in your case.

                              MaTyM 1 Reply Last reply
                              0
                              • martinhjelmareM martinhjelmare

                                @maty
                                If you read the Z-wave documentation I linked to you will get instructions how to add a specific USB device to Hass.io docker. My guess is this could solve your problem.

                                For some devices the /dev/ttyAMA0 device is not detected by udev and is therefore not mapped by Docker. To explicitly set this device for mapping to Home-Assistant, execute the following command using the ssh add-on:

                                $ curl -d '{"devices": ["ttyAMA0"]}' http://hassio/homeassistant/options
                                

                                Replace ttyAMA0 above with the correct device in your case.

                                MaTyM Offline
                                MaTyM Offline
                                MaTy
                                wrote on last edited by MaTy
                                #18

                                @martinhjelmare
                                I did It. resault But I'm still getting errors :/

                                I guess I'm hopeless. It's probably sthg silly as always.

                                update:
                                after trying different solutions i typed hardware check command and new serial appeared 'AMA0' but I did nothing physically with RPi (din't attach any devices). I tried to check mysensors config with ttyAMA0 instead of USB0, but I still got the same resault.
                                ps. of course when I was trying your command ($ curl -d '{"devices": ["ttyAMA0"]}' http://hassio/homeassistant/options), I did it with USB0 parameter, not AMA0.

                                1 Reply Last reply
                                0
                                • MaTyM Offline
                                  MaTyM Offline
                                  MaTy
                                  wrote on last edited by MaTy
                                  #19

                                  Yesterday I accidentally restarted Hass.io with all that errors in config. I was afraid that it'll crush after restart but it actually worked. After restart I turned on switch on the wall, and Switch (light relay) appeared on Hass.io home screen.

                                  There are still the same errors in config, and I have some issues with those light switches. Most annoying issue is that Hass.io doesn't update switch state after change via gui. Switch state changes in Hass.io when i use manual switch on the wall but when I use gui it doesn't
                                  http://ibb.co/f8Rvum

                                  martinhjelmareM 1 Reply Last reply
                                  0
                                  • MaTyM MaTy

                                    Yesterday I accidentally restarted Hass.io with all that errors in config. I was afraid that it'll crush after restart but it actually worked. After restart I turned on switch on the wall, and Switch (light relay) appeared on Hass.io home screen.

                                    There are still the same errors in config, and I have some issues with those light switches. Most annoying issue is that Hass.io doesn't update switch state after change via gui. Switch state changes in Hass.io when i use manual switch on the wall but when I use gui it doesn't
                                    http://ibb.co/f8Rvum

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

                                    @maty

                                    You should send feedback of state changes to home assistant from your device. This is done from the receive function. The switch in home assistant will switch as soon as the feedback comes in.

                                    Also set optimistic to false in your mysensors config section.

                                    MaTyM 1 Reply Last reply
                                    0
                                    • martinhjelmareM martinhjelmare

                                      @maty

                                      You should send feedback of state changes to home assistant from your device. This is done from the receive function. The switch in home assistant will switch as soon as the feedback comes in.

                                      Also set optimistic to false in your mysensors config section.

                                      MaTyM Offline
                                      MaTyM Offline
                                      MaTy
                                      wrote on last edited by MaTy
                                      #21

                                      @martinhjelmare
                                      You mean in my sketch, something like this?

                                      void receive(const MyMessage &message) {
                                        // We only expect one type of message from controller. But we better check anyway.
                                        if (message.type==V_LIGHT) {
                                           // Change relay state
                                           digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
                                           // Store state in eeprom
                                           saveState(message.sensor, message.getBool());
                                           // Write some debug info
                                           Serial.print("Incoming change for sensor:");
                                           Serial.print(message.sensor);
                                           Serial.print(", New status: ");
                                           Serial.println(message.getBool());
                                      

                                      I had optimistic set false.

                                      BTW: Strange thing, baud rate in my sketch is 38400, but when I set it up in Hass.io, lights won't work, when I changed to 115200 in .yaml (in sketch is still 38400), all works fine, except the states update.

                                      martinhjelmareM 1 Reply Last reply
                                      0
                                      • MaTyM MaTy

                                        @martinhjelmare
                                        You mean in my sketch, something like this?

                                        void receive(const MyMessage &message) {
                                          // We only expect one type of message from controller. But we better check anyway.
                                          if (message.type==V_LIGHT) {
                                             // Change relay state
                                             digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
                                             // Store state in eeprom
                                             saveState(message.sensor, message.getBool());
                                             // Write some debug info
                                             Serial.print("Incoming change for sensor:");
                                             Serial.print(message.sensor);
                                             Serial.print(", New status: ");
                                             Serial.println(message.getBool());
                                        

                                        I had optimistic set false.

                                        BTW: Strange thing, baud rate in my sketch is 38400, but when I set it up in Hass.io, lights won't work, when I changed to 115200 in .yaml (in sketch is still 38400), all works fine, except the states update.

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

                                        @maty

                                        In your example above you never send the feedback from receive. Use the send method
                                        from within receive to do that.

                                        In what sketch have you set baud rate to 38400? For the light device or for the gateway? It's only the gateway baud rate that is relevant for home assistant config, since it's the gateway that interfaces via the serial connection to home assistant.

                                        MaTyM 1 Reply Last reply
                                        0
                                        • martinhjelmareM martinhjelmare

                                          @maty

                                          In your example above you never send the feedback from receive. Use the send method
                                          from within receive to do that.

                                          In what sketch have you set baud rate to 38400? For the light device or for the gateway? It's only the gateway baud rate that is relevant for home assistant config, since it's the gateway that interfaces via the serial connection to home assistant.

                                          MaTyM Offline
                                          MaTyM Offline
                                          MaTy
                                          wrote on last edited by MaTy
                                          #23

                                          @martinhjelmare

                                          Should it be something like this added to my sketch?

                                          send(msg.set(RELAY_1;V_LIGHT)
                                          send(msg.set(RELAY_2;V_LIGHT)
                                          ...
                                          

                                          I ment BAUD_RATE defined in this sketch

                                          #if F_CPU == 8000000L
                                          #define MY_BAUD_RATE 38400
                                          #endif
                                          

                                          Once again, sorry for tons of noob questions. But I didn't write that sketch by myself, and my knowledge about programming is below basic.

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


                                          21

                                          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