@electrik Looks like the discovery does work with MQTT gateway. Thanks a bunch, I got it working now
Posts made by Tinimini
-
RE: Can ethernet gateway also publish everything to MQTT?
-
RE: Can ethernet gateway also publish everything to MQTT?
Ah, okay I have to try this out. I just decided to not do a MQTT gateway as the controller page said that no controller supports discovery with MQTT gateways
-
Can ethernet gateway also publish everything to MQTT?
I have a Raspberry Pi Zero W which has an ethernet gateway running on it. I went with the ethernet gateway as it said on the MQTT gateway page that no controller supports auto discovery of nodes when using an MQTT gateway. I'm using Home Assistant as my controller and this setup seems to work just fine. But now I would also like to get all events from my nodes published on my MQTT broker as I would like to gather everything in there also so I can use node red or something like that to further react to those events.
So the question is, is it possible to make the ethernet gateway also kinda double up as an mqtt gateway?I could use MQTT gateway but I would really like to have the automatic discovery of the nodes working.
-
RE: Running MySensors on ATTiny85
@Yveaux size, mostly. And the fact that I have them
-
Running MySensors on ATTiny85
Is anybody working on ATTiny85 support for MySensors? I found some old thread about this, but it seems that it was quite old and somewhat abandoned. Would this even be feasible anymore?
-
RE: Sensor not sleeping properly when Gateway is down?
Oh yeah... Read the docs.. Yes, I probably should do that too Thanks!
-
RE: Sensor not sleeping properly when Gateway is down?
Okay, that seems to explain this. I changed the sleeping time to 20 seconds and sure enough, after about 10 seconds the current draw dropped down to ~7uA. So looks like I'm good now.
So what did I learn from this? Well... I better start reading the source code for MySensors Either that, or write my own lib so I know what is going on
Thanks for the help!
-
Sensor not sleeping properly when Gateway is down?
I'm starting a new thread about this as previously I hijacked someone else's old thread.
I'm currently playing around with MySensors and the first sensor I'm trying to build using it is a door sensor. It's battery powered and it's working just fine (using about 6uA while sleeping, so batteries should last a good while). But when I don't have my Gateway (a Raspberry Pi Zero W with MQTT Gateway) online, the power consumption seems to stay pretty high (3mA or so). So it seems that the sensor is not sleeping properly, but instead tries to reconnect to the Gateway all the time?
This is my sketch:
// Enable debug prints to serial monitor //#define MY_DEBUG // Set how long to wait for transport ready in milliseconds #define MY_TRANSPORT_WAIT_READY_MS 3000 // Enable and select radio type attached #define MY_RADIO_NRF24 // Set this nodes id. Needs to be unique between nodes (value = 1-254) #define MY_NODE_ID 102 #include <SPI.h> #include <MySensors.h> #define CHILD_ID 3 #define DOOR_PIN 3 // Arduino Digital I/O pin for button/reed switch #define SLEEP_TIME 3000 // Sleep time between heartbeats (seconds * 1000 ms) int oldValue = -1; MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { pinMode(DOOR_PIN, INPUT); } void presentation() { present(CHILD_ID, S_DOOR); } void loop() { int value = digitalRead(DOOR_PIN); if (value != oldValue) { send(msg.set(value == HIGH ? 1 : 0)); oldValue = value; } wait(10); Serial.println("Going to sleep now..."); smartSleep(digitalPinToInterrupt(DOOR_PIN), CHANGE, SLEEP_TIME); }
I tried enabling debug and this is what I get in the loop:
30812 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=1,M2=1 30818 !MCO:SLP:TNR Going to sleep now...
And yes, I know it's not very efficient to only sleep for 3 seconds, that's there only for testing this thing out.
-
RE: Booting sensors without Gateway connection?
Yes, you're right. Considering how I kind of hijacked this thread anyway I will run some more tests and start a new thread if I can't find a solution
-
RE: Booting sensors without Gateway connection?
Oh, that's very simple. It's there because I'm testing this and trying to make it work. It will be more like 15 minutes to half an hour in reality.
Unfortunately still haven't been able to get this to work, and as I'm just starting with my home automation stuff, the gateway will probably be offline quite a lot while I'm developing things. And that means that the battery powered sensors are going to suck their batteries dry in no time... I probably have to add an on/off switch to the sensors or something. Just so I can turn them off when I know they can't be used. -
RE: Booting sensors without Gateway connection?
The sketch is very very simple. Just a basic door sensor.
// Enable debug prints to serial monitor //#define MY_DEBUG // Set how long to wait for transport ready in milliseconds #define MY_TRANSPORT_WAIT_READY_MS 3000 // Enable and select radio type attached #define MY_RADIO_NRF24 // Set this nodes id. Needs to be unique between nodes (value = 1-254) #define MY_NODE_ID 102 #include <SPI.h> #include <MySensors.h> #define CHILD_ID 3 #define DOOR_PIN 3 // Arduino Digital I/O pin for button/reed switch #define SLEEP_TIME 3000 // Sleep time between heartbeats (seconds * 1000 ms) int oldValue = -1; MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { pinMode(DOOR_PIN, INPUT); } void presentation() { present(CHILD_ID, S_DOOR); } void loop() { int value = digitalRead(DOOR_PIN); if (value != oldValue) { send(msg.set(value == HIGH ? 1 : 0)); oldValue = value; } wait(10); smartSleep(digitalPinToInterrupt(DOOR_PIN), CHANGE, SLEEP_TIME); }
I tried changing smartSleep to sleep to try if that makes a difference, but it doesn't seem to change anything.
-
RE: Booting sensors without Gateway connection?
Hmm.. Looks like it's still using quite a lot of power. When the gateway is running and the sensor is sleeping I'm seeing about 6uA of current drawn. When gateway is down, it's about 3mA. So that's not very good.. I need to add some debug statements to see if it actually is sleeping or what.
-
RE: Booting sensors without Gateway connection?
Ah, cool. I will try to change the value and see how that affects the power consumption. Thanks!
-
RE: Booting sensors without Gateway connection?
Is the 3 seconds the default? If so, I have waited that long and the power consumption stays high even after that. So it seems that it doesn't go to sleep properly when there's no connection to the gateway. Optimally I'd like to go to sleep and try reconnecting myself every few minutes or so.
-
RE: Booting sensors without Gateway connection?
I'm kind of in the same boat and trying to figure out what to do if the gateway does not respond. What's the impact on power consumption? If it tries to connect in the background, does it still go to sleep when I call sleep in loop? Now when I don't have the gateway running, it seems to use up quite a lot more power when trying to connect.