Send configuration (numbers) from HA to Arduino
-
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
-
@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.
-
@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.
-
@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
-
@OldSurferDude great questions. I'm afraid I have no idea. I have never used MySensors with HA.
-
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.
-
@electrik Thanks, I think I can do the same with the MQTT integration (not MySensors MQTT)
OSD
Suggested Topics
-
Incorrect lighting of ws2811b led strips. Wemos D1 Arduino controlled
Hardware • 11 Jan 2020, 18:34 • Beeblebrox666 12 Jan 2020, 16:18 -
Help Getting Started
General Discussion • 1 Mar 2017, 20:29 • strex 1 Mar 2017, 21:47 -
💬 NRF24L01 shield for Arduino Uno (for MySensors gateway)
OpenHardware.io • 13 Feb 2019, 21:39 • openhardware.io 13 Feb 2019, 21:39 -
💬 Easy Switch Box
OpenHardware.io • 14 Dec 2022, 20:57 • openhardware.io 14 Dec 2022, 20:57 -
testing with different controllers (mqtt brokers)
Controllers • 4 Jan 2023, 16:48 • OldSurferDude 5 Jan 2023, 07:26 -
Problem with light control between mysensors and HA
Troubleshooting • 7 Jan 2019, 08:55 • Misna 9 Jan 2019, 07:17 -
Assistance on sensor project
My Project • 29 Oct 2017, 15:31 • Sally Hayford 29 Oct 2017, 22:36 -
Total noob's question about building a PWM light controller
General Discussion • 3 Jul 2015, 05:03 • JoeStrout 3 Jul 2015, 17:45