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. Send configuration (numbers) from HA to Arduino

Send configuration (numbers) from HA to Arduino

Scheduled Pinned Locked Moved Home Assistant
home assistantarduinocommunication
7 Posts 3 Posters 52 Views 2 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.
  • OldSurferDudeO Offline
    OldSurferDudeO Offline
    OldSurferDude
    wrote on last edited by
    #1

    I would like to make changes to my Arduino sensor after it is deployed. I have developed an autocalibration scheme, but it needs its zero point set, which can't be done until it's in its final location. Yes, I suppose I could, with long wires, connect a push button to an input. But that doesn't completely solve the problem because I need to send a number that can be interpreted to be the interval between sending data to HA.

    This is my receive routine:

    //-------------------------------------------------------------------------receive
    void receive(const MyMessage &message)
    {
    	// We only expect one type of message from controller. But we better check anyway.
    	if (message.getType()==V_VAR1) {
        ConfigurationFromMySensors = message.getLong();
    	}
    }
    

    In HA, I would pack the information in a 4 byte integer (long) and unpack it in the loop where I would operate on it as needed.

    But how do I send the 4 byte integer from HA?

    Thanks for your consideration and hopefully, help!

    OSD

    mfalkviddM 1 Reply Last reply
    1
    • OldSurferDudeO OldSurferDude

      I would like to make changes to my Arduino sensor after it is deployed. I have developed an autocalibration scheme, but it needs its zero point set, which can't be done until it's in its final location. Yes, I suppose I could, with long wires, connect a push button to an input. But that doesn't completely solve the problem because I need to send a number that can be interpreted to be the interval between sending data to HA.

      This is my receive routine:

      //-------------------------------------------------------------------------receive
      void receive(const MyMessage &message)
      {
      	// We only expect one type of message from controller. But we better check anyway.
      	if (message.getType()==V_VAR1) {
          ConfigurationFromMySensors = message.getLong();
      	}
      }
      

      In HA, I would pack the information in a 4 byte integer (long) and unpack it in the loop where I would operate on it as needed.

      But how do I send the 4 byte integer from HA?

      Thanks for your consideration and hopefully, help!

      OSD

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      @OldSurferDude I have not tried it myself, but I think you request it, like https://www.mysensors.org/build/pulse_power does in setup().

      You could request it periodically to remove the need for an input button.

      OldSurferDudeO 2 Replies Last reply
      0
      • mfalkviddM mfalkvidd

        @OldSurferDude I have not tried it myself, but I think you request it, like https://www.mysensors.org/build/pulse_power does in setup().

        You could request it periodically to remove the need for an input button.

        OldSurferDudeO Offline
        OldSurferDudeO Offline
        OldSurferDude
        wrote on last edited by
        #3

        @mfalkvidd Thanks for the tip! It led me to the Home Assistant page that explains how to do it. I'll be having a look at that and report back what I find.

        1 Reply Last reply
        1
        • mfalkviddM mfalkvidd

          @OldSurferDude I have not tried it myself, but I think you request it, like https://www.mysensors.org/build/pulse_power does in setup().

          You could request it periodically to remove the need for an input button.

          OldSurferDudeO Offline
          OldSurferDudeO Offline
          OldSurferDude
          wrote on last edited by OldSurferDude
          #4

          @mfalkvidd
          I still don't see how to send a 4 byte value.

          If I have an LED, the message variable type is V_STATUS, the presentation variable is S_BINARY and the request variable is V_STATUS, and the receive variable is V_STATUS. This will set up a nice toggle switch under Controls in Home Automation. (Home Assistant-->Settings-->Devices & Services-->Devices-->"(my device name [node id])"--> )

          What V_variable/S_variable combination yields a control in Home Assistant?

          Let us suppose my node ID is 71, and my child id is 5. There will appear as a toggle control in Home Assistant. If I publish to the MQTT broker the topic mysensors-in/71/5/1/1/2 (2 being the number associated with V_STATUS) with a payload of 1, my LED turns on. Yeah!

          Now I set up a V_CUSTOM/S_CUSTOM device at child ID 3. This appears as a Sensor in Home Assistant, not as a control. If I publish to the MQTT broker the topic mysensors-in/71/3/1/1/48 (48 being the number associated with V_CUSTOM) the payload 1280, it arrives at my device and it deals with it as expected.

          Thus my question: "What V_variable/S_variable combination that yields a control in Home Assistant?" Oh, and have Home Assistant be able to send an unsigned long?

          I suspect that that capability has yet to be developed for the MySensors Integration in Home Assistant. I'd like to know if this is the case. Perhaps I can figure out how to have Home Assistant send the MQTT message for me?

          Thanks for your consideration!

          OSD

          mfalkviddM 1 Reply Last reply
          0
          • OldSurferDudeO OldSurferDude

            @mfalkvidd
            I still don't see how to send a 4 byte value.

            If I have an LED, the message variable type is V_STATUS, the presentation variable is S_BINARY and the request variable is V_STATUS, and the receive variable is V_STATUS. This will set up a nice toggle switch under Controls in Home Automation. (Home Assistant-->Settings-->Devices & Services-->Devices-->"(my device name [node id])"--> )

            What V_variable/S_variable combination yields a control in Home Assistant?

            Let us suppose my node ID is 71, and my child id is 5. There will appear as a toggle control in Home Assistant. If I publish to the MQTT broker the topic mysensors-in/71/5/1/1/2 (2 being the number associated with V_STATUS) with a payload of 1, my LED turns on. Yeah!

            Now I set up a V_CUSTOM/S_CUSTOM device at child ID 3. This appears as a Sensor in Home Assistant, not as a control. If I publish to the MQTT broker the topic mysensors-in/71/3/1/1/48 (48 being the number associated with V_CUSTOM) the payload 1280, it arrives at my device and it deals with it as expected.

            Thus my question: "What V_variable/S_variable combination that yields a control in Home Assistant?" Oh, and have Home Assistant be able to send an unsigned long?

            I suspect that that capability has yet to be developed for the MySensors Integration in Home Assistant. I'd like to know if this is the case. Perhaps I can figure out how to have Home Assistant send the MQTT message for me?

            Thanks for your consideration!

            OSD

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #5

            @OldSurferDude great questions. I'm afraid I have no idea. I have never used MySensors with HA.

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

              I'm doing a similar thing, but use node red to inject the values directly to mqtt. This brings more flexibility as it allows any value to be injected, while home assistant checks on values as they are defined in the mysensors protocol specification.

              OldSurferDudeO 1 Reply Last reply
              1
              • electrikE electrik

                I'm doing a similar thing, but use node red to inject the values directly to mqtt. This brings more flexibility as it allows any value to be injected, while home assistant checks on values as they are defined in the mysensors protocol specification.

                OldSurferDudeO Offline
                OldSurferDudeO Offline
                OldSurferDude
                wrote on last edited by
                #7

                @electrik Thanks, I think I can do the same with the MQTT integration (not MySensors MQTT)

                OSD

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


                10

                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