NodeManager Relay in Homeassistant
-
I'm trying to use NodeManager for a node that switches a realy. The problem is, that the HA MySensor component clashes with the way NodeManager handels actuators.
NodeManager presents the relay to the GW, but never send any message with a value to the GW. However HA needs at least one initial value before the relay is recognized.
Any idea how to deal with this? Either by forcing NodeManager to send an initial value, or by allowing HA to register the Node and its childs upon presentation and not on first value transmission?Here is some code of what I'm trying:
// before void before() { // setup the serial port baud rate Serial.begin(MY_BAUD_RATE); nodeManager.setReportIntervalSeconds(10); /* * Register below your sensors */ id = nodeManager.registerSensor(SENSOR_RELAY, 3); SensorRelay* relay = (SensorRelay*)nodeManager.get(id); // A Method to send an intial value for the relay to the GW // realy->Send(false); /* * Register above your sensors */ nodeManager.before(); }
Or maybe this must be done during the loop with:
void loop() { // call NodeManager loop routine nodeManager.loop(); SensorRelay* relay = (SensorRelay*)nodeManager.get(1); //relay->SendValueOnce(false); }
-
is there a way to add a button that turns relay on or off? Or just create a mock sketch that presents the same child ids and then sends a value for each child, then restore the nodemanager sketch: not the ideal solution but I think it could work
-
@gohan hmmmm. Well problem with this is, that I will need to redo this everytime I purge the config of my MySensor network within homeassistant, and I know that will happen almost each time I add a Node, so on the long run this will be annoying.
I found another suuuper hacky solution.
Within the
NodeManager.cpp
I edited the onLoop function of the underlying SensorDigitalOutput. This is the method the SensorRelay inherits from.void SensorDigitalOutput::onLoop() { // set the value to -1 so to avoid reporting to the gateway during loop //_value_int = -1; //_last_value_int = -1; // if a safeguard is set, check if it is time for it if (_safeguard_timer->isRunning()) { // update the timer _safeguard_timer->update(); // if the time is over, turn the output off if (_safeguard_timer->isOver()) setStatus(OFF); } }
I commented out the
_value_int = -1;
and the_last_value_int = -1;
. Now it reporst the reading once upon a node start. I guesssetTrackLastValue
is set to true somewhere.Maybe it possible to add another method to the SnesorDigitalOutput, that allows to toggle these -1 settings in the loop.
-
Well, I did say it wasn't the best way
-
@Malte-Deiseroth
Hi any progress on this? I am looking into documentation and eventually find this thread
-
@Michał-Szura I had problems with relay and HA too. The best solution was to save the state of the relay in the EEPROM and to recall the value after a defined amount of time and send it to HA in loop(). This way you do not have to restart the relay node everytime you restart HA.
Suggested Topics
-
Forum Theme Problems
Announcements • 8 Apr 2014, 07:05 • hek 8 Apr 2014, 07:05 -
Gateway on my PI when i run HA
Home Assistant • 31 Aug 2024, 21:51 • diltech 5 Oct 2024, 10:31 -
Hi,
Home Assistant • 1 Sept 2024, 20:57 • diltech 1 Sept 2024, 20:57 -
How I delete a node from HA and start over.
Home Assistant • 18 Oct 2024, 02:05 • OldSurferDude 18 Oct 2024, 02:05 -
Home Assistant update changed USB port name
Home Assistant • 14 Jan 2024, 17:25 • therik 15 Jan 2024, 10:26 -
HVAC type sensor in homeassistant
Home Assistant • 17 Aug 2024, 10:50 • tbowmo 17 Aug 2024, 20:51