@skywatch that helped! resolved, thank you!
Max Kurilov
@Max Kurilov
Best posts made by Max Kurilov
-
RE: Corrupted serial debug output
Latest posts made by Max Kurilov
-
RE: can't remove unused sensors from HA
@electrik yes I have. And yes, "objects" meant to be "entities" in my previous post. My inactive devices still present at the device list and I have no options to delete them via the HA interface whereas they have no related entities and json records.
-
RE: can't remove unused sensors from HA
@electrik how do you delete entities in Home Assistant?
After I disable integration I can navigate to objects and delete the objects corresponding to the sensors but I can't find the way to remove node itself.
I've upgraded to the latest HA build (2021.12.10) but there is still no "remove" button for the MySensors devices.
-
RE: Wake-up by interrupt doesn't work
@electrik said in Wake-up by interrupt doesn't work:
If the delay is not of importance to you, you can also have the sensor request its state from the controller each time it wakes up. No special modifications are needed than.
It's true. But the controller must switch its relay state without having ack received from the node. That's not what MySensors plugin for Vera does. But you gave me an idea to implement an additional relay buildin into the gateway which will work as a proxy for my real actuator. Thank you!
-
RE: Wake-up by interrupt doesn't work
@Yveaux thank you for your replies.
In my particular case, I'd rather be ok with delays for resending commands from my gateway to the node than spend too much battery charge.
I've discovered a couple of threads regarding retransmission and reliable delivery in this forum. Most of them are for sensor data transmission case which can be made by handling send() results and which are useless in case I decide to implement resending in my gateway.
Is there a reason for not including retransmission policy right into MySensors library which implements the gateway part?
-
RE: Wake-up by interrupt doesn't work
More pragmatically: if this limitation has no workaround on hardware or library level, for how long is it safe to send node to a sleep mode while keeping data packets from losing.
-
RE: Wake-up by interrupt doesn't work
@Yveaux said in Wake-up by interrupt doesn't work:
True, in MySensors the radio will be 'off' when a node sleeps, so nothing will be received. Your node will only wake up by an interrupt (eg the interrupt pin in your setup) or after a certain amount of time has elapsed.
What do you mean by saying "off"? It seems that there is a voltage when a node sleeps. So that the radio should be powered in my case.
If the radio can't change its IRQ pin state while powered on what is the purpose of this pin? Maybe this is a rhetorical question.
-
Wake-up by interrupt doesn't work
Hi guys!
I'm trying to develop my first battery-powered device which will be a moisture sensor with binary switch to activate a water pump.
I've inherited a part of sleep/wake code from this example. And my device wakes up if I connect an interrupt pin with the ground. But it doesn't wake up when a gateway transmits data to binary switch.
I've tried to replace my RF module with another one but it doesn't help. I assume it is likely an issue with RF moduels but would like to make sure I'm not missing something.
So the question is when NRF should change it's IRQ pin state and how long does this new state should be? Any ideas on what else should I check are appreciated.
My hw is: Nano powered by 3.7V 18650 battary via 5V pin (step-up converter is planned but not yet installed as it's prototype) + nRF24L01+
My sketch is below (as I mentioned, it works if I ground an IRQ pin, but anyway):
/* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2019 Sensnology AB * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * DESCRIPTION * * Arduino soil moisture based on gypsum sensor/resistive sensor to avoid electric catalyse in soil * Required to interface the sensor: 2 * 4.7kOhm + 2 * 1N4148 * * Gypsum sensor and calibration: * DIY: See http://vanderleevineyard.com/1/category/vinduino/1.html * Built: Davis / Watermark 200SS * http://www.cooking-hacks.com/watermark-soil-moisture-sensor?_bksrc=item2item&_bkloc=product * http://www.irrometer.com/pdf/supportmaterial/sensors/voltage-WM-chart.pdf * cb (centibar) http://www.irrometer.com/basics.html * 0-10 Saturated Soil. Occurs for a day or two after irrigation * 10-20 Soil is adequately wet (except coarse sands which are drying out at this range) * 30-60 Usual range to irrigate or water (except heavy clay soils). * 60-100 Usual range to irrigate heavy clay soils * 100-200 Soil is becoming dangerously dry for maximum production. Proceed with caution. * * Connection: * D6, D7: alternative powering to avoid sensor degradation * A0, A1: alternative resistance measuring * * Based on: * "Vinduino" portable soil moisture sensor code V3.00 * Date December 31, 2012 * Reinier van der Lee and Theodore Kaskalis * www.vanderleevineyard.com * Contributor: epierre */ // Copyright (C) 2015, Reinier van der Lee // www.vanderleevineyard.com // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RF24 // Define channel (2440 MHz - somewhere in between 6th and 7th wi-fi channels) #define MY_RF24_CHANNEL 40 //#define MY_RADIO_NRF5_ESB //#define MY_RADIO_RFM69 //#define MY_RADIO_RFM95 #define MY_BAUD_RATE 38400 #define MY_IRQ_PIN 2 //MY_RF24_IRQ_PIN #include <MySensors.h> //#define CHILD_ID 0 // Pump control pin #define PUMP_PIN 4 // Pump max operation time in ms #define PUMP_OP_TIME 6000 MyMessage msg_moisture(0, V_LEVEL); MyMessage msg_binary(1, V_STATUS); #define SLEEP_TIME 30 * 60 // Sleep time (in seconds) unsigned long sleepTime = SLEEP_TIME; int8_t wakeupReason = MY_WAKE_UP_BY_TIMER; // Initial value, will be set by sleep after the first run // Define pins. They will switch over every time we read the values. byte SENSOR_PIN1 = 19; byte SENSOR_PIN2 = 18; void setup() { // Settings // #define SENSOR_PIN1 19 // #define SENSOR_PIN2 18 pinMode(SENSOR_PIN1, OUTPUT); pinMode(SENSOR_PIN2, INPUT); pinMode(PUMP_PIN, OUTPUT); } void presentation() { sendSketchInfo("Soil Moisture Sensor", "1.0"); present(0, S_MOISTURE); present(1, S_BINARY); } void loop() { if (wakeupReason == digitalPinToInterrupt(MY_IRQ_PIN)) { sleepTime = getSleepRemaining() / 1000; if (sleepTime < 1) { sleepTime = 1; } Serial.println("!!!! Wake up by interrupt"); } else if (wakeupReason == MY_WAKE_UP_BY_TIMER) { // Power on sensor Serial.println("Power on"); digitalWrite(SENSOR_PIN1, 1); delayMicroseconds(25); // Read sensor pins int moistureAn = analogRead(SENSOR_PIN2); float moisturePercent = moistureAn / 1023.0 * 100.0; Serial.print("Moisture analog: "); Serial.println(moistureAn); Serial.print("Moisture percent: "); Serial.println(moisturePercent); Serial.println("Power off"); digitalWrite(SENSOR_PIN1, 0); // Switch pins Serial.println("Switching pins"); byte tmpPin = SENSOR_PIN2; SENSOR_PIN2 = SENSOR_PIN1; SENSOR_PIN1 = tmpPin; pinMode(SENSOR_PIN1, OUTPUT); pinMode(SENSOR_PIN2, INPUT); //send back the values send(msg_moisture.set((int32_t)round(moisturePercent))); sleepTime = SLEEP_TIME; } Serial.print("Going to sleep for "); Serial.println(sleepTime); //wait(SLEEP_TIME * 1000); wakeupReason = smartSleep(digitalPinToInterrupt(MY_IRQ_PIN), CHANGE, sleepTime * 1000); } void receive(const MyMessage &message) { byte sensor = message.getSensor(); if (message.getType()==V_STATUS) { bool newState = message.getBool(); Serial.print("Incoming change for sensor: "); Serial.print(sensor); Serial.print(". Switching to: "); Serial.println(newState); if (newState == true) { digitalWrite(PUMP_PIN, HIGH); delay(PUMP_OP_TIME); Serial.println("Turning pump off after time out"); digitalWrite(PUMP_PIN, LOW); msg_binary.set(false); send(msg_binary, false); } else { digitalWrite(PUMP_PIN, LOW); } } }
-
RE: Vera Plus plugin issues (and choosing the right controller in general)
@nagelc thank you for directing me to the log parser. It helped me to understand that my issue caused by lack of INCLUSION_MODE messages that is easily solved by uncommenting MY_INCLUSION_MODE_FEATURE in my gateway sketch.
The second part of the question stays valid. I realize that choosing the "right" controller is much more than choosing the controller that works good with MySensors. Anyway, I appreciate any personal experience on that.
-
Vera Plus plugin issues (and choosing the right controller in general)
I'm trying to make Vera plug-in work with my serail gateway. I've discovered that the github version of the plug-in doesn't work with my Vera Plus (UI7) because of at least one reason.
It turns out that the "InclusionMode" luup variable is not populated, so that "presentation" function wasn't able to see if the plug-in in inclusion mode. I've added luup.variable_set clauses to "startInclusion" / "stopInclusion" functions.
Now the Vera log displays the following:
50 06/06/21 12:43:40.607 luup_log:261: Arduino plugin: loading library L_Arduino ... <0x76d44520> 50 06/06/21 12:43:40.624 luup_log:261: Arduino plugin: library L_Arduino loaded <0x76d44520> 50 06/06/21 12:43:40.626 luup_log:261: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,PluginVersion, 1.5, 261 <0x76d44520> 50 06/06/21 12:43:40.626 luup_log:261: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,GWAddress, -, 261 <0x76d44520> 50 06/06/21 12:43:40.626 luup_log:261: Arduino: Trying for a serial connection <0x76d44520> 50 06/06/21 12:43:40.627 luup_log:261: Arduino: Serial port is connected <0x76d44520> 50 06/06/21 12:43:40.627 luup_log:261: Arduino: Baud is 115200 <0x76d44520> 50 06/06/21 12:43:40.627 luup_log:261: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,GWAddress, 260(115200), 261 <0x76d44520> 50 06/06/21 12:43:40.629 luup_log:261: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,Unit, M, 261 <0x76d44520> 50 06/06/21 12:43:40.629 luup_log:261: Arduino: Sending: 0;0;3;0;2;Get Version <0x76d44520> 50 06/06/21 12:43:40.638 luup_log:261: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,ArduinoLibVersion, 2.3.2, 261 <0x73428520> 50 06/06/21 12:44:24.016 luup_log:261: Arduino: Staring inclusion ... <0x777f7320> 50 06/06/21 12:44:24.018 luup_log:261: Arduino: Sending: 0;0;3;0;5;1 <0x777f7320> 50 06/06/21 12:44:35.433 luup_log:261: Arduino: Presentation: 2;255;0;0;17;2.3.2 <0x73428520> 50 06/06/21 12:44:35.434 luup_log:261: Arduino: Processing presentation. Mode is 1 <0x73428520> 50 06/06/21 12:44:35.434 luup_log:261: Arduino: Entering into adding a new device branch... <0x73428520> 50 06/06/21 12:44:35.434 luup_log:261: Arduino: Found new device 2;255 <0x73428520> 50 06/06/21 12:44:35.434 luup_log:261: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,InclusionFoundCountHR, 1 devices found, 261 <0x73428520> 02 06/06/21 12:44:35.445 luup_log:261: Arduino: Incoming internal command '2;255;3;0;6;0' discarded for child: nil <0x73428520> 02 06/06/21 12:44:37.464 luup_log:261: Arduino: Incoming internal command '2;255;3;0;11;Neptune Relay' discarded for child: nil <0x73428520> 02 06/06/21 12:44:37.474 luup_log:261: Arduino: Incoming internal command '2;255;3;0;12;1.0.1' discarded for child: nil <0x73428520> 50 06/06/21 12:44:37.483 luup_log:261: Arduino: Presentation: 2;1;0;0;3; <0x73428520> 50 06/06/21 12:44:37.483 luup_log:261: Arduino: Processing presentation. Mode is 1 <0x73428520> 50 06/06/21 12:44:37.484 luup_log:261: Arduino: Entering into adding a new device branch... <0x73428520> 50 06/06/21 12:44:37.484 luup_log:261: Arduino: Found new device 2;1 <0x73428520> 50 06/06/21 12:44:37.484 luup_log:261: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,InclusionFoundCountHR, 2 devices found, 261 <0x73428520> 50 06/06/21 12:44:37.492 luup_log:261: Arduino: Presentation: 2;2;0;0;3; <0x73428520> 50 06/06/21 12:44:37.492 luup_log:261: Arduino: Processing presentation. Mode is 1 <0x73428520> 50 06/06/21 12:44:37.492 luup_log:261: Arduino: Entering into adding a new device branch... <0x73428520> 50 06/06/21 12:44:37.493 luup_log:261: Arduino: Found new device 2;2 <0x73428520> 50 06/06/21 12:44:37.493 luup_log:261: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,InclusionFoundCountHR, 3 devices found, 261 <0x73428520>
So that the plug-in now started to process new devices but there are more issues to resolve because it doesn't finish the inclusion process yet.
Considering the fact that github for the plugin is not updated for 5 years I wonder is there a chance someone already did the fixes I do. Or, if not, what controllers you guys are using with MySensor gateways? I'd rather switch to another controller instead of trying to fix issues for the controller that nobody uses.
-
RE: Corrupted serial debug output
@skywatch that helped! resolved, thank you!