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. Troubleshooting
  3. Relay shows up in mysensors.json but not in gui [homeassistant]

Relay shows up in mysensors.json but not in gui [homeassistant]

Scheduled Pinned Locked Moved Troubleshooting
18 Posts 4 Posters 1.3k Views 4 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.
  • J Jens Jensen

    So I too was having this issue and pulling my hair out trying to understand what was wrong.
    The homeassistant/mysensor doc page says you have to send intial values, but the important nuanced point is that ALL possible value types must have an initial value sent for a given sensor type.

    In my example, I could not figure out why my motion sensor (S_MOTION) was not registering in HA UI - I was sending an initial (V_TRIPPED) state.

    However, S_MOTION sensors can have both V_TRIPPED and V_ARMED.
    ref: https://www.mysensors.org/download/serial_api_20#presentation
    Once I sent an initial value for V_ARMED, it started working - whew!

    So check carefully that you are sending some initial value for EVERY possible value type of your sensor type.

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

    @jens-jensen thank you for your input
    could you have a look at my sketch above and point me in the right direction on what needs to be changed/added?
    I see this part which looks good to me:

    MyMessage flowMsg(CHILD_ID,V_FLOW);
    MyMessage volumeMsg(CHILD_ID,V_VOLUME);
    MyMessage lastCounterMsg(CHILD_ID,V_VAR1);```
    thanks
    J 1 Reply Last reply
    0
    • B bereska

      @jens-jensen thank you for your input
      could you have a look at my sketch above and point me in the right direction on what needs to be changed/added?
      I see this part which looks good to me:

      MyMessage flowMsg(CHILD_ID,V_FLOW);
      MyMessage volumeMsg(CHILD_ID,V_VOLUME);
      MyMessage lastCounterMsg(CHILD_ID,V_VAR1);```
      thanks
      J Offline
      J Offline
      Jens Jensen
      wrote on last edited by Jens Jensen
      #9

      @bereska
      looks mostly correct, althought I would take a look at the example here to use their technique for ensuring you send initial values for V_FLOW and V_VOLUME.
      ref: https://www.home-assistant.io/components/mysensors/

      From your sketch, it seems possible that either may not be sent right away, e.g. if volume or flow is not changing, etc.

      Also, where in HA UI are you looking? I had to add my sensor to one of my lovelace cards. Still getting the hang of the new UI (but definitely better than it was before). I also saw it in developer, states under current entities

      B 1 Reply Last reply
      0
      • J Jens Jensen

        @bereska
        looks mostly correct, althought I would take a look at the example here to use their technique for ensuring you send initial values for V_FLOW and V_VOLUME.
        ref: https://www.home-assistant.io/components/mysensors/

        From your sketch, it seems possible that either may not be sent right away, e.g. if volume or flow is not changing, etc.

        Also, where in HA UI are you looking? I had to add my sensor to one of my lovelace cards. Still getting the hang of the new UI (but definitely better than it was before). I also saw it in developer, states under current entities

        B Offline
        B Offline
        bereska
        wrote on last edited by
        #10

        @jens-jensen thank you, like you said the sketch looks ok. Yet this only sensor fails to appear in HA, neither on dashboard nor in states or unused entities. The only thing I have noticed though is that this sketch is missing this part:

        Bounce debouncer = Bounce();
        bool state = false;
        bool initialValueSent = false;
        

        maybe that's the key to this problem?

        B 1 Reply Last reply
        0
        • B bereska

          @jens-jensen thank you, like you said the sketch looks ok. Yet this only sensor fails to appear in HA, neither on dashboard nor in states or unused entities. The only thing I have noticed though is that this sketch is missing this part:

          Bounce debouncer = Bounce();
          bool state = false;
          bool initialValueSent = false;
          

          maybe that's the key to this problem?

          B Offline
          B Offline
          bereska
          wrote on last edited by
          #11

          this is HA log:

          2019-07-04 23:24:05 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on mygateway1-out/6/255/3/0/11: b'Water Meter',
          2019-07-04 23:24:05 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 6;255;3;0;11;Water Meter,
          2019-07-04 23:24:23 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on mygateway1-out/6/255/3/0/11: b'Water Meter',
          2019-07-04 23:24:23 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 6;255;3;0;11;Water Meter

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jens Jensen
            wrote on last edited by
            #12

            Looking at your HA log, do you see that both V_FLOW and V_VOLUME values are sent after some time?

            With the sketch, their idea is that you use initialValueSent to send initial values (for all types) only once (at first boot) in loop section.

            B 1 Reply Last reply
            0
            • J Jens Jensen

              Looking at your HA log, do you see that both V_FLOW and V_VOLUME values are sent after some time?

              With the sketch, their idea is that you use initialValueSent to send initial values (for all types) only once (at first boot) in loop section.

              B Offline
              B Offline
              bereska
              wrote on last edited by
              #13

              @jens-jensen said in Relay shows up in mysensors.json but not in gui [homeassistant]:

              V_FLOW and V_VOLUME values are sent after some time

              no, V_FLOW and V_VOLUME values are NOT sent after some time
              how to i modify the sketch to make it happen?

              J 1 Reply Last reply
              0
              • B bereska

                @jens-jensen said in Relay shows up in mysensors.json but not in gui [homeassistant]:

                V_FLOW and V_VOLUME values are sent after some time

                no, V_FLOW and V_VOLUME values are NOT sent after some time
                how to i modify the sketch to make it happen?

                J Offline
                J Offline
                Jens Jensen
                wrote on last edited by
                #14

                @bereska
                look at how the reference sketch in the homeassistant mysensors page works.
                I starts with a bool initialValueSent set to false.
                It checks for this in loop, and if not already set to true, it will send initial values, then set initialValueSent = false, so that it never runs again (until sensor is restarted).

                Also regarding your sketch logic, should it periodically send values of all sensors (like at least once per hour, per day, etc)? You may want to look at that as well.

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  Jens Jensen
                  wrote on last edited by
                  #15

                  ok, I think i have also may have found a bug in the HA mysensors implementation, i.e. if you name your sketch with some reserved names, it never registers in HA.

                  I.e.
                  sendSketchInfo("motion_sensor", "1.0"); won't work in HA
                  but sendSketchInfo("motion_sensor_foo", "1.0"); shows up :(
                  I didn't see any mention of this in https://www.home-assistant.io/components/mysensors/
                  Maybe it's a bug (should mysensors ha component rename it or prefix with some namespace, etc; or should this be documented in guide - and then what are the reserved names which we cannot name sketches to?)

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    Jens Jensen
                    wrote on last edited by
                    #16

                    nm, I seems like it eventually sends the sketch name

                    B 1 Reply Last reply
                    0
                    • J Jens Jensen

                      nm, I seems like it eventually sends the sketch name

                      B Offline
                      B Offline
                      bereska
                      wrote on last edited by
                      #17

                      @jens-jensen it does send and register the name, no problem.

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        bereska
                        wrote on last edited by
                        #18

                        i can't get this sensor to show up in HA. Any ideas anyone?

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


                        11

                        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