@skywatch That's pretty sad to hear.... it's what got me into electronics/soldering. Are there any comparable projects that are seeing development?
Posts made by kiesel
-
RE: No merge into master in the last 5 years, should we use development?
-
No merge into master in the last 5 years, should we use development?
Basically the title. According to github nothing has been merged to master in the last 5 years. Can anybody speak to the stability of development?
I have three nodes running 2.4 alpha (created those in 2019, needed to use dev because of some rfm69 issues irrc), and my gateway recently died. I am creating a new gateway and I am wondering what the best course of action would be.
Thanks!
-
Anybody got one / a few spare minimalist rfm69hw shields for wemos d1 mini?
Hi,
I am looking into buying a minimalist rfm69hw shields for wemos d1 mini.
I found this fantastic project, but it costs 25 usd and its 10 pcbs.
https://www.openhardware.io/view/392/Minimalist-RFM69HW-Shield-for-Wemos-D1-Mini#tabs-comments
Assuming that not everybody here used their 10 pcbs: Is anyone willing to send one or two to Germany? Not for free, of course!
Thanks!
-
RE: [mysensors] Not a valid message: invalid literal for int() with base 10: '\x00\x000'
Thanks, I'll keep this in mind if I decide to debug it. I realized that I am also tired of patching the gateway through to the doctor container inside an LXC so now I am looking at creating an esp gateway.
Just need to check if I can find a pcb on here.
Thanks again!
-
[mysensors] Not a valid message: invalid literal for int() with base 10: '\x00\x000'
Hi,
I have been using my gateway (arduino pro mini/rfm69) for a few years now, but it suddenly stopped working, or at the very least home assistant can't read the output anymore. I am getting this:
2024-09-18 22:28:07.973 WARNING (MainThread) [mysensors.message] Error decoding message from gateway, bad data received: 0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RPNGA---,FQ=8,REL=0,VER=2.4.0-alpha 2024-09-18 22:28:07.973 WARNING (MainThread) [mysensors] Not a valid message: invalid literal for int() with base 10: '\x00\x000'
I am not sure why this is. A recent home assistant update? I touched the gateway and some of the connections came lose? Did the gateway just partially die?
If anybody has troubleshooting tips for me I'd be very happy!
Thanks!!
-
RE: WIP: My first PCB: Arduino Pro Mini + RFM69 small node (feedback wanted)
hmmm, that's really not the case atm. I just ordered the first batch and will report back once I assembled the first sensor. If it's an issue I'll rearrange the footprints. Thanks for the info!
-
RE: WIP: My first PCB: Arduino Pro Mini + RFM69 small node (feedback wanted)
Thank you for your feedback!
I have (or at least I think) a decoupling cap on the pcb (C2). And you are right, I should have added the schematics from the start.
I tried doing it on openhardware.io but now the pics of the pcb itself show an older version (the schematics are fine though, I'll add them here too).
I added pins for a HDC1080 temperature/humidity sensor, because that's what I'll probably end up adding anway.
1 interrupt should be all that I need, but if I need more I'll probably use this workaround. But thank you for letting me know about the micro, didn't even know that existed
-
Tips/Tricks for placing sensors above doors?
Hi,
How do you attach/place your sensor boxes close to the door in a way that is visually appealing but also doesn't make it too hard to get to the sensor for code and battery changes?
I thought about Tesa Power Strips but maybe there are better solutions out there?
-
WIP: My first PCB: Arduino Pro Mini + RFM69 small node (feedback wanted)
Hi,
To increase the WAF of my door/window sensors I created this small PCB. It connects a RFM69 to an Arduino Pro Mini with the lowest footprint I could come up with. There is additional space for a booster and a voltage divider though the voltage divider is optional (Just cut it if you don't need it).
Criticism/Feedback and everything in between is very much welcome since I literally have no idea what I am doing and I hope somebody can point out issues before I order my first batch. So: so far this is untested, please don't order it until I got my hands on the first batch.
I was also hoping that somebody could tell me how to set up the project so that mysensors gets a few dollars for every ordered batch, I've seen other projects do that and I want to give back to the community too.
If, unexpectedly, there are no issues with the PCB the next step in the project will be to create a 3D-printable enclosure (I am leaning towards tinkercad, but again, I have no idea what I am doing and I am open to suggestions).
-
RE: 💬 RFM69(H)W Arduino Mini Pro Shield v2
Does anybody have a link to a fixed version of this board? It's exactly what I am looking for form-wise, but I'd be nice if VCC was wired to 3.3v out of the box. Thanks!!
-
RE: Starting my PC with a 3.3v arduino pro mini?
So, I finally got this done and it works just like I want it to. I used my initial schematics (plus radio, of course) and this code:
/** * 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-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/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. * ******************************* * * REVISION HISTORY * Version 1.0: Yveaux * * DESCRIPTION * This sketch provides an example of how to implement a humidity/temperature * sensor using a Si7021 sensor. * * For more information, please visit: * http://www.mysensors.org/build/humiditySi7021 * */ // Enable debug prints #define MY_DEBUG #define MY_OWN_DEBUG #ifndef MY_OWN_DEBUG //disable serial in production compile, potentially saves few uA in sleep mode #define MY_DISABLED_SERIAL #endif // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER #define MY_NODE_ID 5 #define CHILD_ID_TXT 0 #define OUTPIN 8 #include <MySensors.h> #define SKETCH_NAME "media_pc_switch" #define SKETCH_MAJOR_VER "1" #define SKETCH_MINOR_VER "0" static bool metric = true; MyMessage msgTxt(CHILD_ID_TXT, V_TEXT); void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER); present(CHILD_ID_TXT, S_INFO); } void setup() { pinMode(OUTPIN, OUTPUT); // digitalWrite(OUTPIN, LOW); #ifdef MY_OWN_DEBUG Serial.print("Starting: "); #endif send(msgTxt.set("Ready")); } void receive(const MyMessage &msg) { uint16_t ms; Serial.print("Received a message: "); Serial.println(msg.getString()); send(msgTxt.set(msg.getString())); ms = msg.getUInt(); if (ms > 10000 || ms < 1){return;} send(msgTxt.set("Received")); Serial.println("Pulling pin high"); digitalWrite(OUTPIN, HIGH); Serial.print("Waiting for "); Serial.println(ms); delay(ms); Serial.println("Switching off"); digitalWrite(OUTPIN, LOW); Serial.println("Delaying a few seconds to ignore message resends."); send(msgTxt.set("Sleeping")); delay(10000); send(msgTxt.set("Ready")); }
Now I can use this sequence in HA to start my PC even when the power was cut:
wzimmer_ms_start_htpc: alias: Use mysensors node 5 to start the mediapc in the living room sequence: repeat: sequence: #don't run if htpc already running - condition: not conditions: - condition: state entity_id: binary_sensor.htpc state: 'on' #send start signal to mysensors - service: notify.mysensors data: target: "media_pc_switch 5 0" message: 1000 #wait for timeout seconds whether a message has been received - wait_for_trigger: - platform: state entity_id: sensor.media_pc_switch_5_0 to: "Received" timeout: '00:00:04' until: # Did it work? - condition: state entity_id: sensor.media_pc_switch_5_0 state: Received
Thank you, @cabat for your help and your patience!!!
-
RE: Starting my PC with a 3.3v arduino pro mini?
If I wanted this protection where would I put it in my schematic?
Between ground an 3.3v?
/edit: no between the arduino and 3.3v from the Mainboard, right?
-
RE: Starting my PC with a 3.3v arduino pro mini?
Ah, ok, I get it now. The diode protects me from wiring this up with POWER and GND switched. So I would use it like this
But I guess I can't because of the voltage drop. I think that's out of specs for the PC817. And anyway there is a very low chance that I will wiring this side of the schematic up wrong.
I guess I was just confused by the lower part of your drawing.
Thank you VERY much for your patience! I'll supply pictures when I have this hooked up in the hopes they will help others.
Have a nice weekend!
-
RE: Starting my PC with a 3.3v arduino pro mini?
To protect from polarity reversing, like you did in your sketch. Sorry if that's a stupid question!
-
RE: Starting my PC with a 3.3v arduino pro mini?
Cool, thank you for your help!
Should I use a diode between 3.3v and GND too? And do I need a resistor in the mainboard-side of the schematic? Some people used them to protect the optocoupler from high current but I guess there isn't a high current when the power button is pressed?
-
RE: Starting my PC with a 3.3v arduino pro mini?
So I think I understand the main part of your drawing: The optocoupler keeps the Arduino circuit separate from the mainboard circuit to prevent a short. The resistor is for the diode inside the optocoupler.
There are a few things about your drawing that I don't understand:
- Why is there a 5V powerline with a diode?
- What does the MB stand for? Mainboard
- Why are there two connection points from the Mainboard? Is one reset?
I tried my first Fritzing to make sense of this and to show how I would design the connections (doesn't mean it's right).
PW+ and PW- are the pins from the schematic in the first post. , 3,3V and GND are available on another set of pins on the mainboard. Would this work?
-
RE: Starting my PC with a 3.3v arduino pro mini?
Thank you. It seems I have some groundwork to do and learn how to read the schematics That hasn't been necessary until now. I'll do that and come back here when I understand enough
-
Starting my PC with a 3.3v arduino pro mini?
Hi,
I'd like to start my PC using an Arduino Pro Mini (3.3v) but I am not sure how to hook it up.
There are a lot of tutorials (if you include esp8266 devices) but I am not sure which parts I exactly need. In essence I need to pull the power pin high that is connected to the power button (if I understood correctly).
So on my mainboard (Gigabyte Aorus B450M) that means I connect RES+ to a pin on my arduino and RES- to GND, right?
There is a 3.3v pin on the mainboard (schematic), can I connect the arduino to that pin to power it?
And the most important question: Do I need any other parts? Is the voltage higher on RES+? Does that mean it can fry my arduino?
And in case the question comes up: I can't use wol because I disconnect the PC from power when off. That is apparently against the wol specs and only works in a few cases (of which my mainboard apparently isn't one).
Thanks for any help!
-
RE: [SOLVED] Dropped node: arduino blinks only once
Seems you where both right. A short drained the battery (which I didn't notice) and getting rid of the short and using a new set of rechargeables solved the problem.
Thank you very much!
-
[SOLVED] Dropped node: arduino blinks only once
Hi,
sorry for the cryptic topic-name, I'll try to elaborate.
I have build a node with an arduino pro mini 3.3, an rfm69, a temp sensor, a lux sensor and a door sensor using the easypcb. The node worked flawlessly and I mounted it above the door I wanted to monitor. Unfortunately I mounted it rather badly and it came down after two weeks.
It didn't turn on again and I saw that a part of the step up booster came loose, so I replaced the step up booster.
When I now attach my batteries to it (2 AA rechargables, 1.6V in total, measured with my multimeter) the status-led (not the power led, I desoldered that one) blinks shortly once but then stays silent and I am not receiving any messages on the gateway.
It all works as expected if I power the arduino with the FTDI-serial-adapter so I think the arduino is ok?
Two things I noticed: When I switch battery power on the status led blinks once, as I said. When I then turn the power off and immediately back on again it doesn't blink. I have to wait some time before it blinks again.
I measured the voltage at the screw terminal and there it is only 0.4V instead of the 1.6V I see when I measure it at the cables of the battery holder directly. I don't know whether that's expected or not, but I wanted to mention it.
Here are pictures of the node:
Thanks for any help!
-
RE: Started with MySensors and about to give up (some feedback)
I hope it is OK to post this here, I am not sure how to add this to the documentation, but my biggest pain point when starting out was that you have to use mysensors >2.2 when running on a raspberry pi 4, but the rfm gateway code has a bug in versions bigger than 2.2. I spent more than a week debugging that until I found the github issue and settled for a serial gateway, which I am very happy with, thank you mysensors!
If a warning could be put on the gateway page that would be great!
-
RE: My Slim 2AA Battery Node
Hi,
Has anybody succeeded Inn creating an rfm69 version of this?
-
RE: rfm69hw restarting when using plug on same multi-socket
I plugged my soldering iron in and you were right, the problem reappears. I only have that one wall socket in thqt corner of the apartment so I can't plug the switch into another wall socket, unfortunately.
Would one of those multi plugs work that come with an extra fuse to guard against lightning strike induced fluctuations?
/edit: forgot to mention I am using the official charger for the pi 4. I'll try to find a different one.
-
RE: rfm69hw restarting when using plug on same multi-socket
That was a good catch! It's indeed the lamp. I removed the lamp from the switch and everything else being equal I I can now toggle the switch as much as I want without the gateway going bye bye.
The bulb is a "Osram dulux Superstar micro twist", 7w, 825 lumen, 220-240v, 7mA, 50/60Hz.
It works as expected when I take the bulb out of the socket. Can I somehow shield this or should I buy a new bulb?
-
rfm69hw restarting when using plug on same multi-socket
Hi,
I have an unusual power issue and I hope somebody can tell me how to solve it:
I have a rfm69hw attached to an arduino pro mini 3v (as a serial gateway) attached to a raspberry pi 4 via USB. The setup works fine for the most part, but there is a plug attached to the same multi-socket the raspberry pi draws its power from.
Schema:
rpi4-> arduino pro mini3v -> rfm69hw
↑
multi-socket
↓
plugThe plug is a tasmota-flashed Gosund SP1 that turns a lamp on and off. When the lamp is turned off/on it sometimes kills the gateway. No messages are received until the gateway "decides" to come online again (after max 15 minutes):
2020-04-19 22:05:20 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:900026 !TSF:SAN:FAIL 2020-04-19 22:05:20 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:900034 TSM:FAIL:CNT=1 2020-04-19 22:05:20 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:900044 TSM:FAIL:DIS 2020-04-19 22:05:20 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:900052 TSF:TDI:TSL 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910063 TSM:FAIL:RE-INIT 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910071 TSM:INIT 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910082 TSM:INIT:TSP OK 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910090 TSM:INIT:GW MODE 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910100 TSM:READY:ID=0,PAR=0,DIS=0 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910112 TSM:READY:NWD REQ 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910127 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962252 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962269 TSF:MSG:BC 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962277 TSF:MSG:FPAR REQ,ID=2 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962289 TSF:PNG:SEND,TO=0 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962299 TSF:CKU:OK 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962308 TSF:MSG:GWL OK 2020-04-19 22:06:23 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:963104 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 2020-04-19 22:06:24 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:964259 TSF:MSG:READ,2-2-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 2020-04-19 22:06:24 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:964278 TSF:MSG:PINGED,ID=2,HP=1
Output from home assistant.
When I put the plug/lamp-combo into another outlet I can toggle it as many times as I like without the gateway going down.
Does somebody know how I can stabilize the power so that the plug doesn't kill the gateway? I have a 470uF capacitor between GND and 3.3v on the rfm69hw already.
-
RE: mysensors integration freezes when it triggers switch.toggle
I found the issue. Everything works as expected when I use put the plug into another outlet. So this must be a power issue. I will create another thread for how to fix this.
-
RE: mysensors integration freezes when it triggers switch.toggle
Ok, so I think I have been getting at this the wrong way around...
Switching the switch on and off kills the integration/the gateway, it doesn't matter whether the node sent an ir-code to the gateway first. I verified this by opening lovelace and turning the switch on and off from there a few times. The result is that no new messages can be received from any nodes.
The switch in question is a tasmota flashed Gosund SP1 switch that has auto-discovery for Home Assistant activated (SetOption19). It connects to Home Assistant via mqtt. Since the gateway is a serial gateway I can't see how mqtt messages could kill the gateway.
-
RE: mysensors integration freezes when it triggers switch.toggle
If I get that correctly then that manual is about sending an IR-code to a node, but I am receiving an IR-code from a node. Based on that code I then want to do certain things, like turning a lamp on.
I am using a serial gateway, here is the corresponding config:
mysensors: gateways: - device: '/dev/ttyUSB0' baud_rate: 38400 version: '2.3'
And here is the sketch of the node with the IR-receiver:
// Enable debug prints //#define MY_DEBUG #define MY_OWN_DEBUG #ifndef MY_OWN_DEBUG //disable serial in production compile, potentially saves few uA in sleep mode #define MY_DISABLED_SERIAL #endif // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER #define MY_NODE_ID 3 #include <MySensors.h> // IR specific setup #include <IRremote.h> int RECV_PIN = 3; IRrecv irrecv(RECV_PIN); decode_results ircode; unsigned long last_value; // IR specific setup end #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_LUX 2 #define CHILD_ID_IR 3 #define SKETCH_NAME "mysensors_wohnzimmer_main" #define SKETCH_MAJOR_VER "1" #define SKETCH_MINOR_VER "0" static bool metric = true; int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point int oldBatteryPcnt = 0; float lastHum = 0; float lastTemp = 0; int lastLux = 0; // Sleep time between sensor updates (in milliseconds) static const unsigned long UPDATE_INTERVAL = 90000; #include <SI7021.h> #include <BH1750.h> static SI7021 tempsensor; BH1750 lightmeter; // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgLux(CHILD_ID_LUX, V_LEVEL); MyMessage msgIrRecord(CHILD_ID_IR, V_IR_RECEIVE); void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER); present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); present(CHILD_ID_LUX, S_LIGHT_LEVEL); present(CHILD_ID_IR, S_IR); } void setup() { //Serial.begin(9600); //Serial.print("Starting: "); while (not tempsensor.begin()) { Serial.println(F("Temperaturesensor not detected!")); delay(5000); } #ifdef MY_OWN_DEBUG Serial.println("Tempsensor started"); #endif lightmeter.begin(); #ifdef MY_OWN_DEBUG Serial.print("UPDATE_INTERVAL:");Serial.println(UPDATE_INTERVAL); #endif irrecv.enableIRIn(); } void loop(){ int8_t wake_reason; //send(msgIrRecord.set(0)); sleep_bod_disable();//disable BOD - saves~ 15uA wake_reason = sleep(RECV_PIN-2, FALLING, UPDATE_INTERVAL); #ifdef MY_OWN_DEBUG Serial.print("wake_reason=");Serial.println(wake_reason); #endif if (wake_reason == 1){ //woken up by interrupt on d3 ir_received(); } else{ //woken by update_interval update_interval(); } //send battery value //battery(); //TODO } void ir_received(){ delay(100); detachInterrupt(RECV_PIN-2); if (irrecv.decode(&ircode)) { //#ifdef MY_OWN_DEBUG //dump(&ircode); //#endif unsigned long ir_value = ircode.value; if (ir_value == REPEAT) //if repeat-code: send last code { ir_value = last_value; } else{ //if not: save new value as last value last_value = ir_value; } #ifdef MY_OWN_DEBUG Serial.println(ir_value,HEX); Serial.println(ir_value); #endif send(msgIrRecord.set(ir_value)); delay(150); //without this appdaemon doesn't have enough time to react. send(msgIrRecord.set(0)); irrecv.resume(); // Receive the next value } //delay(100); Serial.println("IR Processing done--------------------"); } void update_interval() { #ifdef MY_OWN_DEBUG Serial.println("In loop"); #endif // Read temperature & humidity from sensor. const float temperature = float( metric ? tempsensor.getCelsiusHundredths() : tempsensor.getFahrenheitHundredths() ) / 100.0; float roundedTemp = floorf(temperature * 10) / 10; //round temp down to 1 decimal const float humidity = float( tempsensor.getHumidityBasisPoints() ) / 100.0; float roundedHum = floorf(humidity * 10) / 10; //round humidty down to 1 decimal lightmeter.configure(BH1750_ONE_TIME_HIGH_RES_MODE); //delay(500); // Allow some time const uint16_t lux = lightmeter.readLightLevel(); #ifdef MY_OWN_DEBUG Serial.print(F("Temp ")); Serial.print(temperature); Serial.print(metric ? 'C' : 'F'); Serial.print(F("\tHum ")); Serial.println(humidity); Serial.print("Light: "); Serial.print(lux); Serial.println(" lx"); Serial.println("-------"); #endif if (lastHum != roundedHum){ #ifdef MY_OWN_DEBUG Serial.print("roundedHum: ");Serial.println(roundedHum); #endif send(msgHum.set(roundedHum, 1)); lastHum = roundedHum; } if (lastTemp != roundedTemp){ send(msgTemp.set(temperature, 1)); lastTemp = roundedTemp; } if (lastLux != lux){ send(msgLux.set(lux, 1)); lastLux = lux; } //send battery value battery(); // Sleep until next update to save energy //sleep_bod_disable();//disable BOD - saves~ 15uA //smartSleep(UPDATE_INTERVAL); } void battery(){ // get the battery Voltage int sensorValue = analogRead(BATTERY_SENSE_PIN); #ifdef MY_OWN_DEBUG Serial.println(sensorValue); #endif // 1M, 470K divider across battery and using internal ADC ref of 1.1V // Sense point is bypassed with 0.1 uF cap to reduce noise at that point // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts // 3.44/1023 = Volts per bit = 0.003363075 int batteryPcnt = sensorValue / 10; #ifdef MY_OWN_DEBUG float batteryV = sensorValue * 0.003363075;//3.44v //float batteryV = sensorValue * 0.002541544; //2.6v Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); #endif if (oldBatteryPcnt != batteryPcnt) { // Power up radio after sleep sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; } }
The node is waken up by an interrupt when the ir-sensor reads a code. It also polls the other two sensors (temp/humid, lux) once every 90 seconds.
-
RE: mysensors integration freezes when it triggers switch.toggle
Even more weirdness: I tried to workaround this by creating an input_boolean, to decouple the switch.toggle from the mysensors integration.
I am using this automation to toggle the input_boolean:
alias: 'Infrared Debug' trigger: platform: state entity_id: sensor.mysensors_wohnzimmer_main_3_3 condition: condition: or conditions: - condition: template value_template: "{{ trigger.to_state.state == '551505585' }}" - condition: template value_template: "{{ trigger.to_state.state == '34469099' }}" action: - service: system_log.write data_template: message: > "Automation IR Debug: {{trigger.to_state.state}}" level: warning - service: input_boolean.toggle entity_id: input_boolean.wa_kleine_lampe_infrared_switch
And this automation to toggle the switch when a change of the input_boolean is detected:
alias: 'Infrared Debug' trigger: platform: state entity_id: input_boolean.wa_kleine_lampe_infrared_switch action: - service: switch.toggle entity_id: switch.kleine_lampe
Still, the integration freezes for some time. If I omit the second automation (don't toggle the switch) then I can press the remote button for all eternity (untested) and the integration doesn't crash/freeze.
There must be some sort of feedback that's too much for the mysensors integration. I noticed the switch is somewhat slow, could the slowness of the switch be the issue here? It's a plug running the newest tasmota firmware (updated it because of this issue).
-
RE: mysensors integration freezes when it triggers switch.toggle
I decided to wait for some time after a freeze and I noticed that the gateway comes back after max 15 minutes:
2020-04-19 21:51:06 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:48615 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=5,l=4,sg=0:34469099 2020-04-19 21:51:06 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-19 21:51:07 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 34469099 2020-04-19 21:51:07 WARNING (MainThread) [homeassistant.components.system_log.external] "Automation IR Debug: 34469099" 2020-04-19 21:51:07 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:48775 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=2,l=2,sg=0:0 2020-04-19 21:51:07 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-19 21:51:07 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 0 2020-04-19 21:51:14 WARNING (MainThread) [homeassistant.components.light.reproduce_state] Unable to find entity light.grosse_lampe 2020-04-19 21:51:16 DEBUG (SyncWorker_5) [mysensors.persistence] Saving sensors to persistence file /config/mysensors1.pickle 2020-04-19 22:00:47 WARNING (MainThread) [homeassistant.components.light.reproduce_state] Unable to find entity light.grosse_lampe 2020-04-19 22:05:20 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:900026 !TSF:SAN:FAIL 2020-04-19 22:05:20 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:900034 TSM:FAIL:CNT=1 2020-04-19 22:05:20 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:900044 TSM:FAIL:DIS 2020-04-19 22:05:20 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:900052 TSF:TDI:TSL 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910063 TSM:FAIL:RE-INIT 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910071 TSM:INIT 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910082 TSM:INIT:TSP OK 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910090 TSM:INIT:GW MODE 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910100 TSM:READY:ID=0,PAR=0,DIS=0 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910112 TSM:READY:NWD REQ 2020-04-19 22:05:30 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:910127 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962252 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962269 TSF:MSG:BC 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962277 TSF:MSG:FPAR REQ,ID=2 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962289 TSF:PNG:SEND,TO=0 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962299 TSF:CKU:OK 2020-04-19 22:06:22 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:962308 TSF:MSG:GWL OK 2020-04-19 22:06:23 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:963104 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 2020-04-19 22:06:24 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:964259 TSF:MSG:READ,2-2-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 2020-04-19 22:06:24 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:964278 TSF:MSG:PINGED,ID=2,HP=1 2020-04-19 22:06:24 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:964501 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 2020-04-19 22:06:24 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:964528 TSF:MSG:READ,2-2-0,s=255,c=3,t=32,pt=5,l=4,sg=0:500
Am I reading this right that the connection to the chip failed? Any ideas how this could happens and what triggers a restart?
-
RE: IR Node resending last signal ca every 15 minutes
Thanks, I'll have a look at those updates.
Do you mean the code I am using for my appdaemon app? I got everything I use from here: https://github.com/eifinger/appdaemon-scripts
This is much cleaner and easier to understand than my code, but let me know if you want it anyway
-
mysensors integration freezes when it triggers switch.toggle
Hi,
I have an IR-sensor attached to one of my nodes. The goal is to be able to trigger various automations with my TV remote. So far most seem to be working fine, except for switches.
I am using this automation:
alias: 'Infrared Debug' trigger: platform: state entity_id: sensor.mysensors_wohnzimmer_main_3_3 condition: condition: template value_template: "{{ trigger.to_state.state != '0' }}" action: - service: system_log.write data_template: message: > "Automation IR Debug: {{trigger.to_state.state}}" level: warning - service: switch.toggle entity_id: switch.kleine_lampe
When I press the same button a view times the switch gets toggled but at some point the whole integration stops working. Here is an annotated logfile. My comments are {written like this}:
2020-04-18 22:52:02 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:334151 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=5,l=4,sg=0:551505585 {Button pressed} 2020-04-18 22:52:02 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-18 22:52:02 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 551505585 2020-04-18 22:52:02 WARNING (MainThread) [homeassistant.components.system_log.external] "Automation IR Debug: 551505585" 2020-04-18 22:52:03 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:334311 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=2,l=2,sg=0:0 {second message to workaround another issue, ignored by the automation} 2020-04-18 22:52:03 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-18 22:52:03 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 0 2020-04-18 22:52:04 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:336228 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=5,l=4,sg=0:551505585 {Button pressed} 2020-04-18 22:52:04 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-18 22:52:05 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 551505585 2020-04-18 22:52:05 WARNING (MainThread) [homeassistant.components.system_log.external] "Automation IR Debug: 551505585" 2020-04-18 22:52:05 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:336388 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=2,l=2,sg=0:0 {second message to workaround another issue, ignored by the automation} 2020-04-18 22:52:05 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-18 22:52:05 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 0 2020-04-18 22:52:06 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:337334 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=5,l=4,sg=0:34469099 {Button pressed} 2020-04-18 22:52:06 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-18 22:52:06 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 34469099 {Button pressed} 2020-04-18 22:52:06 WARNING (MainThread) [homeassistant.components.system_log.external] "Automation IR Debug: 34469099" 2020-04-18 22:52:06 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:337491 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=2,l=2,sg=0:0 {second message to workaround another issue, ignored by the automation} 2020-04-18 22:52:06 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-18 22:52:06 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 0{second message to workaround another issue, ignored by the automation} 2020-04-18 22:52:06 DEBUG (SyncWorker_9) [mysensors.persistence] Saving sensors to persistence file /config/mysensors1.pickle 2020-04-18 22:52:06 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:338235 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=5,l=4,sg=0:551505585 {Button pressed} 2020-04-18 22:52:06 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-18 22:52:07 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 551505585 2020-04-18 22:52:07 WARNING (MainThread) [homeassistant.components.system_log.external] "Automation IR Debug: 551505585" 2020-04-18 22:52:07 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:338395 TSF:MSG:READ,3-3-0,s=3,c=1,t=33,pt=2,l=2,sg=0:0 {second message to workaround another issue, ignored by the automation} 2020-04-18 22:52:07 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 3 2020-04-18 22:52:07 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 0 2020-04-18 22:52:16 DEBUG (SyncWorker_8) [mysensors.persistence] Saving sensors to persistence file /config/mysensors1.pickle
After this the integration doesn't answer to any more messages, though HA is running fine and I can toggle the lamp from lovelace.
This doesn't happen with other services, it's just the switch that has this issue. It also happens when I use switch.turn_on and switch.turn_off.
The switch is a tasmota-flashed plug, controlled by MQTT.
Does anybody have an idea what I am doing wrong or how I can debug this further?
-
RE: IR Node resending last signal ca every 15 minutes
These updates trigger the event:
{"log":"2020-03-11 12:42:01 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T11:42:01.635196016Z"}
From what I can see these updates happen whether I trigger something on the node or not, unfortunately.
-
RE: IR Node resending last signal ca every 15 minutes
Sorry for the late reply, I have been busy with a few other sensors.
Do you mean attach a pull-up resistor to the ir sensor? I haven't tried that, but from what I can see the problem isn't the sensor node, it's the integration that sends events when no event has been sent. The gateway log doesn't show a new message being received so I guess the node isn't to blame.
-
RE: IR Node resending last signal ca every 15 minutes
I am working around the issue by sending a zero after every received ir_value, that way I can identify refreshes in home assistant/appdaemon
send(msgIrRecord.set(ir_value)); send(msgIrRecord.set(0));
This is a very ugly workaround though, does anybody have areal fix?
-
RE: IR Node resending last signal ca every 15 minutes
That would be great, thanks!
-
RE: IR Node resending last signal ca every 15 minutes
I had a look at the Home Assistant logs and I think I have been blaming the wrong beast, my code seems to be innocent.
I use appdaemon to execute actions in/from Home Assistant. There I can see exactly when a "ghost"-update was received.
Matching those timestamps with timestamps from the Home Assistant log was spot on:
Appdaemon log:
2020-03-11 09:38:23.092076 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 09:39:48.834817 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 09:48:03.398937 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 09:49:19.742706 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 10:05:24.735442 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 10:06:58.973448 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 10:38:26.141511 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 10:39:42.890820 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 10:47:59.874830 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 10:49:16.437996 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 11:15:23.592502 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 11:16:40.138025 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 11:18:05.195990 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 11:19:39.443632 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 12:27:05.469657 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 12:28:22.691106 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 12:35:15.985303 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 12:36:33.073911 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 12:40:29.881660 INFO Living_Room_IR: ir_value: 551505585 2020-03-11 12:42:01.804079 INFO Living_Room_IR: ir_value: 551505585
Here is the corresponding part of the home assistant log:
{"log":"2020-03-11 09:38:22 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T08:38:22.931537407Z"} {"log":"2020-03-11 09:39:48 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T08:39:48.650792534Z"} {"log":"2020-03-11 09:48:03 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T08:48:03.210220912Z"} {"log":"2020-03-11 09:49:19 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T08:49:19.579932619Z"} {"log":"2020-03-11 10:05:24 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T09:05:24.564205929Z"} {"log":"2020-03-11 10:06:58 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T09:06:58.804235809Z"} {"log":"2020-03-11 10:38:25 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T09:38:25.95710773Z"} {"log":"2020-03-11 10:39:42 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T09:39:42.703318764Z"} {"log":"2020-03-11 10:47:59 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T09:47:59.694853604Z"} {"log":"2020-03-11 10:49:16 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T09:49:16.294815751Z"} {"log":"2020-03-11 11:15:23 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T10:15:23.452517606Z"} {"log":"2020-03-11 11:16:39 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T10:16:39.957885612Z"} {"log":"2020-03-11 11:18:05 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T10:18:05.045447402Z"} {"log":"2020-03-11 11:19:39 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T10:19:39.270413469Z"} {"log":"2020-03-11 12:27:05 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T11:27:05.326243334Z"} {"log":"2020-03-11 12:28:22 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T11:28:22.519338238Z"} {"log":"2020-03-11 12:35:15 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T11:35:15.805191381Z"} {"log":"2020-03-11 12:36:32 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T11:36:32.903939567Z"} {"log":"2020-03-11 12:40:29 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T11:40:29.720752968Z"} {"log":"2020-03-11 12:42:01 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T11:42:01.635196016Z"}
So it seems that every time a Node update was triggered Home Assistant was told that there was a new value received from the IR-sensor.
Here is the whole log from Home Assistant:
{"log":"2020-03-11 12:42:00 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:11494641 TSF:MSG:RE AD,3-3-0,s=0,c=1,t=1,pt=7,l=5,sg=0:38.4\n","stream":"stderr","time":"2020-03-11T11:42:00.295978262Z"} {"log":"2020-03-11 12:42:00 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 0\n","stream":"stderr","time":"2020-03-11T11:42:00.311538101Z"} {"log":"2020-03-11 12:42:00 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 0: value_type 1, value = 38.4\n","stream":"stderr","time":"2020-03-11T11:42:00 .415847867Z"} {"log":"2020-03-11 12:42:00 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:11495280 TSF:MSG:RE AD,3-3-0,s=2,c=1,t=37,pt=7,l=5,sg=0:45.0\n","stream":"stderr","time":"2020-03-11T11:42:00.93325235Z"} {"log":"2020-03-11 12:42:00 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 2\n","stream":"stderr","time":"2020-03-11T11:42:00.950559479Z"} {"log":"2020-03-11 12:42:01 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 2: value_type 37, value = 45.0\n","stream":"stderr","time":"2020-03-11T11:42:0 1.058505324Z"} {"log":"2020-03-11 12:42:01 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:11495962 TSF:MSG:RE AD,3-3-0,s=255,c=3,t=0,pt=1,l=1,sg=0:22\n","stream":"stderr","time":"2020-03-11T11:42:01.618936799Z"} {"log":"2020-03-11 12:42:01 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: n ode 3 child 255\n","stream":"stderr","time":"2020-03-11T11:42:01.635196016Z"} {"log":"2020-03-11 12:42:01 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 0: value_type 1, value = 38.4\n","stream":"stderr","time":"2020-03-11T11:42:01 .738527926Z"} {"log":"2020-03-11 12:42:01 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 1: value_type 0, value = 22.4\n","stream":"stderr","time":"2020-03-11T11:42:01 .743098362Z"} {"log":"2020-03-11 12:42:01 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 50, value = 624502100\n","stream":"stderr","time":"2020-03-11T11 :42:01.747319859Z"} {"log":"2020-03-11 12:42:01 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 3: value_type 33, value = 551505585\n","stream":"stderr","time":"2020-03-11T11 :42:01.748432047Z"} {"log":"2020-03-11 12:42:01 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: mysensors_wohnzimmer_main 3 2: value_type 37, value = 45.0\n","stream":"stderr","time":"2020-03-11T11:42:0 1.752559045Z"} {"log":"2020-03-11 12:42:02 DEBUG (SyncWorker_3) [mysensors.persistence] Saving sensors to persistence fil e /config/mysensorsserial.json\n","stream":"stderr","time":"2020-03-11T11:42:02.441267303Z"}
Does anybody have an idea how I can prevent these updates? Or should I continue this thread in the Home Assistant forum of mysensors?
-
RE: IR Node resending last signal ca every 15 minutes
I am a bit embarrassed that I didn't post them straight away. I'll collect a bit of data during the night and send the logs tomorrow. Thanks!
-
RE: IR Node resending last signal ca every 15 minutes
I want to put the node to sleep. And it actually works very well, when it is woken up by a pin interrupt it reads the data and sends them to my serial gateway.
The issue is that it repeats messages.
I have now covered the sensor and I still get messages ca every 15 minutes.
Is resending messages a part of the send()-function maybe?
-
RE: IR Node resending last signal ca every 15 minutes
I am using a serial gateway, but long term plan is to use an mqtt gateway.
-
IR Node resending last signal ca every 15 minutes
Hi,
I attached a TSOP 38238 to my arduino pro mini (3v) wit the goal of relaying IR signals to my controller (Home Assistant). On the face of it everything works: When I press a button on my tv remote a message is sent. But: about every 15 minutes the node resends the last IR command it has seen.
Also attached to the node is a lux sensor and a temp/humidity sensor that are pulled every 90 seconds (I don't need updated temp/hum/lux values every time somebody presses a button on the remote).
The IR sensor is attached to pin 3 and wakes the sensor up every time there is new data. When the ardunio is woken up it checks whether it was by interrupt or by time an then checks the corresponding sensor.
Can anybody see what I am doing wrong here? Here is a pic of the sensor in Home Assistant:
![alt text](image url)
This is from last night, all lights are off and nobody used the remote. I can't find a reason why the node wakes up ~ every 15 minutes.
Does anybody have an idea or a workaround?
sketch:
// Enable debug prints //#define MY_DEBUG //#define MY_OWN_DEBUG #ifndef MY_OWN_DEBUG //disable serial in production compile, potentially saves few uA in sleep mode #define MY_DISABLED_SERIAL #endif // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER #define MY_NODE_ID 3 #include <MySensors.h> // IR specific setup #include <IRremote.h> int RECV_PIN = 3; IRrecv irrecv(RECV_PIN); decode_results ircode; const char * TYPE2STRING[] = { "UNKONWN", "RC5", "RC6", "NEC", "Sony", "Panasonic", "JVC", "SAMSUNG", "Whynter", "AIWA RC T501", "LG", "Sanyo", "Mitsubishi", "Dish", "Sharp", "Denon" }; #define Type2String(x) TYPE2STRING[x < 0 ? 0 : x] #define AddrTxt F(" addres: 0x") #define ValueTxt F(" value: 0x") #define NATxt F(" - not implemented/found") unsigned long last_value; // IR specific setup end #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_LUX 2 #define CHILD_ID_IR 3 #define SKETCH_NAME "mysensors_wohnzimmer_main" #define SKETCH_MAJOR_VER "1" #define SKETCH_MINOR_VER "0" static bool metric = true; int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point int oldBatteryPcnt = 0; float lastHum = 0; float lastTemp = 0; int lastLux = 0; // Sleep time between sensor updates (in milliseconds) static const unsigned long UPDATE_INTERVAL = 90000; #include <SI7021.h> #include <BH1750.h> static SI7021 tempsensor; BH1750 lightmeter; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgLux(CHILD_ID_LUX, V_LEVEL); MyMessage msgIrRecord(CHILD_ID_IR, V_IR_RECEIVE); void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER); present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); present(CHILD_ID_LUX, S_LIGHT_LEVEL); present(CHILD_ID_IR, S_IR); } void setup() { while (not tempsensor.begin()) { Serial.println(F("Temperaturesensor not detected!")); delay(5000); } #ifdef MY_OWN_DEBUG Serial.println("Tempsensor started"); #endif lightmeter.begin(); #ifdef MY_OWN_DEBUG Serial.print("UPDATE_INTERVAL:");Serial.println(UPDATE_INTERVAL); #endif irrecv.enableIRIn(); } void loop(){ int8_t wake_reason; sleep_bod_disable();//disable BOD - saves~ 15uA wake_reason = sleep(RECV_PIN-2, RISING, UPDATE_INTERVAL); #ifdef MY_OWN_DEBUG Serial.print("wake_reason=");Serial.println(wake_reason); #endif if (wake_reason == 1){ //woken up by interrupt on d3 ir_received(); } else{ //woken by update_interval update_interval(); } } void ir_received(){ delay(100); if (irrecv.decode(&ircode)) { unsigned long ir_value = ircode.value; //if (ir_value == REPEAT) //if repeat-code: send last code //{ // ir_value = last_value; //} //else{ //if not: save new value as last value // last_value = ir_value; //} #ifdef MY_OWN_DEBUG Serial.println(ir_value,HEX); #endif send(msgIrRecord.set(ir_value)); } irrecv.resume(); // Receive the next value Serial.println("IR Processing done--------------------"); } void update_interval() { #ifdef MY_OWN_DEBUG Serial.println("In loop"); #endif // Read temperature & humidity from sensor. const float temperature = float( metric ? tempsensor.getCelsiusHundredths() : tempsensor.getFahrenheitHundredths() ) / 100.0; float roundedTemp = floorf(temperature * 10) / 10; //round temp down to 1 decimal const float humidity = float( tempsensor.getHumidityBasisPoints() ) / 100.0; float roundedHum = floorf(humidity * 10) / 10; //round humidty down to 1 decimal lightmeter.configure(BH1750_ONE_TIME_HIGH_RES_MODE); //delay(500); // Allow some time const uint16_t lux = lightmeter.readLightLevel(); if (lastHum != roundedHum){ #ifdef MY_OWN_DEBUG Serial.print("roundedHum: ");Serial.println(roundedHum); #endif send(msgHum.set(roundedHum, 1)); lastHum = roundedHum; } if (lastTemp != roundedTemp){ send(msgTemp.set(temperature, 1)); lastTemp = roundedTemp; } if (lastLux != lux){ send(msgLux.set(lux, 1)); lastLux = lux; } //send battery value battery(); } void battery(){ //omitted for brevity } // Dumps out the decode_results structure. void dump(decode_results *results) { int count = results->rawlen; unsigned long test = results->value; Serial.print("raw: "); Serial.print(test, HEX); Serial.println(""); Serial.print(F("Received : ")); Serial.print(results->decode_type, DEC); Serial.print(F(" ")); Serial.print(Type2String(results->decode_type)); if (results->decode_type == PANASONIC) { Serial.print(AddrTxt); Serial.print(results->address,HEX); Serial.print(ValueTxt); } Serial.print(F(" ")); Serial.print(results->value, HEX); Serial.print(F(" (")); Serial.print(results->bits, DEC); Serial.println(F(" bits)")); if (results->decode_type == UNKNOWN) { Serial.print(F("Raw (")); Serial.print(count, DEC); Serial.print(F("): ")); for (int i = 0; i < count; i++) { if ((i % 2) == 1) { Serial.print(results->rawbuf[i]*USECPERTICK, DEC); } else { Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC); } Serial.print(" "); } Serial.println(""); } }
-
RE: IR Sensor only reading every other button press
I didn't know that delay blocked, good to know, thanks. I have nothing that's supposed to run in the background so delay works for the time being
Congrats on the node! Is the code available somewhere? I'd like to take a look. Always good to learn new stuff.
-
RE: IR Sensor only reading every other button press
I think this is solved: It appears that the interrupt wakes the arduino who then queries the sensor before the full code is received. I added a
delay(100);
to give it a bit more time to read the data.
void ir_received(){ delay(100); if (irrecv.decode(&ircode)) { //#ifdef MY_OWN_DEBUG //dump(&ircode); //#endif unsigned long ir_value = ircode.value; if (ir_value == REPEAT) //if repeat-code: send last code { ir_value = last_value; } else{ //if not: save new value as last value last_value = ir_value; } Serial.println(ir_value,HEX); send(msgIrRecord.set(ir_value)); } //delay(100); irrecv.resume(); // Receive the next value Serial.println("IR Processing done--------------------"); }
If anybody has a better idea please let me know.
-
RE: IR Sensor only reading every other button press
I used the sketch "IRrecvDump" from the IRremote library to verify that only one code is sent per button press, so I don't think that's the problem.
With that sketch the same code is written to the serial monitor every time I press the same button.
The issue is that code uses polling and I want the arduino to sleep because it is a battery powered node.
/edit: irrecv.enableIRIn(); didn't make a difference unfortunately.
-
IR Sensor only reading every other button press
Hi,
I am trying to pass IR data from my TV remote to my controller (Home Assistant) for later processing.
I am using a TSOP38238 receiver connected to D3 on an arduino pro mini. The pro mini is using two other sensors (lux and temp/humidity) connected via i2c which are pulled every 90 seconds by the arduino. For brevity I'll omit their code, let me know if you need to see it anyway.
The arduino sleeps and is woken up by an interrupt if the IR-sensor receives data. The weird thing is though: The arduino wakes up on every signal from the TV remote (LG TV) but only receives every other signal.
Here is the output of the serial monitor:
20:20:55.561 -> 20:20:55.561 -> __ __ ____ 20:20:55.595 -> | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ 20:20:55.595 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| 20:20:55.595 -> | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ 20:20:55.595 -> |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ 20:20:55.595 -> |___/ 2.4.0-alpha 20:20:55.595 -> 20:21:01.036 -> Tempsensor started 20:21:01.036 -> UPDATE_INTERVAL:90000 20:21:06.079 -> wake_reason=1 20:21:06.079 -> IR Processing done-------------------- 20:21:08.369 -> wake_reason=1 20:21:08.369 -> 20DF4EB 20:21:08.468 -> IR Processing done-------------------- 20:21:10.525 -> wake_reason=1 20:21:10.525 -> IR Processing done-------------------- 20:21:11.686 -> wake_reason=1 20:21:11.686 -> 20DF8E7 20:21:11.819 -> IR Processing done-------------------- 20:21:13.379 -> wake_reason=1 20:21:13.379 -> IR Processing done-------------------- 20:21:14.607 -> wake_reason=1 20:21:14.607 -> 20DFC63 20:21:14.706 -> IR Processing done-------------------- 20:21:16.033 -> wake_reason=1 20:21:16.033 -> IR Processing done-------------------- 20:21:16.929 -> wake_reason=1 20:21:16.929 -> 20DF867 20:21:17.029 -> IR Processing done--------------------
I pressed four different buttons on the remote, each one twice.
Here is the code, please let me know what I am doing wrong:
/** * 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-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/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. * ******************************* * * REVISION HISTORY * Version 1.0: Yveaux * * DESCRIPTION * This sketch provides an example of how to implement a humidity/temperature * sensor using a Si7021 sensor. * * For more information, please visit: * http://www.mysensors.org/build/humiditySi7021 * */ // Enable debug prints //#define MY_DEBUG #define MY_OWN_DEBUG #ifndef MY_OWN_DEBUG //disable serial in production compile, potentially saves few uA in sleep mode #define MY_DISABLED_SERIAL #endif // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER #define MY_NODE_ID 3 #include <MySensors.h> // IR specific setup #include <IRremote.h> int RECV_PIN = 3; IRrecv irrecv(RECV_PIN); decode_results ircode; const char * TYPE2STRING[] = { "UNKONWN", "RC5", "RC6", "NEC", "Sony", "Panasonic", "JVC", "SAMSUNG", "Whynter", "AIWA RC T501", "LG", "Sanyo", "Mitsubishi", "Dish", "Sharp", "Denon" }; #define Type2String(x) TYPE2STRING[x < 0 ? 0 : x] #define AddrTxt F(" addres: 0x") #define ValueTxt F(" value: 0x") #define NATxt F(" - not implemented/found") unsigned long last_value; // IR specific setup end #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_LUX 2 #define CHILD_ID_IR 3 #define SKETCH_NAME "mysensors_wohnzimmer_main" #define SKETCH_MAJOR_VER "1" #define SKETCH_MINOR_VER "0" static bool metric = true; int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point int oldBatteryPcnt = 0; float lastHum = 0; float lastTemp = 0; int lastLux = 0; // Sleep time between sensor updates (in milliseconds) static const unsigned long UPDATE_INTERVAL = 90000; #include <SI7021.h> #include <BH1750.h> static SI7021 tempsensor; BH1750 lightmeter; // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgLux(CHILD_ID_LUX, V_LEVEL); MyMessage msgIrRecord(CHILD_ID_IR, V_IR_RECEIVE); void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER); present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); present(CHILD_ID_LUX, S_LIGHT_LEVEL); present(CHILD_ID_IR, S_IR); } void setup() { //Serial.begin(9600); //Serial.print("Starting: "); while (not tempsensor.begin()) { Serial.println(F("Temperaturesensor not detected!")); delay(5000); } #ifdef MY_OWN_DEBUG Serial.println("Tempsensor started"); #endif lightmeter.begin(); #ifdef MY_OWN_DEBUG Serial.print("UPDATE_INTERVAL:");Serial.println(UPDATE_INTERVAL); #endif irrecv.enableIRIn(); } void loop(){ int8_t wake_reason; sleep_bod_disable();//disable BOD - saves~ 15uA wake_reason = smartSleep(RECV_PIN-2, CHANGE, UPDATE_INTERVAL); #ifdef MY_OWN_DEBUG Serial.print("wake_reason=");Serial.println(wake_reason); #endif if (wake_reason == 1){ //woken up by interrupt on d3 ir_received(); } else{ //woken by update_interval update_interval(); } } void ir_received(){ if (irrecv.decode(&ircode)) { unsigned long ir_value = ircode.value; if (ir_value == REPEAT) //if repeat-code: send last code { ir_value = last_value; } else{ //if not: save new value as last value last_value = ir_value; } Serial.println(ir_value,HEX); delay(100); send(msgIrRecord.set(ir_value)); irrecv.resume(); // Receive the next value } Serial.println("IR Processing done--------------------"); } void update_interval() { //removed for brevity }
-
RE: Battery: pro mini @ 1mhz vs booster
How do I know whether a booster introduces noise? I think so far I have been lucky with my three nodes because they work as expected. Or I don't know what to look for...
-
RE: Battery: pro mini @ 1mhz vs booster
In the "battery without a booster "-section, what do you mean by risky? I took it to mean that the arduino potentially could reboot or fail. Apologies if that's now what you meant.
I think I need to stick with a booster anyway, I am using a light sensor in most of my nodes and it needs 3v.
But I'll reprogram the bootloader of one of my arduino. Just out of curiosity
Do you disable just the bod or do you also switch the frequency to 8mhz?
-
RE: Battery: pro mini @ 1mhz vs booster
Thanks for letting me know about voltage rebound. I'll reprogram my nodes to take a measurement after tx as you said!
-
RE: Battery: pro mini @ 1mhz vs booster
Ah, that's good to know. We'll, as long as I get a warning some time before the node dies.
From what I have seen the percentage decreases so it at least doesn't just suddenly drop to 0, that's OK for my use case.
Thank you everybody for your help!
-
RE: Battery: pro mini @ 1mhz vs booster
Thanks, that's actually good news as it spares me the work of figuring out what to do
One question if you don't mind: I am using the usual battery percentage calculation with the Rechargeables. When full they show 76%, that's OK by me. My question is: will it linearly decrease the emptier the Rechargeables become or should I use a different calculation?
-
RE: Battery: pro mini @ 1mhz vs booster
My bad, I forgot the Link: https://www.openhardware.io/view/389/EasyNewbie-PCB-RFM69-HWW-edition-for-MySensors
It's the last paragraph in the "battery without a booster section". "Unstable" is what I got from "risky", so it might have been a bad interpretation on my part.
-
RE: Battery: pro mini @ 1mhz vs booster
I am using the easypcbs from here and that's also where I got the idea to run without a booster. There it's says that at 8mhz it can be unstable. Is that not correct?
I am also using Rechargeables, so I'll have to check what their lowest non empty voltage is.
Thanks
-
RE: Battery: pro mini @ 1mhz vs booster
Thanks, I'll try to figure out how much juice my sensors draw in sleep and will give the page a go
-
Battery: pro mini @ 1mhz vs booster
Hi,
I am trying to find measurements on what uses less power: an arduino pro mini 3v at 1mhz with disabled bod vs an arduino getting powered by a step up booster.
Has anybody done any measurements which setup uses less power?
I see it sometimes pop up that every instruction will take 8 times longer at 1mhz which could negate the power saving in sleep mode, but I have not seen any actual data about which is better.
So if you anybody has done the comparison please let me know!
Thanks!
-
RE: script to convert serial to mqtt?
I am using appdaemon for my automation and I wouldn't want to install node red just for the conversion. Or are there automations that node red can that appdaemon can't?
-
RE: script to convert serial to mqtt?
@electrik
I haven't tried the script since using a serial gateway as is in home assistant was problem free and from what I have seen I can seamlessly switch to an mqtt broker in the future. -
script to convert serial to mqtt?
Hi,
I am trying to find a working script that translates messages from my serial gateway to mqtt so that they are equivalent (in structure and topics) to a mysensors mqtt-gateway.
The reason I would like this is that I can't use my rfm69h chip on my raspberry pi atm but I can use a serial gateway. As soon as I can use the chip I would like to use the mqtt gateway. And I don't want to set everything up from scratch in home assistant then.
Can anybody recommend a working script for this? I have found a few very old ones and one that's fairly recent, but the ones I found that let me set subscribe and publish topics didn't accept username and passwort for the mqtt broker and the ones that did used a different messaging structure.
Thanks for the help!
-
RE: serial gateway: !TSM:INIT:TSP FAIL
Oh, I completely misunderstood then! I thought mysgw would interpret the serial input and then make it accessible to the controller.
Thanks för clearing that up, I will give it a shot tomorrow.
-
serial gateway: !TSM:INIT:TSP FAIL
Hi,
I am trying to use a rfm69hw chip with my raspberry pi 4. For that I wired the chip to an arduino pro mini and flashed the serial gateway sketch. The sketch initializes fine when I check the arduino IDE serial monitor.
When I then hook the pro mini up to the pi (using USB) I can see that a tty device is being created (ttyUSB0).
I can also read from the device using python:
pi@raspberrypi:~/monitorgpio $ python3 testscript.py ---- b'' b'0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RPNGA---,FQ=8,REL=0,VER=2.4.0-alpha\n' b'0;255;3;0;9;18 TSM:INIT\n' b'0;255;3;0;9;24 TSF:WUR:MS=0\n' b'' b'0;255;3;0;9;1284 TSM:INIT:TSP OK\n' b'0;255;3;0;9;1294 TSM:INIT:GW MODE\n' b'0;255;3;0;9;1302 TSM:READY:ID=0,PAR=0,DIS=0\n' b'0;255;3;0;9;1314 MCO:REG:NOT NEEDED\n' b'0;255;3;0;14;Gateway startup complete.\n' b'0;255;0;0;18;2.4.0-alpha\n' b'0;255;3;0;9;1327 MCO:BGN:STP\n' b'0;255;3;0;9;1349 MCO:BGN:INIT OK,TSP=1\n' b'0;255;3;0;9;1359 TSM:READY:NWD REQ\n' b'' b'' b'0;255;3;0;9;3371 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:\n' b'' b'' b'' ^CTraceback (most recent call last): File "testscript.py", line 10, in <module> output = ser.readline() File "/home/pi/.local/lib/python3.7/site-packages/serial/serialposix.py", line 483, in read ready, _, _ = select.select([self.fd, self.pipe_abort_read_r], [], [], timeout.time_left()) KeyboardInterrupt
When I then start the mysensors gateway I get this output though:
pi@raspberrypi:~/MySensorsDev/MySensors $ sudo ./bin/mysgw Jan 30 23:02:12 INFO Starting gateway... Jan 30 23:02:12 INFO Protocol version - 2.4.0-alpha Jan 30 23:02:12 DEBUG Serial port /dev/ttyUSB0 (38400 baud) created Jan 30 23:02:12 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,FQ=NA,REL=0,VER=2.4.0-alpha Jan 30 23:02:12 DEBUG TSF:LRT:OK Jan 30 23:02:12 DEBUG TSM:INIT Jan 30 23:02:12 DEBUG TSF:WUR:MS=0 Jan 30 23:02:12 DEBUG !TSM:INIT:TSP FAIL Jan 30 23:02:12 DEBUG TSM:FAIL:CNT=1 Jan 30 23:02:12 DEBUG TSM:FAIL:DIS Jan 30 23:02:12 DEBUG TSF:TDI:TSL
What am I doing wrong?
I configured the gw like this:
./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw --my-gateway=serial --my-serial-baudrate=38400 --my-serial-is-pty --my-serial-groupname=tty --my-serial-port=/dev/ttyUSB0
Side note: After starting the gateway I can see that /dev/ttyUSB0 disappears and only reappears if I unplug and replug the arduino.
Any help is greatly appreciated since this was my backup plan to get a gateway on the pi working (directly connecting my rfm69hw chip to the pi doesn't work/yields low range).
-
RE: Drawbacks to using a pro mini as a serial gateway?
Ah, I see there are Nanos with 8mhz and 16mhz, that's why I thought the baud rate of 34800 was specifically for the pro mini.
Do you know whether I just have to hook up TX and rx, power and gnd to the pi or whether I need something else? I am having trouble finding a description of how to do it without USB.
-
RE: Drawbacks to using a pro mini as a serial gateway?
Thanks. So why the reduced baud rate than? Sorry, this is probably a noob question.
-
Drawbacks to using a pro mini as a serial gateway?
Hi,
I am planing on using a pro mini as a serial gateway (to connect to my raspberry pi)
I saw in the serial gateway sketch, that it runs on a lower baud rate when run on a pro mini. Does that mean that messages will appear later on raspberry? Are there other drawbacks?
And is it correct that I simply connect rx/TX from the pro mini to tx/rx on the pi and that's it? Plus power and gnd, of course.
-
RE: 💬 Building a Raspberry Pi Gateway
Be advised that there seems to be an issue with rfm69HW on the raspberry pi:
When using the radio directly on the pi (not as a serial gateway) the range drops significantly:
https://github.com/mysensors/MySensors/issues/1367
Apparently this wasn't an issue with mysensors 2.2, so using that is an option if you can compile it for you raspberry pi.
-
RE: rfm69hw on a raspberry pi 4, power issues
So from what I can read here this might not be a power issue after all?
This is the sketch I am using for the signal scanner:
/* * 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. * ******************************* * * REVISION HISTORY * Version 1.0 - tekka * * DESCRIPTION * ATC mode settings and signal report functions, on RFM69 and RFM95 nodes * */ // Enable debug prints #define MY_DEBUG #define MY_SIGNAL_REPORT_ENABLED #define MY_NODE_ID 3 // Enable and select radio type attached // RFM69 #define MY_RADIO_RFM69 #define MY_RFM69_NEW_DRIVER // ATC on RFM69 works only with the new driver (not compatible with old=default driver) #define MY_IS_RFM69HW //#define MY_RFM69_ATC_TARGET_RSSI_DBM (-70) // target RSSI -70dBm //#define MY_RFM69_MAX_POWER_LEVEL_DBM (10) // max. TX power 10dBm = 10mW // RFM95 //#define MY_RADIO_RFM95 //#define MY_RFM95_ATC_TARGET_RSSI_DBM (-70) // target RSSI -70dBm //#define MY_RFM95_MAX_POWER_LEVEL_DBM (10) // max. TX power 10dBm = 10mW #include <MySensors.h> // ID of the sensor child #define CHILD_ID_UPLINK_QUALITY (0) #define CHILD_ID_TX_LEVEL (1) #define CHILD_ID_TX_PERCENT (2) #define CHILD_ID_TX_RSSI (3) #define CHILD_ID_RX_RSSI (4) #define CHILD_ID_TX_SNR (5) #define CHILD_ID_RX_SNR (6) // Initialize general message MyMessage msgTxRSSI(CHILD_ID_TX_RSSI, V_CUSTOM); MyMessage msgRxRSSI(CHILD_ID_RX_RSSI, V_CUSTOM); MyMessage msgTxSNR(CHILD_ID_TX_SNR, V_CUSTOM); MyMessage msgRxSNR(CHILD_ID_RX_SNR, V_CUSTOM); MyMessage msgTxLevel(CHILD_ID_TX_LEVEL, V_CUSTOM); MyMessage msgTxPercent(CHILD_ID_TX_PERCENT, V_CUSTOM); MyMessage msgUplinkQuality(CHILD_ID_UPLINK_QUALITY, V_CUSTOM); void setup() { } void presentation() { // Send the sketch version information to the gateway and controller sendSketchInfo("ATC", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_UPLINK_QUALITY, S_CUSTOM, "UPLINK QUALITY RSSI"); present(CHILD_ID_TX_LEVEL, S_CUSTOM, "TX LEVEL DBM"); present(CHILD_ID_TX_PERCENT, S_CUSTOM, "TX LEVEL PERCENT"); present(CHILD_ID_TX_RSSI, S_CUSTOM, "TX RSSI"); present(CHILD_ID_RX_RSSI, S_CUSTOM, "RX RSSI"); present(CHILD_ID_TX_SNR, S_CUSTOM, "TX SNR"); present(CHILD_ID_RX_SNR, S_CUSTOM, "RX SNR"); } void loop() { // send messages to GW send(msgUplinkQuality.set(transportInternalToRSSI(_transportSM.uplinkQualityRSSI))); send(msgTxLevel.set(transportGetTxPowerLevel())); send(msgTxPercent.set(transportGetTxPowerPercent())); // retrieve RSSI / SNR reports from incoming ACK send(msgTxRSSI.set(transportGetSendingRSSI())); send(msgRxRSSI.set(transportGetReceivingRSSI())); send(msgTxSNR.set(transportGetSendingSNR())); send(msgRxSNR.set(transportGetReceivingSNR())); //to serial Serial.print("transportInternalToRSSI(_transportSM.uplinkQualityRSSI): "); Serial.println(transportInternalToRSSI(_transportSM.uplinkQualityRSSI)); Serial.print("transportGetTxPowerLevel(): "); Serial.println(transportGetTxPowerLevel()); Serial.print("transportGetTxPowerPercent(): "); Serial.println(transportGetTxPowerPercent()); Serial.print("transportGetSendingRSSI(): "); Serial.println(transportGetSendingRSSI()); Serial.print("transportGetReceivingRSSI(): "); Serial.println(transportGetReceivingRSSI()); Serial.print("transportGetSendingSNR(): "); Serial.println(transportGetSendingSNR()); Serial.print("transportGetReceivingSNR(): "); Serial.println(transportGetReceivingSNR()); Serial.println("Waiting"); // wait a bit wait(10000); }
And this is how I compiled the gateway:
./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-gateway=mqtt --my-is-rfm69hw --extra-cxxflags="-DMY_RFM69_RST_PIN=29" --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mysensorsgateway1 --my-mqtt-user=mysensors --my-mqtt-password=redacted --my-port=1883
Any ideas how I can test mysensors 2.2 with the raspberry pi 4? From what I understand that version of the pi isn't supported until version 2.4 alpha?
-
rfm69hw on a raspberry pi 4, power issues
Hi,
I am trying to build a raspberry pi gateway with a rfm69hw chip.
I built a hat for the pi and the connections seem to be fine, my problem is range.
I am using the signal scanner sketch and it shows me that the sending node has to max out TXPowerLevel when it talks to the gateway.
I repurposed one of my other nodes as a gateway and there sending was fine at TXPowerLevel 0, so it must be the gateway.
I soldered a 470uF capacitor to the radio on the pi and that helps for the first lets say 50 messages, but then the same pattern reappears: The node maxes out its power level.
Any ideas on how to fix this? I know I could just use a serial gateway, but to be honest I got it into my thick skull that the gateway has to be hat for the pi (mostly because otherwise all that time would have been wasted ;)).
I have some step up boosters to 3.3v (the ones I use for the nodes), should I try to power the rfm69-chip from one of the boosters?
-
RE: rfm69 gateway freezing on rpi 4
@jaylove oh, I didn't know I had to compile the gateway with it. I'll give it a try. Thanks!
-
RE: Help: Some explanation requested regarding NACK
@ricmail85 sorry for the late reply. I soldered it to a free pin on the pi and reconfigured the gateway.
Use this as part of your configure
--extra-cxxflags="-DMY_RFM69_RST_PIN=29"
If you connected to pi pin 29.
-
RE: 💬 Light Level Sensor - BH1750
What's the expected value range for this sensor in the evening with some lights on? It's not dark here atm but I am getting ca 10 lux only. Any ideas?
-
RE: Help: Some explanation requested regarding NACK
@ricmail85 I solved my problem by soldering a cable to the reset pin of the chip and the (in my case) raspberry pi. This or the dupont wires I used were glitchy
-
RE: 💬 Easy/Newbie PCB for MySensors
@Anticimex ,@sundberg84
Thanks for the help, I think I was looking at the wrong chip. The one I considered byuing had 6 legs, not only 3. I was thrown off by the easypcb having what appears to be 7 soldering points in the signing area.
-
RE: rfm69 gateway freezing on rpi 4
I think this was solved by soldering a wire to the reset pin of the rfm69 and pin 29 of the raspberry pi and reconfiguring the gateway with
--extra-cxxflags="-DMY_RFM69_RST_PIN=29"
Now the connection is instant (before it was about 10-20 seconds IF it worked at all.
But since this is my first gig with electronics it might just be that I had a bad connection and moving the wires around fixed it....
-
RE: 💬 Easy/Newbie PCB for MySensors
Is there a video of how to solder the signing chip? Because from what I can see there is a connection to be made right in the middle of the chip and I am not sure how to.
-
rfm69 gateway freezing on rpi 4
Hi,
I am using the development branch of mysensors because I'd like to run the gateway on a raspberry pi 4.
The node I have is an arduino pro mini (3v) on an easypcb connected to an rfm69HW chip (868mhz).
The gateway is a mqtt gateway and the controller is Home Assitant, but I decided to hand out node IDs manually (don't know if that's important.
It takes the node some time to connect to the gateway ( Around 10-20 sec, is that normal?) and after running for a few minutes the gateway just freezes, judging from the log output.
Gateway output and node output have been uploaded to pastebin since the forum complained about their size.
Gateway: https://pastebin.com/7wy9mLGe
Node: https://pastebin.com/jPME3gMHHere is the sketch I used:
/* * 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. * ******************************* * * REVISION HISTORY * Version 1.0 - tekka * * DESCRIPTION * ATC mode settings and signal report functions, on RFM69 and RFM95 nodes * */ // Enable debug prints #define MY_DEBUG #define MY_SIGNAL_REPORT_ENABLED #define MY_NODE_ID 1 // Enable and select radio type attached // RFM69 #define MY_RADIO_RFM69 #define MY_RFM69_NEW_DRIVER // ATC on RFM69 works only with the new driver (not compatible with old=default driver) #define MY_IS_RFM69HW #define MY_RFM69_ATC_TARGET_RSSI_DBM (-70) // target RSSI -70dBm #define MY_RFM69_MAX_POWER_LEVEL_DBM (10) // max. TX power 10dBm = 10mW // RFM95 //#define MY_RADIO_RFM95 //#define MY_RFM95_ATC_TARGET_RSSI_DBM (-70) // target RSSI -70dBm //#define MY_RFM95_MAX_POWER_LEVEL_DBM (10) // max. TX power 10dBm = 10mW #include <MySensors.h> // ID of the sensor child #define CHILD_ID_UPLINK_QUALITY (0) #define CHILD_ID_TX_LEVEL (1) #define CHILD_ID_TX_PERCENT (2) #define CHILD_ID_TX_RSSI (3) #define CHILD_ID_RX_RSSI (4) #define CHILD_ID_TX_SNR (5) #define CHILD_ID_RX_SNR (6) // Initialize general message MyMessage msgTxRSSI(CHILD_ID_TX_RSSI, V_CUSTOM); MyMessage msgRxRSSI(CHILD_ID_RX_RSSI, V_CUSTOM); MyMessage msgTxSNR(CHILD_ID_TX_SNR, V_CUSTOM); MyMessage msgRxSNR(CHILD_ID_RX_SNR, V_CUSTOM); MyMessage msgTxLevel(CHILD_ID_TX_LEVEL, V_CUSTOM); MyMessage msgTxPercent(CHILD_ID_TX_PERCENT, V_CUSTOM); MyMessage msgUplinkQuality(CHILD_ID_UPLINK_QUALITY, V_CUSTOM); void setup() { } void presentation() { // Send the sketch version information to the gateway and controller sendSketchInfo("ATC", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_UPLINK_QUALITY, S_CUSTOM, "UPLINK QUALITY RSSI"); present(CHILD_ID_TX_LEVEL, S_CUSTOM, "TX LEVEL DBM"); present(CHILD_ID_TX_PERCENT, S_CUSTOM, "TX LEVEL PERCENT"); present(CHILD_ID_TX_RSSI, S_CUSTOM, "TX RSSI"); present(CHILD_ID_RX_RSSI, S_CUSTOM, "RX RSSI"); present(CHILD_ID_TX_SNR, S_CUSTOM, "TX SNR"); present(CHILD_ID_RX_SNR, S_CUSTOM, "RX SNR"); } void loop() { // send messages to GW send(msgUplinkQuality.set(transportInternalToRSSI(_transportSM.uplinkQualityRSSI))); send(msgTxLevel.set(transportGetTxPowerLevel())); send(msgTxPercent.set(transportGetTxPowerPercent())); // retrieve RSSI / SNR reports from incoming ACK send(msgTxRSSI.set(transportGetSendingRSSI())); send(msgRxRSSI.set(transportGetReceivingRSSI())); send(msgTxSNR.set(transportGetSendingSNR())); send(msgRxSNR.set(transportGetReceivingSNR())); //to serial Serial.print("transportInternalToRSSI(_transportSM.uplinkQualityRSSI): "); Serial.println(transportInternalToRSSI(_transportSM.uplinkQualityRSSI)); Serial.print("transportGetTxPowerLevel(): "); Serial.println(transportGetTxPowerLevel()); Serial.print("transportGetTxPowerPercent(): "); Serial.println(transportGetTxPowerPercent()); Serial.print("transportGetSendingRSSI(): "); Serial.println(transportGetSendingRSSI()); Serial.print("transportGetReceivingRSSI(): "); Serial.println(transportGetReceivingRSSI()); Serial.print("transportGetSendingSNR(): "); Serial.println(transportGetSendingSNR()); Serial.print("transportGetReceivingSNR(): "); Serial.println(transportGetReceivingSNR()); Serial.println("Waiting"); // wait a bit wait(5000); }
This is how I configured the gateway:
./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-gateway=mqtt --my-is-rfm69hw --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mysensorsgateway1 --my-mqtt-user=mysensors --my-mqtt-password=redacted --my-port=1883
Did I configure the gateway incorrectly?
And can somebody let me know whether these RSSI values say that the connection is good? The node is 3m from the raspberry pi. GetSendingRSSI should be higher, right? Around 70, since that is defined in the beginning of the sketch if I am not mistaken.
The timezone on the gateway is one hour behind, I just noticed that.
Thanks for any help!
-
RE: Help: Some explanation requested regarding NACK
@Omemanti
Where you able to solve this? I am also experiencing a lot of NACKs in my rfm69 network (868mhz) -
RE: Arduino pro mini, rfm69 with 2 Reed switches on interrupts?
@Sasquatch that's a great idea, thank you very much!
I'll try that code out tomorrow. Thanks again!
-
RE: Serial Monitor: Reversed question marks when on battery
@Yveaux thanks, what could be the reason for them? And by xomms you mean Serial, not the rfm69, right?
-
RE: Serial Monitor: Reversed question marks when on battery
Well, it seems the problem might have been that the booster capacitor was touching the booster.
Only problem left is a lot of NACKs, but I will create a different topic for that.
/edit: There are less reversed question marks now, but there are still some.
-
Serial Monitor: Reversed question marks when on battery
Hi,
I am creating my first sensor using a easypcb. It has two reed switches, one on D3 and the other on D8 (via an IRS).
When I power the sensor from an USB port the output in the serial monitor looks fine, but when I power it via battery (2 AA rechargables, 2.6v in total) the output contains reversed question marks:
12:45:04.443 -> __ __ ____ 12:45:04.443 -> | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ 12:45:04.443 -> | |\/| | | | \__⸮ \ / _ \ `_ \/ __|/ _ \| `__/ __| 12:45:04.443 -> | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ 12:45:04.443 -> |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ 12:45:04.476 -> |___/ 2.3.2 12:45:04.476 -> 12:45:04.476 -> 16 MCO:BGN:INIT NODE,CP=RPNNA---,FQ=8,RE⸮=255,VER=2.3.2 12:45:04.476 -> 28 T⸮M:INIT 12:45:04.476 -> 28 TSF:WUR:MS=0 12:45:04.476 -> 32 TSM:INIT:TSP OK 12:45:04.476 -> 34 TS⸮:INI⸮:ST⸮TID=1 12:45:04.476 -> 36 TSF:SID:OK,ID=1 12:45:04.476 -> 38 TSM:FPAR 12:45:04.476 -> 43 ?TSF:MSG:SEND,1-1-255-255,s=255,⸮=3,t=7,pt=0,l=0,⸮g=0,⸮t=0,st=OK: 12:45:06.499 -> 2052 !TSM:FPAR:NO REPLY
This has been soldered to the PCB:
- Arduino Pro Mini 3v
RFM69HW
Antenna
//Battery Measurement
1M Ohm
470k Ohm
1uF Capacitor
//Booster
Step up Booster(to 3v)
1uF Capacitor
Does that mean the booster is broken? Or did I use the wrong capacitor size? The easypcb says 0.1uF but I only had 1uF capacitors and I hoped it would work.
- Arduino Pro Mini 3v
-
RE: 💬 Easy/Newbie PCB for MySensors
@sundberg84 I did, thanks, I discovered ISRs. Thanks for the support.
-
RE: Arduino pro mini, rfm69 with 2 Reed switches on interrupts?
I adapted code I found online and except for a few hickups it seems to work. Thanks to anticimex for making this code available:
/* * 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 * * Interrupt driven binary switch example with dual interrupts * Author: Patrick 'Anticimex' Fallberg * Connect one button or door/window reed switch between * digital I/O pin 3 (BUTTON_PIN below) and GND and the other * one in similar fashion on digital I/O pin 2. * This example is designed to fit Arduino Nano/Pro Mini * */ // Enable debug prints to serial monitor //#define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER #define MY_NODE_ID 2 #include <MySensors.h> #define SKETCH_NAME "Briefkasten" #define SKETCH_MAJOR_VER "1" #define SKETCH_MINOR_VER "0" #define PRIMARY_CHILD_ID 3 #define SECONDARY_CHILD_ID 4 #define PRIMARY_BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch #define SECONDARY_BUTTON_PIN 8 // Arduino Digital I/O pin for button/reed switch volatile static uint8_t valueSecondary=2; // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED); MyMessage msg2(SECONDARY_CHILD_ID, V_TRIPPED); void pciSetup(byte pin) { *digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin PCIFR |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt PCICR |= bit (digitalPinToPCICRbit(pin)); // enable interrupt for the group } ISR (PCINT0_vect) // handle pin change interrupt for D8 to D13 here { //delayMicroseconds(2); valueSecondary = digitalRead(SECONDARY_BUTTON_PIN); // ISRs need to finish very fast or the arduino crashes. } void setup() { // Setup the buttons pinMode(PRIMARY_BUTTON_PIN, INPUT_PULLUP); pinMode(SECONDARY_BUTTON_PIN, INPUT_PULLUP); pciSetup(SECONDARY_BUTTON_PIN); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER); // Register binary input sensor to sensor_node (they will be created as child devices) // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. present(PRIMARY_CHILD_ID, S_DOOR); present(SECONDARY_CHILD_ID, S_DOOR); } // Loop will iterate on changes on the BUTTON_PINs void loop() { uint8_t valuePrimary; static uint8_t lastValuePrimary=2; static uint8_t lastValueSecondary=2; // Short delay to allow buttons to properly settle delay(5); Serial.println("Woken up"); valuePrimary = digitalRead(PRIMARY_BUTTON_PIN); //Serial.print("Primary value: "); //Serial.println(value); if (valuePrimary != lastValuePrimary) { // Value has changed from last transmission, send the updated value Serial.print("Primary:"); Serial.println(valuePrimary); send(msg.set(valuePrimary)); lastValuePrimary = valuePrimary; } if (valueSecondary != lastValueSecondary) { // Value has changed from last transmission, send the updated value Serial.print("Secondary:"); Serial.println(valueSecondary); send(msg2.set(valueSecondary)); lastValueSecondary = valueSecondary; } // Sleep until something happens with the sensor //sleep(PRIMARY_BUTTON_PIN-2, CHANGE, SECONDARY_BUTTON_PIN-2, CHANGE, 0); sleep(PRIMARY_BUTTON_PIN-2, CHANGE, 0); }
If anybody has some improvements I'd like to hear them! This is my first time adapting/writing C-code, so a lot could probably be better.
I noticed that sometimes the reed switch "Ignores" a change, can that happen because I moved the magnet too quickly or should I buy better switches?
Also, I tried "FALLING" in the sleep function, but it the arduino woke up on HIGH and LOW, shouldn't it only wake up on LOW?
-
RE: Arduino pro mini, rfm69 with 2 Reed switches on interrupts?
@mfalkvidd thanks, I read the thread and will try to figure out how to use this with sleep().
If anybody has any sketches with NodeManager and sleep I'd be grateful l for a link
-
Arduino pro mini, rfm69 with 2 Reed switches on interrupts?
Hi,
I am trying to build my first sensor using an arduino pro mini (3v), an rfm69hw and two Reed switches on sundbergh84s easypcb.
Its purpose is to let me know whether there is mail in my mailbox. One Reed switch sends a message when the mailman has opened the little hatch in my mailbox ->there is mail in the mail box.
The other switch sends a message when the big hatch has been opened -> mail has been collected by somebody in the family, the mailbox is empty.
To conserve battery power I planned on connecting each switch to an interrupt pin, but I realised that the rfm69hw also needs an interrupt pin...
Am I out of luck or does somebody have an idea how I can make my mailbox smart?
-
RE: 💬 Easy/Newbie PCB for MySensors
Hi,
I build a node using an easypcb rev 10 for the rfm69. I am trying to connect two door sensors to the node using pins 2 and 3. The sensor on pin 3 works flawlessly, but the one on 2 doesn't (I'd like to use the interrupts to save power).
I saw that the Nrf24l01+ version has disabled pin 2, is that the case with the rfm69 version too? If yes, is there any way to use two different pins for interrupts? I need to know which sensor has been triggered so I can't connect them in series.
Thanks for the help!
-
RE: [SOLVED] rfm69-node <-> rpi 4 gateway: !TSM:FPAR:NO REPLY
So this was either a faulty module or bad soldering. I soldered a new module and now everything works as expected. Thanks for the help!
-
RE: [SOLVED] rfm69-node <-> rpi 4 gateway: !TSM:FPAR:NO REPLY
Good catch, I didn't do that. Before I saw your message I checked the wiring and I introduced a new bug apparently because now the MQTT-gateway doesn't start anymore either, so I'll have to rewire.
I'll write again after I did that. Thanks for the help!
-
RE: [SOLVED] rfm69-node <-> rpi 4 gateway: !TSM:FPAR:NO REPLY
I tried compiling the gateway as an ethernet gateway and suddenly got this output:
pi@raspberrypi:~/MySensorsDev/MySensors $ sudo ./bin/mysgw Jan 04 21:05:11 INFO Starting gateway... Jan 04 21:05:11 INFO Protocol version - 2.4.0-alpha Jan 04 21:05:11 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,FQ=NA,REL=0,VER=2.4.0-alpha Jan 04 21:05:11 DEBUG TSF:LRT:OK Jan 04 21:05:11 DEBUG TSM:INIT Jan 04 21:05:11 DEBUG TSF:WUR:MS=0 Jan 04 21:05:11 DEBUG !TSM:INIT:TSP FAIL Jan 04 21:05:11 DEBUG TSM:FAIL:CNT=1 Jan 04 21:05:11 DEBUG TSM:FAIL:DIS Jan 04 21:05:11 DEBUG TSF:TDI:TSL Jan 04 21:05:21 DEBUG TSM:FAIL:RE-INIT Jan 04 21:05:21 DEBUG TSM:INIT Jan 04 21:05:21 DEBUG !TSM:INIT:TSP FAIL Jan 04 21:05:21 DEBUG TSM:FAIL:CNT=2 Jan 04 21:05:21 DEBUG TSM:FAIL:DIS Jan 04 21:05:21 DEBUG TSF:TDI:TSL ^CJan 04 21:05:23 NOTICE Received SIGINT pi@raspberrypi:~/MySensorsDev/MySensors $ ./configure --my-gateway=ethernet --my-port=5003
I am guessing this means my wiring is not ok? Strange that the MQTT-gateway doesn't throw the same error.
-
[SOLVED] rfm69-node <-> rpi 4 gateway: !TSM:FPAR:NO REPLY
Hi,
I am trying to build my first node using an easypcb, an arduino pro mini 3,3v and an rfm69w.
Onto the pcb I soldered:
-
rfm69
-
arduino pro mini 3,3v
-
antenna
-
door sensor on D3
-
screw terminal.
This is the sketch:
/** * 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-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/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 * * Simple binary switch example * Connect button or door/window reed switch between * digitial I/O pin 3 (BUTTON_PIN below) and GND. * http://www.mysensors.org/build/binary */ // Enable debug prints to serial monitor #define MY_DEBUG #define MY_DEBUG_VERBOSE_RFM69 // General settings #define SKETCH_NAME "Briefkasten" #define SKETCH_VERSION "1.0" #define MY_NODE_ID 1 #define MY_RFM69_NEW_DRIVER // Enable and select radio type attached //#define MY_RADIO_RF24 #define MY_RADIO_RFM69 #include <MySensors.h> #include <Bounce2.h> #define CHILD_ID 3 #define BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch Bounce debouncer = Bounce(); int oldValue=-1; // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msg(CHILD_ID,V_TRIPPED); void setup() { // Setup the button pinMode(BUTTON_PIN,INPUT); // Activate internal pull-up digitalWrite(BUTTON_PIN,HIGH); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); } void presentation() { // Register binary input sensor to gw (they will be created as child devices) // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. present(CHILD_ID, S_DOOR); } // Check if digital input has changed and send in new value void loop() { debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue) { // Send in the new value send(msg.set(value==HIGH ? 1 : 0)); oldValue = value; } }
The gateway on the raspberry pi 4 was configured like this:
./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mysensorsgateway1 --my-mqtt-user=mysensors --my-mqtt-password=secretpw --my-port=1883
This is the gateway-log:
pi@raspberrypi:~/MySensors/bin $ sudo ./mysgw Jan 04 20:12:33 INFO Starting gateway... Jan 04 20:12:33 INFO Protocol version - 2.3.2-beta Jan 04 20:12:33 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,FQ=NA,REL=8,VER=2.3.2-beta Jan 04 20:12:33 DEBUG TSF:LRT:OK Jan 04 20:12:33 DEBUG TSM:INIT Jan 04 20:12:33 DEBUG TSF:WUR:MS=0 Jan 04 20:12:33 DEBUG TSM:INIT:TSP OK Jan 04 20:12:33 DEBUG TSM:INIT:GW MODE Jan 04 20:12:33 DEBUG TSM:READY:ID=0,PAR=0,DIS=0 Jan 04 20:12:33 DEBUG MCO:REG:NOT NEEDED Jan 04 20:12:33 DEBUG MCO:BGN:STP Jan 04 20:12:33 DEBUG MCO:BGN:INIT OK,TSP=1 Jan 04 20:12:33 DEBUG GWT:RMQ:CONNECTING... Jan 04 20:12:33 DEBUG connected to 127.0.0.1 Jan 04 20:12:33 DEBUG GWT:RMQ:OK Jan 04 20:12:33 DEBUG GWT:TPS:TOPIC=mysensors-out/0/255/0/0/18,MSG SENT Jan 04 20:12:33 DEBUG TSM:READY:NWD REQ Jan 04 20:12:33 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: Jan 04 20:27:33 DEBUG TSF:SAN:OK
And this is the node-log:
21:31:23.866 -> 21:31:23.866 -> __ __ ____ 21:31:23.866 -> | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ 21:31:23.866 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| 21:31:23.866 -> | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ 21:31:23.866 -> |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ 21:31:23.866 -> |___/ 2.3.2 21:31:23.866 -> 21:31:23.866 -> 16 MCO:BGN:INIT NODE,CP=RPNNA---,FQ=8,REL=255,VER=2.3.2 21:31:23.866 -> 28 TSM:INIT 21:31:23.866 -> 28 TSF:WUR:MS=0 21:31:23.866 -> 30 RFM69:INIT 21:31:23.866 -> 32 RFM69:INIT:PIN,CS=10,IQP=2,IQN=0 21:31:23.866 -> 36 RFM69:PTX:LEVEL=5 dBm 21:31:23.866 -> 38 TSM:INIT:TSP OK 21:31:23.866 -> 40 TSM:INIT:STATID=1 21:31:23.866 -> 43 TSF:SID:OK,ID=1 21:31:23.866 -> 45 TSM:FPAR 21:31:23.899 -> 47 RFM69:SWR:SEND,TO=255,SEQ=0,RETRY=0 21:31:23.899 -> 53 RFM69:CSMA:RSSI=-106 21:31:23.899 -> 57 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 21:31:25.888 -> 2066 !TSM:FPAR:NO REPLY 21:31:25.888 -> 2068 TSM:FPAR 21:31:25.888 -> 2070 RFM69:SWR:SEND,TO=255,SEQ=1,RETRY=0 21:31:25.921 -> 2074 RFM69:CSMA:RSSI=-107 21:31:25.921 -> 2080 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 21:31:27.910 -> 4089 !TSM:FPAR:NO REPLY 21:31:27.910 -> 4091 TSM:FPAR 21:31:27.944 -> 4093 RFM69:SWR:SEND,TO=255,SEQ=2,RETRY=0 21:31:27.944 -> 4098 RFM69:CSMA:RSSI=-105 21:31:27.944 -> 4104 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 21:31:29.933 -> 6113 !TSM:FPAR:NO REPLY 21:31:29.933 -> 6115 TSM:FPAR 21:31:29.966 -> 6117 RFM69:SWR:SEND,TO=255,SEQ=3,RETRY=0 21:31:29.966 -> 6121 RFM69:CSMA:RSSI=-106 21:31:29.966 -> 6127 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 21:31:31.955 -> 8136 !TSM:FPAR:FAIL 21:31:31.955 -> 8138 TSM:FAIL:CNT=1 21:31:31.955 -> 8140 TSM:FAIL:DIS 21:31:31.955 -> 8142 TSF:TDI:TSL 21:31:31.955 -> 8142 RFM69:RSL 21:31:41.968 -> 18145 TSM:FAIL:RE-INIT 21:31:41.968 -> 18147 TSM:INIT 21:31:41.968 -> 18149 RFM69:INIT 21:31:42.001 -> 18151 RFM69:INIT:PIN,CS=10,IQP=2,IQN=0 21:31:42.001 -> 18155 RFM69:PTX:LEVEL=5 dBm 21:31:42.001 -> 18157 TSM:INIT:TSP OK 21:31:42.001 -> 18161 TSM:INIT:STATID=1 21:31:42.001 -> 18163 TSF:SID:OK,ID=1 21:31:42.001 -> 18165 TSM:FPAR 21:31:42.001 -> 18167 RFM69:SWR:SEND,TO=255,SEQ=0,RETRY=0 21:31:42.001 -> 18173 RFM69:CSMA:RSSI=-108 21:31:42.001 -> 18180 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 21:31:44.023 -> 20187 !TSM:FPAR:NO REPLY 21:31:44.023 -> 20189 TSM:FPAR 21:31:44.023 -> 20191 RFM69:SWR:SEND,TO=255,SEQ=1,RETRY=0 21:31:44.056 -> 20195 RFM69:CSMA:RSSI=-104 21:31:44.056 -> 20201 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 21:31:46.045 -> 22210 !TSM:FPAR:NO REPLY
Does anybody know what I am doing wrong?
-
-
RE: 💬 Air Humidity Sensor - Si7021
I had the problem that the code wouldn't return when calling sensor.getCelsiusHundredths() while using the linked library. It works with this library:
-
RE: 💬 Easy/Newbie PCB (RFM69 HW/W edition) for MySensors
Could you add a 5 pieces option? The reason is the danish customs slaps an additional "fee" of ~24eu on imports over 12eu from china.
PCBway let's you choose 5 pieces on their website.
I tried using the gerber files but before I can upload them there is a host of settings which I don't know how to set.
-
RE: 💬 Easy/Newbie PCB (RFM69 HW/W edition) for MySensors
I ordered the 3rd of september (paypal mail says this: tirs. 03. sept. 2019 13:04:13 CEST (UTC+2)), are there any orders around that time?
-
RE: 💬 Easy/Newbie PCB (RFM69 HW/W edition) for MySensors
Has anybody any experience with pcbway? I ordered via the link provided here (7 weeks ago) and only received a message from paypal. I haven't gotten a tracking number and pcbway says they can't help me without an ordernumber (which I don't have).
-
RE: Which battery measurement to use?
If you don't mind me asking here: Will the booster disturb the rfm69? The page about battery driven sensors only mentions the NRF24l01+. Should I power the rfm69 straight from the battery? Or will the 0,1uF ceramic capacitor be enough? It seems like using the booster on the radio would be smart since the node will run for longer on the same set of batteries, if I am not mistaken.
-
RE: Which battery measurement to use?
I am planning on using a booster, so that's very good to know, thanks!
-
Which battery measurement to use?
Hi,
I am looking into building a battery powered door sensor and I am not sure how to measure the battery.
There seem to be two methods, one using two resistors and another one here which doesn't.
It's less work to not use the two resistors, but I was wondering whether there are drawbacks to this method and whether I should use the one with the two resistors?
I hope somebody can shed some light on that
Thanks!
-
RE: 💬 Building a Raspberry Pi Gateway
I can confirm that the code compiles and runs on my rasbperry pi 4 model b. I am using a rfm69 radio and that seems to be working too. I couldn't test it yet though since I haven't wired any rfm69 nodes up yet.
-
EasyPCB and rfm69: Do I need a DC/DC step up booster
Hi,
I am trying to build a battery driven door sensor using EasyPCB and a RFM69 radio.
The linked documentation says you should use a DC/DC step up booster, but here says the booster creates a lot of noise that disturbs the radio.
Do the newer EasyPCB revisions take this into account but the documentation has not been updated? Or should I attach a step up booster (those, maybe?) and hope for the best?
Thanks!
-
Raspberry Pie 4, RFM69 - Noobie questions
Hi,
I hope it's ok to open these types of posts here.
I would like to use openHab on an Raspberry Pie 4, I decided on a RFM69HCW (868MHz) transmitter because those seem to have a good range (Admittedly I don't need all that range because I life in a small flat, but it would be nice to be future-proof).
I figured I could build good and cheap (battery driven) sensors with some Arduino Pro Minis, EasyPCBs and other RFM69 transmitters.
Is this a good setup? Or should I change anything?
About attaching the RFM69HCW to the RPi4: This is probably the easiest way to attach the RFm69 to the Pie, right?
If I got the documentation here right then the mysensors library is all I need to run the RFM69 on the Pie, correct?
Thanks for the help!