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
-
Pressure sensor and input trough optocoupler
Domoticz • 27 Apr 2021, 08:55 • Olaf Jacobs 28 Apr 2021, 19:33 -
Arduino (Fibaro Wall plug)
Feature Requests • 22 Nov 2014, 12:49 • MarkV 22 Nov 2014, 15:08 -
Home Assistant v 0.13.1
Home Assistant • 13 Feb 2016, 21:36 • martinhjelmare 19 Apr 2016, 22:51 -
How to great variables
General Discussion • 16 May 2024, 14:43 • wint0178 22 Jul 2024, 06:11 -
💬 24V Relay drive board
OpenHardware.io • 5 Jun 2019, 19:24 • openhardware.io 5 Jun 2019, 19:24 -
Arduino Power Supply
OpenHardware.io • 7 Jan 2016, 15:41 • openhardware.io 3 Feb 2016, 23:20 -
Current Monitoring - How?
Hardware • 14 Jan 2015, 07:32 • Dean 17 Jan 2016, 15:50 -
PN532 NFC RFID module V3 kits : Didn't find PN53x board
Troubleshooting • 20 Dec 2016, 14:31 • SebDominguez 12 Apr 2017, 19:15