@rene-mullie if im not mistaken that file is to configure mqtt v1 and your using mqtt v2
Posts made by jimmy loyens
-
RE: Getting MySensors MQTT Gateway working on OpenHAB 2.2 (Stable)
-
RE: Getting MySensors MQTT Gateway working on OpenHAB 2.2 (Stable)
Hi @rene-mullie,
Seems like the mysensors binding mqtt gw doesnt play nice with the mosquitto broker. You can try running the embedded broker of openhab (paperUi->addons->misc->embedded broker i beleive). Dont forget to configure it under services->misc (not shure since im on my phone right now). And connect your mqtt gateway to this broker. I was not succesful in this because i need the embedded broker on port 1884 since i allready have mosquitto on port 1883 for other stuff. And i <think> mysensors mqtt gateway doesnt want to connect to 1884 but 1883. But you can give it a try. If you have ethernet gateway going and dont have plans to use different controllers (for example to do FOTA updates) i would stick to the ethernet gw for now. Greets
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@waspie I think the embedded broker connects to 1884 since i can see the messages from my nodes. But you might be right that mysensors is connecting to the wrong broker/port. Allso noticed the embedded broker is really slowing down my RPI3. Just uninstalled it and everything speeds up again Guess i have to wait till everything can connect to mosquitto
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@timo Hi Tomo.
Both the embedded broker thing and the mqtt gateway are online, i can see the mqtt messages in the logvieuwer but i cant discover nodes. I should say i have mosquitto running on port 1883 (for my milight hub) and embedded broker on port 1884. Do you think this is a problem? can i have both brokers on 1883? btw thanks for the link
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@timo I connected to the embedded broker over port 1884
. But i cant seem to discover my nodes. This is my broker thing:mqtt:broker:embedded-mqtt-broker[host="192.168.1.2", port="1884", qos=1, clientID="gateway1", reconnectTime=20000, keepAlive=60000, secure=false, username="xxx", password="yyy"]
This is my mqtt-bridge thing:
Bridge mysensors:bridge-mqtt:mygateway [brokerName="embedded-mqtt-broker", port="1884", topicPublish="mygateway1-in", topicSubscribe="mygateway1-out", startupCheckEnabled=false]{ }
Its weird because i can see the messages from the nodes coming in in the log vieuwer (mysensors binding is in TRACE).
2019-02-06 16:47:14.968 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/0' : 87 2019-02-06 16:47:14.971 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:14.990 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/1/1/0/1' : 37.2 2019-02-06 16:47:14.993 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/1/1/0/1' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:15.024 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:47:15.028 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:26.746 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:47:26.748 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:34.072 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:34.075 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:37.114 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:37.116 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:38.438 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/1/1/0/1' : 37.3 2019-02-06 16:47:38.441 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/1/1/0/1' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:38.459 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:47:38.462 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:40.157 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:40.160 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:43.224 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:43.226 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:50.169 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:47:50.172 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:56.542 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:56.545 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:59.582 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:59.585 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:01.876 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:01.879 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:02.648 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:02.653 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:05.680 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:05.682 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:13.580 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:13.583 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:25.308 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:25.312 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:25.454 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:25.458 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:28.486 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:28.489 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:31.551 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:31.553 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:34.585 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:34.588 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:37.006 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/1/1/0/1' : 37.2 2019-02-06 16:48:37.008 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/1/1/0/1' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:37.039 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:37.042 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:44.873 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:44.875 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:47.916 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:47.919 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:48.720 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/3/1/0/23' : 31 2019-02-06 16:48:48.722 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/3/1/0/23' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:48.744 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/2/1/0/0' : 22.7 2019-02-06 16:48:48.746 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/2/1/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:48.762 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/1/1/0/1' : 37.3 2019-02-06 16:48:48.764 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/1/1/0/1' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:48.786 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:48.788 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:50.971 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:50.973 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:54.038 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:54.044 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]*
And can you point me to the docs on how to setup the binding ? I found them before but cant seem to find them anymore.
Thanks
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@timo thanks for the update. I will try it as soon as i get the chance. Thanks
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@masmat Hi, I think @TimO is looking into it. Ethernet and serial gateway work as expected with mysensors binding. My guess it has something to do with new MQTT-binding.
-
OTA update mechanism with MYSbootloader
Hello,
Can someone pls explane to me how the mechanics of OTA updates works with MYSbootloader.
What happens when node with MYSbootloader first starts after reset? Does bootloader make contact with gateway? ....I constantly see this message go from gateway to node:
107;255;4;0;2 0100002006b05FFFFF....F
And from node to gateway:
107;255;4;1;3 0100002007005B2C70103
Is this the process of OTA updating?
According to serial protocol doc Cmd=4 means stream so it has to do with OTA. There is nothing more documented in the serial protocol docs about Cmd=4 or about what happenes when a node with MYSbootloader starts up. Maybe one of the developers can shine a light on this? Or perhaps someone competent enough to read and understand the bootloader code (not me ).
Today i had 3 nodes running that where successfully programmed OTA (MYSbootloader). When resetting one node, it didn't manage to restart (stuck in bootloader?). When resetting node nr 2, same thing. I then programmed node 1 with ftdi (is this even possible with MYSbootloader?), At this moment node 2 came online. I've been looking all over the forum but i can find very little about MYSensors OTA mechanics. Like what are the different types in the stream messages? For instance: nodeID/255/4/0/32. I suspect 255 means broadcast in this message and pretty shure type=32 means pre or post sleep, but how does it all fit together?
Is there a clear discription of the steps a OTA update goes thru in order to get the sketch into the node?
I found this on the git page of MYSfirmware "https://github.com/mysensors/MySensorsBootloaderRF24/blob/development/README.md".
I assume this happenes at startup of the node. Still would like some info on message types for stream messages (cmd=4)
Ok, finally found some info on message types here https://github.com/mysensors/MySensorsBootloaderRF24/blob/development/MyMessage.h
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@jimmy-loyens stuff in itallics i'm not absolutely shure about or are remaining problems. Anyone feel free to add or correct anything
While writing this tutorial my node went offline
So it might be i have to add some more to the tutorial lateron
Seems to be a problem with MYController because i can still see node trying to communicate over mqtt.I see its my sh***ty router acting up again, even my internet went down just now.
It seems that somehow the firmware on my node got corrupted, when connecting it to a serial monitor it didn't output anything. When looked on MQTT.fx at the messages node and GW where continiously exchanging "stream messages. Then i flashed the node the oldfashioned way and now its all up again. Still trying to find out what happened exactly.
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@mfalkvidd
Only for MYSbootloaderFirst off know that the bootloader needs to be compiled for the right clock-mode (internal osc/RC-osc/Xtal) and for the RF channel the node is going to be used in. You can build your own bootloader from the source at https://github.com/mysensors/MySensorsBootloaderRF24 or use a precompiled bootloader from https://github.com/guillebot/MYSensors-Bootloaders with thanks to @Guillermo-Schimmel .
Next make sure you have the right driver for the USBASP installed. Like the video on https://www.mysensors.org/about/fota suggests use Zadig (https://zadig.akeo.ie/) for this. The driver may be dependent on your operating system (I'm using Win10 and libusbK (v3.0.7.0) works for me). If u use the wrong driver it may be possible to read and write the fuses but burning the bootloader will fail!
Make sure you are using the right fuses for your board. If not you may even potentially brick your board (i.e. if you dont have a Xtal on your board and use the internal oscillator but do burn the fuses to use a Xtal you will have to solder a Xtal to your board to reflash the right fuses because otherwise the ยตC wont have a clocksource)[not sure if this is 100% correct] If you don't know how to set the fuses correctly for your board use a fuse calculator like this http://www.engbedded.com/fusecalc/. If you dont know the meaning of some of the fuses you can look them up in the datasheet of ATmega328P.
Now you can open AVRDUDESS to first check the connection of yourUSBASP and then burn the fuses. First connect your board to USBASP and click on detect. AVRDUDESS should indicate the MCU is a ATmega328p (even if its a arduino clone). You can either burn your fuses seperately by filling them in in the "fuses and lockbits" frame and clicking write (leave the lockbits alone or you might brick your MCU) or burn them together with your bootloader (if you use AVRDUDESS for bootloader) by filling in the bits and ticking the set fuses box. When burning the bootloader the fuses will be burnt first.
For burning the bootloader you have 2 options. You can either burn the bootloader using the arduinoIDE like explained in the video but i prefer using AVRDUDESS (less hassle with editing the boards.txt file and adding the bootloaders to the right arduino directory). To burn the bootloader with AVRDUDESS just drag and drop the right bootloader into the "flash" textbox of AVRDUDESS, make shure the radio button for write is active and hit go. Tadaa!!! the bootloader is burnt.
Now you can program your board (the good oldfashioned way) with a MySensors sketch using the same RF-channel as the bootloader. Make shure your gateway is allso programmed with the same RF-channel as the first thing the node (bootloader) does after booting is connecting to the gateway. This means your gateway needs to be online before the node can execute its sketch [pretty shure about this but not completely It will take the MYSbootloader a little longer to run then the stock bootloader so don't panic when you don't see anything in serial monitor at first, it should be coming.
==> With mys bootloader burnt its no longer possible to program node in "the old fashioned way" (using arduino IDE and serial connection). All updates must be made OTA!When you get output in serial monitor its time to install MYController (not the same as MYSController!). You can start the service by running "mycontroller/bin/start.bat" on windows or entering "./start.sh" on linux. Here is a (outdated) doc on MYController https://www.mycontroller.org/#/documents/user/1.4.0.Final.html. Now open a browser and go to deviceIP:8443 and log in to MYController with username:admin, password:admin. Under resources=>gateway enter the gateway setup you use for MySensors, and be shure to select MySensors under network type. Now you can enable your gateway in the table, select it and go to actions in the top right. There select discover. Now your nodes should be discovered automaticly. You can check this by looking under resources=>nodes. If not you can look under status=>resource logs to debug what's going on.
To be able to do FOTA updates you need a .hex file of your sketch. You can do this by adding "build.path=C:\Arduino-Output" to the bottem of your arduino "preferences.txt" file (see https://www.mysensors.org/about/fota)[but this file seems to be deleted every time arduino starts!], load the desired sketch in the arduinoIDE, make shure the right board is connected and click verify. Now the .hex file should be in your C:\Arduino-Output\ folder.
Now the part we've all been waiting for, the FOTA update! Under utilities=>firmware on the top right select "types" and add a type of node, then select version and add a version. After this you can select firmware and choose a hex file you compiled earlier. Go back to resources=>nodes, select your node you want to update, click actions=>edit. Here you can appoint a firmware, type and version to your node. hit save! Back in the nodes window select the same node go to actions=>upload firmware. Your first FOTA update should be underway.
-
RE: Arduino pro mini dead after flashing MYSbootloader.
From Mysensors FOTA site:
1)Keep this file opened and close Arduino ide (otherwise your changes will be erased).
2)In preferences.txt, at the end, add this
build.path=C:\Arduino-Output
or another preferred path. That will be the output folder for your .hex compiled sketch files. Close the dialog box.I noticed that file gets reset to default (meaning added line disappears from file) on opening arduinoIDE!!!!
Has anyone else noticed this? Does anyone know how to remedy this?
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@mfalkvidd I will rty to write some stuff down but some details i'm not sure off myself so it would be nice if other people can revieuw the text for errors or inaccuracies. Do I just put it down here on the forum or in a file?
@Guillermo-Schimmel can i refer to your github page with bootloader flavors?
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@guillermo-schimmel Yes indeed, no more running around with laptop and cables
Thanks again for the help and the bootloaders
-
RE: Arduino pro mini dead after flashing MYSbootloader.
And BOOM it works!!!!
I just did my first FOTA update
Thanks to everyone who helped
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
If I can do anything to help please let me know
-
RE: Arduino pro mini dead after flashing MYSbootloader.
Ok, update:
When i look in MYController under "status=>resources logs" i can see the node continuously requesting firmware config, so i'm 100% shure the bootloader is good. I'm just not shure what's supposed to happen now from my side. I tried uploading firmware to the node OTA using "resources=>nodes=>actions=>upload firmware" but this doesn't seem to succeed and doesn't show up in the resources logs.
But atleast i have some new queries to google
In MQTT.fx I can allso see the node constantly sending: "mygateway1-out/1/255/4/0/0 FFFFFFFF68057A890103"
But if i see this correctly this would mean for node1 child255 Cmd=stream(OTA) Ack=0 Type=0(Dont know what 0 is in stream)Strange because my node has nodeID 107.
Ok on closer inspection i can see in the resources log that the firmware config request comes from node1, so i tried updating firmware OTA of node 1, now i get a firmware config response inresources log.
UPDATE:
loaded the program back onto the node (changed batery level child from 0 to 255). Now node shows up with correct node ID in mycontroller. And now i get some output in serial monitor too, wich wasn't the case before. -
RE: Arduino pro mini dead after flashing MYSbootloader.
@jimmy-loyens Seems like i didn't need to add the define:
"@tlustoch You need to enable MY_OTA_FIRMWARE_FEATURE only if you use DualOptiBoot.
With MYSBootloader, you don't needI use MYSBootloader 1.3 pre-release with mysensors 2.0. You can find it here : https://forum.mysensors.org/topic/3453/mysbootloader-1-3-pre-release-myscontroller-1-0-0beta
And yes it usable with 8 MHZ internal clock config if you burn the bootloader with 8Mhz internal clock setting."
EDIT:
Removing "MY_OTA_FIRMWARE_FEATURE" was not the solution -
RE: Arduino pro mini dead after flashing MYSbootloader.
@jimmy-loyens Ok, this answers the question about the E fuse:
"
That's why :0x06 = 00000110
0xFE = 11111110
are doing the same job for the extended fuse. It depends of the tool you use for burning this fuse. Simply, if you get this warning, use the "equivalent".
" -
RE: Arduino pro mini dead after flashing MYSbootloader.
Now i used the 8MHz external Xtal bootloader for RFchannel 5 (GW is on channel 5) that i got from @Guillermo-Schimmel (thanks again) to flash onto my arduino pro mini using avrdudess (less hassle with editing boards.txt file of arduinoIDE), but still same result.
I think mr bootloader is working though because the onboard led of the node behaves like this:
(node power on) 10101-000000000000000000-10101-0- 1111111111111111111111-0-1111111111111111111111-0-1111111111111111111111-0-1111111111111111111111-0-... (GW online)-11111111111111111111111111111111111111111111111111111111111111111111...
So as long as GW is not online the led stays on for long period then goes off for very short period (i think its looking for the gateway), once GW comes online the onboard led of the node stays on (node has seen gateway online). If i unpower the GW at this point the node onboard led stays on until i reset node.
It looks like the bootloader is working and detects the GW comming online, but for some reason it doesnt jump on to the programmemory.
I have the node programmed with mysensors sketch on RFchannel 5 and GW with mqtt client on RF-channel 5. Added "#define MY_OTA_FIRMWARE_FEATURE" for both node and GW (even though i think its not nessecairy for the GW). are there any other defines i should add to the sketch(es)?
@Guillermo-Schimmel I have some more questions for you:
-Where the bootloaders compiled with the standard spi pins, being: "#define SPI_PINS_CE9_CSN10"
-It says in the make file on github (MYSbootloader): "ISP_EFUSE = 06" but I cant seem to set the E fuse like this. For me only possible values are: F8/F9/FA/FB/FC/FD/FE/FF (this is probably not the problem because this only sets brown-out bits, just curious)
-Did you allso have this problem when starting to use MYSbootloaderI'll keep trying and searching
Maybe another channel will help.
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@guillermo-schimmel wow thanks alot, saves me alot of searching and work. Thanks
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@mfalkvidd what software did you use for this? (I'm on win10 pc, not linux) I'm downloading avr studio right now, dont know if its possible with this software. I have never done anything like this. But hey there is a first time for everything.
I have read on the forum and github that @Guillermo-Schimmel has successfully compiled the MYSbootloader for 8MHz. I'll try asking him for some clues.
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@yveaux do you know what development ide i have to use to compile the bootloader? i cant find anything with google on this. I allready found where to change the RF channel in the source but i have no idea how to compile it into a hex file. Tried vs code but i probably have to install another extention
-
RE: Arduino pro mini dead after flashing MYSbootloader.
I found this on the forum:
"In the process of troubleshooting I found out that MYSBootloader needs to be compiled with the same channel settings as the gateway it connects to. "I think this is most likely the problem since i'm currently using a test-network with channel 5. I'll try changing the channel in the bootloader source and recompiling it.
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@jimmy-loyens Ok problem,
My bootloader hex is 6Kb = 6000b = 3000 wordsBOOTZ1|BOOTZ0
11=>256words = 512b
10=>512words = 1024b
01=>1024words = 2048b
00=>2048words = not enoughAm i understanding this correct?
Choosing the largest bootzone combination (11) didn't help
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@jimmy-loyens ok found this: https://forum.arduino.cc/index.php?topic=70208.0
Now i only need to find out how big my bootloader is. I assume the size of the hex file.
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@yveaux sorry but "huh?"
This is my first time trying ota, before i knew about the existance of bootloaders but thats about it. Dont meen to offend you but could you elaborate a bit
-
Arduino pro mini dead after flashing MYSbootloader.
After flashing node with MySensors bootloader i can still flash the node with ftdi but sketch no longer runs. Tried it with blink sketch. Does uploading the bootloader alter the fuses? I dont know whats going on
when plugged into my board the led on the arduino just stays on, when i pull the pro mini out of the board and reset (while connected to ftdi) it blinks in cycles of 3x slow and 4x fast. As soon as i insert it in the node it goes to steady on. I know the board is good because a board with factory bootloader runs the sketch just fine. Can someone shine a (led)light on this
When i flash the original bootloader again everything works as expected. What am i missing here?
-
Get periodical sensor readings from children 1 & 2 while sensor on child 3 is interrupt driven.
Hello,
I have a bunch of sensornodes that measure battery level, humidity, temperature and lightlevel. The lightlevel measurement is interrupt driven. If the lightlevel differs more than a given amount from the last reading (for x integration times) the interrupt triggers and the lightlevel value is transmitted. Now here comes the problem, there are times the lightmeasurement triggers so often that the other sensor readings dont get transmitted (or even measured). Say sleep value is 10 min (every 10 min report battery voltage, humidity and temperature) and the light measurement triggers every 5min (this is not a constant) by interrupt. This meanes the code arrives at sleep for 10 min everytime the light interrupt is triggered and so never doing the measurement for battery level, humidity and temperature. Does anyone have an idea how to solve this? I know the millis counter doesn't run while in sleep so this is not an option. What i did for now is send all sensorvalues when light interrupt is triggered but this is a waste of battery since battery level, humidity and temperature dont change that fast. I guess it is allso possible to trigger these three measurements from the controller every 10 min or use a RTC on the node but i would really like to find a sollution in firmware only, since i have about 50 pcb's left for this node (so i cant go adding RTC).Any ideas are welcome
-
RE: Is it necessairy to use child id when requestin battery level or sketch name ... ?
@sindrome73 Hi, shure you can bother me, happy to finaly help someone else (instead of asking help myself ).
I dont really understand your quote since i dont speak spanish but i gues its a quote of my message.I just recently started playing with setting and requesting values so if someone (with more experiance) sees something wrong with what im writing here, feel free to correct me.
Im using a mqtt gateway to communicate with my nodes. I have found i can use mqtt messages to set or clear a relay on a node withe the relay sketch (https://www.mysensors.org/build/relay) flashed to it by sending "mygateway1-in/nodeID/childID/Cmd/Ack/Type Payload" over MQTT. The "mygateway1-in" is the mqtt-topic for messages going to the node. (see this sketch for mqtt gateway https://www.mysensors.org/build/mqtt_gateway). The same should be possible using a serial gateway by sending "nodeID;childID;Cmd;Ack;Type;Payload" in the arduino serial monitor or any other terminal program (but i havent tried it with serial yet). Depending if payload is 1 or 0 the relay will turn on or off. You will notice in the relay sketch there is a function receive(). This is where the message to the node is interpreted and the state of the relay is set.
The meaning of Cmd, Ack, Type and payload can be found here https://www.mysensors.org/download/serial_api_20. So when i want to turn the relay on on node 100 child 50 i actually send: "mygateway1-in/100/50/1/1/2 1", for turning it off i will send: "mygateway1-in/100/50/1/1/2 0". Notice in this case Cmd is 1 because we want to "SET" a value, and Type is 2 because it is a "binairy status". (see https://www.mysensors.org/download/serial_api_20). The same can be done for internal messages like requesting battery level or sketch name:
Battery level => I_BATTERY_LEVEL => "mygateway1-in/100/50/3/1/1" => node returns battery level.
Notice: Cmd=3 => internal message; Type=1 => I_BATTERY_LEVEL; Payload is empty => not setting anythingSketch name => I_SKETCH_NAME => "mygateway1-in/100/50/3/1/11" => node returns sketch name
Notice: Cmd=3 => internal message; Type=11 => I_SKETCH_NAME; Payload is empty => not setting anythingSame is true when requesting a sensor value, for example a temperature connected on child 12 of node 3:
temperature => V_TEMP => "mygateway1-in/3/12/2/1/0" => node returns temperature
Notice: Cmd=2 => Request; Type=0 => V_TEMP; Payload is empty => not setting anythingAllso when setting a value other than for a relay, for example setting color of a RGB led on child 55 of node 47:
rgb value => V_RGB => "mygateway1-in/47/55/1/1/40 0xffffff" => sets rgb ledcolour to white
Notice: Cmd=1 => Set; Type=40 => V_RGB; Payload = 0xffffff => the value for r,g & b (in this case white)You can know wich Type value to use by looking in the sketch how the child is presented in present() function (S_HUM, S_TEMP, S_DOOR, ...) and looking up the appropreate V_value in the next table. (see https://www.mysensors.org/download/serial_api_20).
Last remarque, the user (YOU) is responsible to write the code in the receive() function to handle incomming messages for the various types. You will notice in the relay sketch this is only done for V_STATUS because the sketch only has one type presented as S_BINARY. If your node has multiple children of various types you will have to expand your receive() function for any type you would like the node to receive messages from. If you make different functions for each type as you go allong and place these in the receive() function you should be able to re-use these functions in other sketches.
I hope this helps, let me know how you get on
Greets -
RE: Is it necessairy to use child id when requestin battery level or sketch name ... ?
@mfalkvidd ok thanks. I originally had my nores setup to periodicly send battery level over child 0. Its more logical to have it send over child 255 then.
You say normally on child 255 but isnt the user responsible to set this up in the receive function? Or am i missing something?
Thanks
-
Is it necessairy to use child id when requestin battery level or sketch name ... ?
Hello, I just learned how to request values from a node. When requesting a temperature or another sensor reading its logical to let the node respond via the child of the sensor in question. But what if requesting an internal message like sketch name (I_SKETCH_NAME) or battery level (I_BATTERY_LEVEL) or something like that. Then do you use a random child id or can it be done without? I just use something like child 100, but was just wondering if this is the right way to do it.
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@guillermo-schimmel said in OpenHAB Mysensors binding 2.4: cant get mqtt gateway online:
bundle:list|grep My
openhab> bundle:list|grep My 263 x Active x 80 x 2.4.0.201812040738 x MySensors Binding openhab>
yes, its active. but for some reason it looks different
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@guillermo-schimmel I will give it a try, thank you very much for all your efford. I think i will be needing a little brake right now so since its snowing over here i'll go sleeing with my doughter then start over fresh.
Thanks again
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@guillermo-schimmel Dont worry about it you tried! Do you know who that is?
Where can i find "openhab caches"
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@jimmy-loyens I allso have no problem publishing messages to the broker from MQTT.fx.
I currently have no actuator nodes, only sensor nodes so i cant see if gateway sends message on to nodes.If i just send message: "mygateway1-in/170/4/1/0/16 0" to a node that has a door contact on child 4, should this message show up in the serial monitor?
otherwise i can reflash the node with a relay sketch
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@jimmy-loyens And everything logged for mysensors binding:
2019-01-22 15:39:45.027 [DEBUG] [org.openhab.binding.mysensors ] - BundleEvent STARTING - org.openhab.binding.mysensors 2019-01-22 15:39:45.130 [DEBUG] [org.openhab.binding.mysensors ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=507, service.bundleid=263, service.scope=bundle, component.name=org.openhab.binding.mysensors.factory.MySensorsHandlerFactory, component.id=341} - org.openhab.binding.mysensors 2019-01-22 15:39:45.143 [DEBUG] [org.openhab.binding.mysensors ] - BundleEvent STARTED - org.openhab.binding.mysensors 2019-01-22 15:40:38.064 [TRACE] [sors.factory.MySensorsHandlerFactory] - Creating handler for thing: mysensors:bridge-mqtt:gateway2 2019-01-22 15:40:38.090 [hingStatusInfoChangedEvent] - 'mysensors:bridge-mqtt:gateway2' changed from UNINITIALIZED to INITIALIZING 2019-01-22 15:40:38.106 [DEBUG] [nsors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge 2019-01-22 15:40:38.158 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist. 2019-01-22 15:40:38.163 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Cache (given_ids) content: [0, 11, 107] 2019-01-22 15:40:38.194 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Enabling connection watchdog 2019-01-22 15:40:38.197 [TRACE] [sensors.internal.event.EventRegister] - Adding listener org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@16ae66 to org.openhab.binding.mysensors.internal.event.EventRegister@c0307f 2019-01-22 15:40:38.199 [TRACE] [sensors.internal.event.EventRegister] - Adding listener org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@86c4a7 to org.openhab.binding.mysensors.internal.event.EventRegister@c0307f 2019-01-22 15:40:38.204 [TRACE] [nsors.handler.MySensorsBridgeHandler] - Registering MySensorsDiscoveryService for bridge 'gateway2' 2019-01-22 15:40:38.220 [DEBUG] [org.openhab.binding.mysensors ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=511, service.bundleid=263, service.scope=singleton} - org.openhab.binding.mysensors 2019-01-22 15:40:38.222 [ERROR] [rotocol.mqtt.MySensorsMqttConnection] - No connection to broker: mosquitto 2019-01-22 15:40:38.233 [DEBUG] [.discovery.MySensorsDiscoveryService] - Starting MySensors discovery scan 2019-01-22 15:40:38.245 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event org.openhab.binding.mysensors.internal.protocol.mqtt.MySensorsMqttConnection@c41f03 to: org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@16ae66 2019-01-22 15:40:38.252 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=0, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@16ae66 2019-01-22 15:40:38.254 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=0, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@86c4a7 2019-01-22 15:40:38.256 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=11, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@16ae66 2019-01-22 15:40:38.258 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=11, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@86c4a7 2019-01-22 15:40:38.261 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=107, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@16ae66 2019-01-22 15:40:38.263 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=107, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@86c4a7 2019-01-22 15:40:38.266 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event org.openhab.binding.mysensors.internal.protocol.mqtt.MySensorsMqttConnection@c41f03 to: org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@86c4a7 2019-01-22 15:40:38.274 [hingStatusInfoChangedEvent] - 'mysensors:bridge-mqtt:gateway2' changed from INITIALIZING to OFFLINE 2019-01-22 15:40:38.277 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [0,11,107] 2019-01-22 15:40:38.280 [TRACE] [sensors.internal.event.EventRegister] - Adding listener org.openhab.binding.mysensors.discovery.MySensorsDiscoveryService@10bffbb to org.openhab.binding.mysensors.internal.event.EventRegister@c0307f 2019-01-22 15:40:38.281 [ERROR] [rotocol.mqtt.MySensorsMqttConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:0) 2019-01-22 15:40:38.282 [DEBUG] [nsors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE!
It says "Failed connecting to bridge...next retry in 10 seconds (Retry No.:0)" but no retry is ever done to reconnect.
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@jimmy-loyens turned on TRACE logging for mqtt transport, mqtt binding & mqtt thing binding. TRACE logging was allready on for mysensors binding.
Openhab server rebooted.But gateway doesnt come online
This is everything logged about mqtt:
2019-01-22 15:39:26.350 [DEBUG] [org.eclipse.smarthome.binding.mqtt ] - BundleEvent STARTING - org.eclipse.smarthome.binding.mqtt 2019-01-22 15:39:26.420 [DEBUG] [org.eclipse.smarthome.binding.mqtt ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=482, service.bundleid=270, service.scope=bundle, component.name=org.eclipse.smarthome.binding.mqtt.internal.discovery.MqttServiceDiscoveryService, component.id=321} - org.eclipse.smarthome.binding.mqtt 2019-01-22 15:39:26.457 [DEBUG] [org.eclipse.smarthome.binding.mqtt ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory, org.eclipse.smarthome.binding.mqtt.discovery.MQTTTopicDiscoveryService}={service.id=483, service.bundleid=270, service.scope=bundle, component.name=org.eclipse.smarthome.binding.mqtt.internal.MqttBrokerHandlerFactory, component.id=322} - org.eclipse.smarthome.binding.mqtt 2019-01-22 15:39:26.483 [DEBUG] [org.eclipse.smarthome.binding.mqtt ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingActions}={service.id=484, service.bundleid=270, service.scope=bundle, component.name=org.eclipse.smarthome.binding.mqtt.action.MQTTActions, component.id=323} - org.eclipse.smarthome.binding.mqtt 2019-01-22 15:39:26.494 [DEBUG] [org.eclipse.smarthome.binding.mqtt ] - BundleEvent STARTED - org.eclipse.smarthome.binding.mqtt 2019-01-22 15:39:26.514 [DEBUG] [lipse.smarthome.binding.mqtt.generic] - BundleEvent STARTING - org.eclipse.smarthome.binding.mqtt.generic 2019-01-22 15:39:26.598 [DEBUG] [lipse.smarthome.binding.mqtt.generic] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=485, service.bundleid=271, service.scope=bundle, component.name=org.eclipse.smarthome.binding.mqtt.generic.internal.discovery.HomeAssistantDiscovery, component.id=324} - org.eclipse.smarthome.binding.mqtt.generic 2019-01-22 15:39:26.626 [DEBUG] [lipse.smarthome.binding.mqtt.generic] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.type.ChannelTypeProvider, org.eclipse.smarthome.core.thing.type.ChannelGroupTypeProvider, org.eclipse.smarthome.binding.mqtt.generic.internal.generic.MqttChannelTypeProvider}={service.id=486, service.bundleid=271, service.scope=bundle, component.name=org.eclipse.smarthome.binding.mqtt.generic.internal.generic.MqttChannelTypeProvider, component.id=325} - org.eclipse.smarthome.binding.mqtt.generic 2019-01-22 15:39:26.643 [DEBUG] [lipse.smarthome.binding.mqtt.generic] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=487, service.bundleid=271, service.scope=bundle, component.name=org.eclipse.smarthome.binding.mqtt.generic.internal.discovery.Homie300Discovery, component.id=326} - org.eclipse.smarthome.binding.mqtt.generic 2019-01-22 15:39:26.665 [DEBUG] [lipse.smarthome.binding.mqtt.generic] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.type.DynamicStateDescriptionProvider, org.eclipse.smarthome.binding.mqtt.generic.internal.generic.MqttChannelStateDescriptionProvider}={service.id=488, service.bundleid=271, service.scope=bundle, component.name=org.eclipse.smarthome.binding.mqtt.generic.internal.generic.MqttChannelStateDescriptionProvider, component.id=327} - org.eclipse.smarthome.binding.mqtt.generic 2019-01-22 15:39:26.700 [DEBUG] [lipse.smarthome.binding.mqtt.generic] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=489, service.bundleid=271, service.scope=bundle, component.name=org.eclipse.smarthome.binding.mqtt.generic.internal.MqttThingHandlerFactory, component.id=328} - org.eclipse.smarthome.binding.mqtt.generic 2019-01-22 15:39:26.722 [DEBUG] [lipse.smarthome.binding.mqtt.generic] - BundleEvent STARTED - org.eclipse.smarthome.binding.mqtt.generic 2019-01-22 15:40:38.064 [TRACE] [sors.factory.MySensorsHandlerFactory] - Creating handler for thing: mysensors:bridge-mqtt:gateway2 2019-01-22 15:40:38.090 [hingStatusInfoChangedEvent] - 'mysensors:bridge-mqtt:gateway2' changed from UNINITIALIZED to INITIALIZING 2019-01-22 15:40:38.115 [DEBUG] [org.eclipse.smarthome.binding.mqtt ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingActions}={service.id=510, service.bundleid=270, service.scope=singleton} - org.eclipse.smarthome.binding.mqtt 2019-01-22 15:40:38.130 [hingStatusInfoChangedEvent] - 'mqtt:broker:mosquitto' changed from UNINITIALIZED to INITIALIZING 2019-01-22 15:40:38.194 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Enabling connection watchdog 2019-01-22 15:40:38.197 [hingStatusInfoChangedEvent] - 'mqtt:broker:mosquitto' changed from INITIALIZING to OFFLINE 2019-01-22 15:40:38.222 [ERROR] [rotocol.mqtt.MySensorsMqttConnection] - No connection to broker: mosquitto 2019-01-22 15:40:38.245 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event org.openhab.binding.mysensors.internal.protocol.mqtt.MySensorsMqttConnection@c41f03 to: org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@16ae66 2019-01-22 15:40:38.266 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event org.openhab.binding.mysensors.internal.protocol.mqtt.MySensorsMqttConnection@c41f03 to: org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@86c4a7 2019-01-22 15:40:38.274 [hingStatusInfoChangedEvent] - 'mysensors:bridge-mqtt:gateway2' changed from INITIALIZING to OFFLINE 2019-01-22 15:40:38.281 [ERROR] [rotocol.mqtt.MySensorsMqttConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:0) 2019-01-22 15:40:38.368 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.2' with clientid openHAB2 and file store '/var/lib/openhab2/mqtt/192.168.1.2' 2019-01-22 15:40:38.386 [TRACE] [ternal.TopicSubscribeMultiConnection] - Found suitable bridge mqtt:broker:mosquitto for listing to topic homie/+/$homie 2019-01-22 15:40:38.388 [TRACE] [ternal.TopicSubscribeMultiConnection] - Found suitable bridge mqtt:broker:mosquitto for listing to topic homeassistant/# 2019-01-22 15:40:38.407 [TRACE] [.transport.mqtt.MqttBrokerConnection] - subscribeRaw message consumer for topic 'homeassistant/#' from broker '192.168.1.2' 2019-01-22 15:40:38.413 [TRACE] [.transport.mqtt.MqttBrokerConnection] - subscribeRaw message consumer for topic 'homie/+/$homie' from broker '192.168.1.2' 2019-01-22 15:40:38.424 [hingStatusInfoChangedEvent] - 'mqtt:broker:mosquitto' changed from OFFLINE to ONLINE```
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@guillermo-schimmel I allready have TRACE on for mysensors binding, i will turn it on for mqtt to (if i can find bundle name). Do you mean reboot openhab server? No problem that will be reboot nr167 for today
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@guillermo-schimmel No I had not noticed thanks. Corrected it but so far GW stays offline. I have deleted and restarted these files so often over the past coupple of days, this was a fresh file from today
just did a global search in my files, this was the only occurrence of the misspelling
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@guillermo-schimmel Hi guilleromo, thanks for staying with me.
I have a broker setup and online,
mqtt:broker:mosquito [ host="192.168.1.2", port=1883, qos=1, clientID="openHAB2", reconnectTime=20000, keepAlive=60000, secure=false, username="openhabian", password="xxxx" ]
If i create a thing for the gateway i can see the gateway in paperUI but i cant managet to get it online
Bridge mysensors:bridge-mqtt:gateway2 [ brokerName="mosquitto", username="openhabian", password="xxxx", topicPublish="mygateway1-in", topicSubscribe="mygateway1-out", startupCheckEnabled=false ]
(This line probably looks formilliar, its the same you use with addition of username & password)
In the log it says: "No connection to broker: mosquitto" and i think this is the whole problem since i can see the messages from the gateway appearing on mosquitto when i do:
"mosquitto_sub -u openhabian -P y -p 1883 -v -t 'mygateway1-out/#'"
i can allso see the messages on my phone using an mqtt client perscribing to the same topic. But i'm downloading mqtt.fx as i type
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@jimmy-loyens It seems like the MQTT-gateway thing doesn't connect to mosquitto, I should mention i have the espMiLight binding running wich allso goes over mqtt (wich does connect to mosquitto). When i look in the mosquitto logs i can see the espMiLight bridge connect from IP of openhab but i never see MySensors bridge connect to mosquitto:
[13:15:53] openhabian@openHABianPi:~$ mosquitto -p 1883 -v 1548159358: mosquitto version 1.4.10 (build date Wed, 17 Oct 2018 19:03:03 +0200 ) starting 1548159358: Using default config. 1548159358: Opening ipv4 listen socket on port 1883. 1548159358: Opening ipv6 listen socket on port 1883. 1548159358: New connection from 192.168.1.4 on port 1883. 1548159358: New client connected from 192.168.1.4 as mysensors-1 (c1, k15, u'ope nhabian'). 1548159358: Sending CONNACK to mysensors-1 (0, 0) 1548159358: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/0 /255/0/0/18', ... (5 bytes)) 1548159358: Received SUBSCRIBE from mysensors-1 1548159358: mygateway1-in/+/+/+/+/+ (QoS 0) 1548159358: mysensors-1 0 mygateway1-in/+/+/+/+/+ 1548159358: Sending SUBACK to mysensors-1 1548159359: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1 07/3/1/0/0', ... (2 bytes)) 1548159359: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1 07/2/1/0/0', ... (4 bytes)) 1548159359: Received PUBLISH from mysensors-1 (d0, q0, r0, m0, 'mygateway1-out/1 07/1/1/0/1', ... (4 bytes)) 1548159361: New connection from 192.168.1.2 on port 1883. 1548159361: New client connected from 192.168.1.2 as espMilightHub:001 (c1, k15, u'openhabian'). 1548159361: Sending CONNACK to espMilightHub:001 (0, 0) 1548159361: Received SUBSCRIBE from espMilightHub:001 1548159361: milight/states/# (QoS 1) 1548159361: espMilightHub:001 1 milight/states/# 1548159361: Sending SUBACK to espMilightHub:001 1548159363: New connection from 192.168.1.5 on port 1883. 1548159363: New client connected from 192.168.1.5 as milight-hub-8661470 (c1, k1 5, u'openhabian').
192.168.1.2 => ip openhab server
192.168.1.4 => ip mqtt gateway
192.168.1.5 => ip milight hub
If i am right there should be 2 more lines like this:New connection from 192.168.1.2 on port 1883. New client connected from 192.168.1.2 as mysensors:gateway (c1, k15, u'openhabian').
but these lines never show up in mosquitto log
These are the logs i get when trying to add a mqtt gateway from paperUI:2019-01-22 13:54:57.181 [TRACE] [sors.factory.MySensorsHandlerFactory] - Creating handler for thing: mysensors:bridge-mqtt:bd653924 2019-01-22 13:54:57.195 [DEBUG] [nsors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge ==> /var/log/openhab2/events.log <== 2019-01-22 13:54:57.196 [hingStatusInfoChangedEvent] - 'mysensors:bridge-mqtt:bd653924' changed from UNINITIALIZED to INITIALIZING ==> /var/log/openhab2/openhab.log <== 2019-01-22 13:54:57.203 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist. 2019-01-22 13:54:57.208 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Cache (given_ids) content: [0, 11, 107] 2019-01-22 13:54:57.212 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Enabling connection watchdog 2019-01-22 13:54:57.216 [TRACE] [sensors.internal.event.EventRegister] - Adding listener org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@5be142 to org.openhab.binding.mysensors.internal.event.EventRegister@646dd1 2019-01-22 13:54:57.219 [TRACE] [sensors.internal.event.EventRegister] - Adding listener org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@10cfe20 to org.openhab.binding.mysensors.internal.event.EventRegister@646dd1 2019-01-22 13:54:57.225 [TRACE] [nsors.handler.MySensorsBridgeHandler] - Registering MySensorsDiscoveryService for bridge 'bd653924' 2019-01-22 13:54:57.224 [ERROR] [rotocol.mqtt.MySensorsMqttConnection] - No connection to broker: mosquitto 2019-01-22 13:54:57.232 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event org.openhab.binding.mysensors.internal.protocol.mqtt.MySensorsMqttConnection@16f7c2 to: org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@5be142 2019-01-22 13:54:57.236 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=0, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@5be142 2019-01-22 13:54:57.239 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=0, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@10cfe20 2019-01-22 13:54:57.243 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=11, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@5be142 2019-01-22 13:54:57.247 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=11, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@10cfe20 2019-01-22 13:54:57.251 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=107, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.internal.gateway.MySensorsGateway@5be142 2019-01-22 13:54:57.253 [DEBUG] [org.openhab.binding.mysensors ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=518, service.bundleid=263, service.scope=singleton} - org.openhab.binding.mysensors 2019-01-22 13:54:57.255 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event MySensorsNode [nodeId=107, childNumber=0, chidldList={}] to: org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@10cfe20 2019-01-22 13:54:57.258 [TRACE] [nternal.event.MySensorsEventRegister] - Broadcasting event org.openhab.binding.mysensors.internal.protocol.mqtt.MySensorsMqttConnection@16f7c2 to: org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@10cfe20 ==> /var/log/openhab2/events.log <== 2019-01-22 13:54:57.269 [hingStatusInfoChangedEvent] - 'mysensors:bridge-mqtt:bd653924' changed from INITIALIZING to OFFLINE ==> /var/log/openhab2/openhab.log <== 2019-01-22 13:54:57.275 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [0,11,107] 2019-01-22 13:54:57.279 [DEBUG] [.discovery.MySensorsDiscoveryService] - Starting MySensors discovery scan 2019-01-22 13:54:57.282 [ERROR] [rotocol.mqtt.MySensorsMqttConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:0) 2019-01-22 13:54:57.282 [TRACE] [sensors.internal.event.EventRegister] - Adding listener org.openhab.binding.mysensors.discovery.MySensorsDiscoveryService@1e34cba to org.openhab.binding.mysensors.internal.event.EventRegister@646dd1 2019-01-22 13:54:57.285 [DEBUG] [nsors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE!
For some reason openhab cant connect the mqtt gateway thing to mosquitto, it can however connect the espMiLight hub to mosquitto no problem.
The mqtt gateway itself is happely spewing data wich arrives at the mosquitto broker:
[14:05:04] openhabian@openHABianPi:~$ mosquitto_sub -u openhabian -P y -p 1883 -v -t 'mygateway1-out/#' mygateway1-out/107/3/1/0/0 28 mygateway1-out/107/0/1/0/0 91 mygateway1-out/107/2/1/0/0 20.1 mygateway1-out/107/1/1/0/1 45.4 mygateway1-out/107/2/1/0/0 20.6 mygateway1-out/107/1/1/0/1 43.2
I have serial binding and mqtt binding v2 installed. I have both mqtt.cfg and org.eclipse.smarthome.mqtt.cfg configured as follows:
# # Define your MQTT broker connections here for use in the MQTT Binding or MQTT # Persistence bundles. Replace <broker> with an ID you choose. # URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883 mqtt:mosquitto.url=tcp://localhost:1883 # Optional. Client id (max 23 chars) to use when connecting to the broker. # If not provided a random default is generated. mqtt:mosquitto.clientId=openHab # Optional. True or false. If set to true, allows the use of clientId values # up to 65535 characters long. Defaults to false. # NOTE: clientId values longer than 23 characters may not be supported by all # MQTT servers. Check the server documentation. #mqtt:mosquitto.allowLongerClientIds=false # Optional. User id to authenticate with the broker. mqtt:mosquitto.user=openhabian # Optional. Password to authenticate with the broker. mqtt:mosquitto.pwd=y # Optional. Set the quality of service level for sending messages to this broker. # Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2 # (Deliver exactly once). Defaults to 0. mqtt:mosquitto.qos=1 # Optional. True or false. Defines if the broker should retain the messages sent to # it. Defaults to false. #mqtt:mosquitto.retain=true # Optional. True or false. Defines if messages are published asynchronously or # synchronously. Defaults to true. #mqtt:mosquitto.async=false # Optional. Defines the last will and testament that is sent when this client goes offline # Format: topic:message:qos:retained <br/> #mqtt:mosquitto.lwt=<last will definition>
I've been at this for 4 days now and i really want to pull my hear out
-
OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
Hello, im trying to get mysensors binding to work in openHAB with mqtt gateway. I can get it to work with ethernet or serial gateway but i need mqtt gateway. Hardware is properly setup. I know this because i can connect to mqtt gateway with mycontroller and see all connected nodes and sensors. When i look at the mosquitto broker i can see the messages sent by the gateway. But my mqtt gateway thing stays offline in openHAB paperUi. I guess there is a problem with my mqtt.cfg or mqtt-eventbus.cfg. there isnt alot of documentation out there. I did find an example of how the config files should look in openHAB 2.2 & 2.3 but im running 2.4 and appearently the same .cfg doesnt work. I've been breaking my head over this for the last 3 days but cant find anything on the forums to solve my problem (it gets very confusing, considering the various approaches: mqtt binding1 vs mqtt binding2 vs mysensors binding). Does anyone have the mqtt gateway running in openhab 2.4 using the mysensors binding? Im really lost, any help would be much appreciated. Thanks
-
RE: [SOLVED] arduino no longer compiles Gateway W5100MQTTClient
That workaround did it, now the library example compiles. Thanks
-
RE: [SOLVED] arduino no longer compiles Gateway W5100MQTTClient
@yveaux yesterday i allso copied the code from the link (forgot). Its the same code as far as i can see. Code from link compiles, example doesnt
-
[SOLVED] arduino no longer compiles Gateway W5100MQTTClient
When trying to compile the example from the mysensors library : "GatewayW5100MQTTClient" arduino throws error:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src\EthernetClient.cpp: In member function 'operator==': C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src\EthernetClient.cpp:177:1: internal compiler error: Segmentation fault } ^ Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper.exe: fatal error: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status compilation terminated. c:/program files/windowsapps/arduinollc.arduinoide_1.8.19.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed collect2.exe: error: ld returned 1 exit status
compiled just fine yesterday
When i copy and paste the code from https://www.mysensors.org/build/mqtt_gateway everything compiles fine
-
RE: ๐ฌ MYSController
@guillermo-schimmel ok thanks, the link was formilliar, i have come by this link at one time in the past but i couldnt find it anymore. I will give it another try tomorrow with the newer binding. The configuration examples will help alot. Thanks
-
Are rfm69 & nrf24l01 compatible
Are both radios compatible? I mean can a nrf receive signals sent by rfm69 or do they use different standards? Thanks
-
RE: ๐ฌ MYSController
@guillermo-schimmel can you tell me where you downloaded the binding? I think im using the 2.2 binding. Is it possible you forgot the link to your setup files? Greets
-
RE: ๐ฌ MYSController
@jimmy-loyens do you use the mysensors-binding in openhab or the mqtt-binding (or a combination of the two)
-
RE: ๐ฌ MYSController
@guillermo-schimmel I have been looking at the mysensors binding this evening (see my posts here: https://forum.mysensors.org/topic/7176/openhab-2-2-binding/118), but at first sight i cant get it working (i cant find a lot of clear documentation on the binding either) so i'm leaning more to the MQTT-binding approach right now. I will be exploring this route tomorrow. allready reflashed the gateway with MQTT-firmware
-
RE: openHAB 2.2 binding
@jimmy-loyens Ok now i found "some" info on the configuration via things/items files here:https://github.com/tobof/openhab2-addons/wiki/Configuration.
Is there anything more i should know about?
I configured an ethernet gateway and1 node with a temp, humidity, lightlevel and battery child. The battery child is not even showing up in paperUI, the other 3 are showing up as a thing (and online, bridge allso) but in control tab of paperUI all channels are shown as NaN.
-
RE: Help, sensor data is nolonger distributed to items
Its really strange but after saving the serialGW.rules file again (without change) everything started working again. But that was a good remark. Happened to me numerous times.
-
RE: openHAB 2.2 binding
Hello, I just started to use the mysensors binding 2.2 (moving from serial gateway to ethernet gateway to accomadate MYSController) and I have some (maybe stupid) questions I cant find the answers to (I have been poking around the forum though).
First off, I have a whole bunch of the same type nodes: child0=battery/child1=humidity/child2=temperature/child3=lightintensity/child4-9 are digital inputs for doors and windows. Are such nodes supported by the binding, and how to configure them? I can find temperature, humidity and lightlevel nodes in the list (paperUI) but how can i combine these?Second, can the nodes be automaticly discovered by the binding? In my case i have to add them all manually.
Third, what are the var1-5 channels for? (is this the answer to my first question?)
Fourth, what is the difference between the two variable1 channels? in the channel name one says "var1" the other one says "custom"?
Fifth, is there a comprehencive tutorial out there on how to configure the nodes? (I have looked but cant seem to find one)
Sixed, when i add any sensor manualy i get a status for it of "UNINITIALIZED - HANDLER_INITIALIZING_ERROR ". The node ID/child ID is online sending data though.am i using the latest stable version of the binding? I downloaded it a few weeks ago from eclipse market.
Any help would be appreciated
-
RE: ๐ฌ MYSController
@guillermo-schimmel hi, when i look under mysensors binding in openhab paperui i only see things for serial gw & ethernet gw but not for mqtt gateway. Am i supposed to build a ethernet gw or is mqtt gw allso supported? Just asking to know wich firmware to flash since hw is the same. Thanks
-
RE: ๐ฌ MYSController
Ok, thanks for all your help! I'll get started this weekend with the mysensors binding approach.
-
RE: ๐ฌ MYSController
@jimmy-loyens i use a mosquitto broker to get messages from my esp milight hub in openhab. Can i use this same broker with different topic? I beleive openhab uses mqtt binding for this. Sorry still got a lot to learn about mqtt
-
RE: ๐ฌ MYSController
@guillermo-schimmel thanks, seems i have an ethernet shiel + spare uno lying around. I will give it a go. Is the mysensors binding compattible with custom nodes i written my own code for? Wich metod is less work to reprogram my openhab? I'm asking because my openhab is quite elaborate. I have a few 100 items and about 80 mylight sensors plugged in to openhab right now (serial gateway) they all enter openhab via 1 rule with a large hashmap. If i understand correctly i have to create a thing for each sensor and link each item to the channel of this thing. Got a lot of work to do
-
RE: ๐ฌ MYSController
@jimmy-loyens ok, i did some reading and i think i just need to build the mqtt gateway (is this correct?). Do you hava an example of how to interface a mqtt gateway to openhab? I suppose this would be quite different to a serial gateway. Thanks
-
RE: Ble presence/positioning nodes
@mfalkvidd thanks for your reply. I had allready read these, but thanks for the links never the less. I have some bluetooth modules (hm-10 & at-09) in the mail. Allready have some i-tags laying around. I will see what i can make of this. My house is only one story so i would like to place one node in the middle of each room on the attic floor. If this works i will have some kick-ass presence detection , if it doesnt i will have some spare ble modules to play with. There just is no down-side to this
-
RE: ๐ฌ MYSController
@guillermo-schimmel hi, thanks for your response. "Set up a ethernet mqqt gateway" could you elaborate on this? I'm quite competent with arduino, but i'm still learning about mqtt as i go. I have managed to setup mosquitto on my openhab server thoug. Do you mean let openhab send mqtt messages to the ethernet mysensors gateway and thus making it possible to connect MYSController to the ip of the mysensors ethernet gateway? Do you know of some example code? I know there is an example of an ethernet gateway but can it allso handle mqtt by default? Thanks
-
Ble presence/positioning nodes
Hello, has anyone ever done something like a ble node (with hm-10 or cheaper chinese variant at-09) for presence detection and indoor positioning? I'm planning to develop a node that doesn't connect to any device but constantly discovers all ble devices (phones and ibeacons) and reports its id, rssi and if device is getting closer or further. This way if i have one node per room i should be able to do a decent indoor positioning of phones and beacons in my openhab. Does anyone have any experiance on this subject? I've read some post on the forum but all several years old. I know i can do this with the wifi signal of my phone, but i keep running into problems when phone goes into sleep. This would be a nice backup.
-
RE: ๐ฌ MYSController
Hello, is it possible to do FOTA updates from a desktop while the main gateway is connected to an openhab server on RPI3? Or do i have to replug my gateway between RPI3 en desktop every time i want to do an update?
-
RE: ๐ฌ FOTA (Wireless Programming)
Hello, I have my MySensors gateway permanently attached to my openhab server (RPI3), but i want to do FOTA uploads from my desktop. How do I do this since MYSController needs to attatch to a gateway? Can i use an other gateway, both with the same address (ID0)? Thanks
-
RE: At home / away?
How about having several of these ble nodes around the house scanning for bluetooth of your cellphone and sending the rssi over mysensors to the controller. This way you can do a crude indoor positioning (witch node is closest, so phone is in that room). And if you leave the home (with cellphone) the controller can detect no node sees the phone anymore, so no presence is detected.
-
RE: [SOLVED] A2 interrupt doesn't wake node from sleep
I just found this post on the forum: https://forum.mysensors.org/topic/6352/pin-change-interrupt-on-any-pin/11
It adds "_wokeUpByInterrupt = 0xFE; // Dirty hack to get out of MySensors sleep loop" at the end of every ISR
and
"// Unset value from dirty hack to get out of sleep loop (set in interrupt)
_wokeUpByInterrupt = INVALID_INTERRUPT_NUM;" at the beginning of loop.I tried it, not knowing at all what i'm doing by adding these lines. But i do know it works!!! Even if it is a dirty hack, IT WORKS!!!!
Now i can rewrite my code to do the processing/messaging in loop outside of the ISR. If anyone can explane what these lines do exactly please let me know.
It would be even nicer if somewhere in the future there could be a sleep function in the MySensors library that supports these pinchange interrupt vectors, but this hack makes it work for now.
Thanks for all the help!
-
RE: [SOLVED] A2 interrupt doesn't wake node from sleep
The whole problem seems to originate from the node not waking up by the interruptvectors. If i can get the node to wake up by PCINT0_vect/PCINT1_vect/PCINT2_vect i can process data and send messages outside the ISR. I gues thats why i resorted to sending messages in ISR a year ago. Does anyone know how to wake the node by these interrupt vectors? maybe i can re-write the sleep function to do this?
-
RE: [SOLVED] A2 interrupt doesn't wake node from sleep
These mssges where all sent from within ISR:
Pin 2 triggered: 0 8417 !TSF:MSG:SEND,59-59-0-0,s=4,c=1,t=16,pt=1,l=1,sg=0,ft=0,st=NACK:0 Pin 2 triggered: 1 8419 !TSF:MSG:SEND,59-59-0-0,s=4,c=1,t=16,pt=1,l=1,sg=0,ft=1,st=NACK:1 Pin 3 triggered: 0 8421 TSF:MSG:SEND,59-59-0-0,s=5,c=1,t=16,pt=1,l=1,sg=0,ft=2,st=OK:0 Pin 3 triggered: 1 8423 !TSF:MSG:SEND,59-59-0-0,s=5,c=1,t=16,pt=1,l=1,sg=0,ft=0,st=NACK:1 8425 MCO:SLP:WUP=-1 8427 MCO:SLP:MS=30000,SMS=0,I1=114,M1=2,I2=75,M2=1 8433 MCO:SLP:TPD Pin 5 triggered: 0 8435 !TSF:MSG:SEND,59-59-0-0,s=6,c=1,t=16,pt=1,l=1,sg=0,ft=1,st=NACK:0 Pin 5 triggered: 1 8437 !TSF:MSG:SEND,59-59-0-0,s=6,c=1,t=16,pt=1,l=1,sg=0,ft=2,st=NACK:1 Pin 6 triggered: 0 8439 !TSF:MSG:SEND,59-59-0-0,s=7,c=1,t=16,pt=1,l=1,sg=0,ft=3,st=NACK:0 Pin 6 triggered: 1 8441 !TSF:MSG:SEND,59-59-0-0,s=7,c=1,t=16,pt=1,l=1,sg=0,ft=4,st=NACK:1 8443 MCO:SLP:WUP=-1 8445 MCO:SLP:MS=30000,SMS=0,I1=114,M1=2,I2=75,M2=1 8452 MCO:SLP:TPD Pin 7 triggered: 0 8454 !TSF:MSG:SEND,59-59-0-0,s=8,c=1,t=16,pt=1,l=1,sg=0,ft=5,st=NACK:0 Pin 7 triggered: 1 8456 !TSF:MSG:SEND,59-59-0-0,s=8,c=1,t=16,pt=1,l=1,sg=0,ft=6,st=NACK:1 8458 MCO:SLP:WUP=-1 8460 !TSM:READY:UPL FAIL,SNP
i think the NACK comes from triggering pins in fast tempo
-
RE: [SOLVED] A2 interrupt doesn't wake node from sleep
@mfalkvidd For the digital pins send seems to work just fine, as long as i don't use any functions inside the ISR
-
RE: [SOLVED] A2 interrupt doesn't wake node from sleep
@jimmy-loyens Oh I see now, ....
the node isn't waking up by any of my interrupt vectors. GetDigital does more then just getting the interrupt pin, it allso sends a message inside the ISR. Thats why status changes on digital pins are sent immediatly. the node never wakes up to send them its handeled by the interrupt!!!
This is not possible for my lightsensor (evaluate & send mssg in ISR) because this uses functions (i think). Is the sleep function expecting interrupt pins on the 'interrupt1' & 'interrupt2' parameters? Does anyone have an idea for a workaround? I have about 50 of these pcb's so its a little late for a re-design
-
RE: [SOLVED] A2 interrupt doesn't wake node from sleep
This is the entire code:
Setup & loop (.ino)
/** 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: Henrik EKblad Version 1.1 - 2016-07-20: Converted to MySensors v2.0 and added various improvements - Torben Woltjen (mozzbozz) DESCRIPTION Mysensors battery node. With temperature, relative humidity, lightintensity and battery level measurements For more information, please visit: http://www.mysensors.org/build/ */ //** Includes #include "Defines.h" #include "Globals.h" #include <SPI.h> #include <Wire.h> //**************// //* INTERRUPTS *// //**************// // Install Pin change interrupt for a pin, can be called multiple times 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 } // Use one Routine to handle each group ISR (PCINT0_vect) // handle pin change interrupt for D8 to D13 here { tripped = true; GetDigital(); } ISR (PCINT1_vect) // handle pin change interrupt for A0 to A5 here { //Only on fall interrupt of TSL2561 if (!digitalRead(16)) { lightInterrupt = true; Serial.println("falling trigger"); } } ISR (PCINT2_vect) // handle pin change interrupt for D0 to D7 here { tripped = true; GetDigital(); } void setup() { Serial.begin(115200); //***********************// //* SETUP BATTERY LEVEL *// //***********************// setupBattery(); //*************// //* SETUP DHT *// //*************// setupDHT(); //*****************// //* SETUP TSL2561 *// //*****************// setupTSL(); //**************// //* SETUP DI's *// //**************// setupDI(); } void loop() { //*****************// //* BATTERY LEVEL *// //*****************// processBattLevel(); //********************// //* DHT: TEMPERATURE *// //********************// processTemperature(); //*****************// //* DHT: HUMIDITY *// //*****************// processHumidity(); //*******************// //* TSL: LIGHTLEVEL *// //*******************// // processLightLevel(); if (lightInterrupt == true) { Serial.println("A2 low!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); processLightLevel(); light.clearInterrupt(); lightInterrupt = false; } //*******************// //* DI: DOOR/WINDOW *// //*******************// UpdateCurrentState(); //*********// //* SLEEP *// //*********// // Sleep for a while to save energy sleep(PCINT1_vect, CHANGE, PCINT2_vect, CHANGE, UPDATE_INTERVAL); }
Battery (.ino)
void setupBattery(void) { // Define internal reference for battry level measurement #if defined(__AVR_ATmega2560__) analogReference(INTERNAL1V1); #else analogReference(INTERNAL); #endif } void processBattLevel(void) { noInterrupts(); int sensorValue = analogRead(batterySensePin); interrupts(); #ifdef MY_DEBUG Serial.print("Battery sensorValue : ");Serial.println(sensorValue); #endif //1M, 470K divider across battery and using ADC ref of 1.1V //Sense point is bypassed with 0.1ยตF cap to reduce noise at that point //((1e6+470e3) / 470e3) * 1.1 = Vmax = 3.44V //3.44 / 1023 = Volt per bit = 0.003363075 int batteryPcnt = sensorValue / 10; #ifdef MY_DEBUG float batteryV = sensorValue * 0.003363075; Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); Serial.print("Battery Percent: "); Serial.print(batteryPcnt); Serial.println(" %"); #endif if (oldBatteryPcnt != batteryPcnt || nNoUpdatesBatt == FORCE_UPDATE_N_READS_B) { // Only send battery message when value has changed //Power up radio after sleep send(msgBatt.set(batteryPcnt)); //sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; nNoUpdatesBatt = 0; } else { // Increase no update counter if the battery level stayed the same nNoUpdatesBatt++; } }
DHT (.ino)
void setupDHT(void){ dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) { Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!"); } // Sleep for the time of the minimum sampling period to give the sensor time to power up // (otherwise, timeout errors might occure for the first reading) sleep(dht.getMinimumSamplingPeriod()); } void processTemperature(void){ noInterrupts(); // Force reading sensor, so it works also after sleep() dht.readSensor(true); // Get temperature from DHT library float temperature = dht.getTemperature(); interrupts(); Serial.print("temperature (float): ");Serial.println(temperature); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT!"); } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS_T) { // Only send temperature if it changed since the last measurement or if we didn't send an update for n times lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } // Reset no updates counter nNoUpdatesTemp = 0; temperature += SENSOR_TEMP_OFFSET; send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("Temperature: "); Serial.print(temperature); Serial.println(" ยฐC"); #endif } else { // Increase no update counter if the temperature stayed the same nNoUpdatesTemp++; } } void processHumidity(void){ noInterrupts(); // Get humidity from DHT library float humidity = dht.getHumidity(); interrupts(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS_H) { // Only send humidity if it changed since the last measurement or if we didn't send an update for n times lastHum = humidity; // Reset no updates counter nNoUpdatesHum = 0; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("Humidity: "); Serial.print(humidity); Serial.println(" %"); #endif } else { // Increase no update counter if the humidity stayed the same nNoUpdatesHum++; } }
Digital (.ino)
void setupDI(void) { #ifdef PULL_UP_EN // set pullups, if necessary for (int i = 2; i <= 8; i++) { digitalWrite(i, HIGH); } Serial.println("pullup"); #endif // enable interrupt for pin... for (int i = 0; i < NR_OF_SWITCH; i++) { pciSetup(intPin[i]); #ifdef MY_DEBUG Serial.print("Int pin "); Serial.print(i); Serial.print(": "); Serial.println(intPin[i]); #endif } } void UpdateCurrentState(void) { noInterrupts(); for (char i = 0; i < NR_OF_SWITCH; i++) { currState[i] = digitalRead(intPin[i]); Serial.print("Pin "); Serial.print(intPin[i]); Serial.println(" updated: "); Serial.println(currState[i]); switch (i) { case 0: send(msgSwitch1.set(currState[i])); break; case 1: send(msgSwitch2.set(currState[i])); break; case 2: send(msgSwitch3.set(currState[i])); break; case 3: send(msgSwitch4.set(currState[i])); break; case 4: send(msgSwitch5.set(currState[i])); break; case 5: send(msgSwitch6.set(currState[i])); break; default: Serial.println("Not an interrupt pin"); } } interrupts(); } boolean GetDigital(void) { noInterrupts(); if (tripped) { for (char i = 0; i < NR_OF_SWITCH; i++) { currState[i] = digitalRead(intPin[i]); if (lastState[i] != currState[i]) { lastState[i] = currState[i]; Serial.print("Pin "); Serial.print(intPin[i]); Serial.print(" triggered: "); Serial.println(currState[i]); switch (i) { case 0: send(msgSwitch1.set(currState[i])); break; case 1: send(msgSwitch2.set(currState[i])); break; case 2: send(msgSwitch3.set(currState[i])); break; case 3: send(msgSwitch4.set(currState[i])); break; case 4: send(msgSwitch5.set(currState[i])); break; case 5: send(msgSwitch6.set(currState[i])); break; default: Serial.println("Not an interrupt pin"); } } } tripped = false; //Clear processed triggers interrupts(); return true; } interrupts(); return false; }
Presentation (.ino)
void presentation() { noInterrupts(); // Send the sketch version information to the gateway sendSketchInfo(SKETCH_NAME, Sketch_VERSION); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_BATT, I_BATTERY_LEVEL); present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); if (NR_OF_SWITCH >= 1) { present(CHILD_ID_SWITCH1, S_DOOR); if (NR_OF_SWITCH >= 2) { present(CHILD_ID_SWITCH2, S_DOOR); if (NR_OF_SWITCH >= 3) { present(CHILD_ID_SWITCH3, S_DOOR); if (NR_OF_SWITCH >= 4) { present(CHILD_ID_SWITCH4, S_DOOR); if (NR_OF_SWITCH >= 5) { present(CHILD_ID_SWITCH5, S_DOOR); if (NR_OF_SWITCH >= 6) { present(CHILD_ID_SWITCH6, S_DOOR); } } } } } } metric = getControllerConfig().isMetric; interrupts(); }
TSL (.ino)
void setupTSL(void) { pinMode(16,INPUT_PULLUP);//16 = A2 pciSetup(16); // Initialize the SFE_TSL2561 library // You can pass nothing to light.begin() for the default I2C address (0x39), // or use one of the following presets if you have changed // the ADDR jumper on the board: // TSL2561_ADDR_0 address with '0' shorted on board (0x29) // TSL2561_ADDR default address (0x39) // TSL2561_ADDR_1 address with '1' shorted on board (0x49) // For more information see the hookup guide at: https://learn.sparkfun.com/tutorials/getting-started-with-the-tsl2561-luminosity-sensor light.begin(); // The light sensor has a default integration time of 402ms, // and a default gain of low (1X). // If you would like to change either of these, you can // do so using the setTiming() command. // If gain = false (0), device is set to low gain (1X) // If gain = high (1), device is set to high gain (16X) gain = 1; // If time = 0, integration will be 13.7ms // If time = 1, integration will be 101ms // If time = 2, integration will be 402ms // If time = 3, use manual start / stop to perform your own integration time = 2; // setTiming() will set the third parameter (ms) to the // requested integration time in ms (this will be useful later): light.setTiming(gain, time, ms); if (light.setInterruptControl(1,2)) { Serial.println("TSL2561 interrupts set successfully"); } if (light.setInterruptThreshold(500, 1800)) { Serial.println("TSL2561 interrupts thresholds set successfully"); } // To start taking measurements, power up the sensor: light.setPowerUp(); // The sensor will now gather light during the integration time. // After the specified time, you can retrieve the result from the sensor. // Once a measurement occurs, another integration period will start. } void processLightLevel(void) { // Wait between measurements before retrieving the result // (You can also configure the sensor to issue an interrupt // when measurements are complete) // This sketch uses the TSL2561's built-in integration timer. // You can also perform your own manual integration timing // by setting "time" to 3 (manual) in setTiming(), // then performing a manualStart() and a manualStop() as in the below // commented statements: // ms = 1000; // light.manualStart(); //delay(ms); // light.manualStop(); // Once integration is complete, we'll retrieve the data. // There are two light sensors on the device, one for visible light // and one for infrared. Both sensors are needed for lux calculations. // Retrieve the data from the device: unsigned int data0, data1; if (light.getData(data0, data1)) { // getData() returned true, communication was successful #ifdef MY_DEBUGX Serial.print("data0: "); Serial.println(data0); Serial.print(" data1: "); Serial.println(data1); #endif if(data0>65000){ gain=0; light.setTiming(gain, time, ms); } if(data0<500){ gain=1; light.setTiming(gain, time, ms); } if (light.setInterruptThreshold(data0-(data0/100*10),data0+(data0/100*10))) { //light.setInterruptThreshold(data0-50,data0+50) Serial.println("TSL2561 interrupts thresholds set successfully"); } double lux; // Resulting lux value boolean good; // True if neither sensor is saturated // Perform lux calculation: good = light.getLux(gain, ms, data0, data1, lux); if (good) { #ifdef MY_DEBUGX Serial.print("lux: "); Serial.println(lux); Serial.print("mlux: "); Serial.println(mlux); Serial.print("lastLux: "); Serial.println(lastLux); Serial.print("gain: "); Serial.println(gain); #endif mlux = int(lux); // Lux value to be transmitted as integer if (isnan(mlux)) { Serial.println("Failed reading lightintensity from TSL2561!"); } else if (mlux != lastLux || nNoUpdatesTemp == FORCE_UPDATE_N_READS_L) { send(msgLight.set(mlux)); lastLux = mlux; #ifdef MY_DEBUG Serial.print("LightLevel: "); Serial.print(mlux); Serial.println(" lux"); #endif } else { // Increase no update counter if the humidity stayed the same nNoUpdatesLight++; } } } }
Defines (.h)
//** Define scetch name and version #define SKETCH_NAME "ID59_Kitchen_1(2*window)" #define Sketch_VERSION "V1.1" //** Enable debug prints #define MY_DEBUG #define MY_DEBUGX //** Define node ID #define MY_NODE_ID 59 //** Define child ID's #define CHILD_ID_BATT 0 #define CHILD_ID_HUM 1 #define CHILD_ID_TEMP 2 #define CHILD_ID_LIGHT 3 #define CHILD_ID_SWITCH1 4 #define CHILD_ID_SWITCH2 5 #define CHILD_ID_SWITCH3 6 #define CHILD_ID_SWITCH4 7 #define CHILD_ID_SWITCH5 8 #define CHILD_ID_SWITCH6 9 #define NR_OF_SWITCH 6 //Window_1+2 //** Define interrupt pins (doors & windows) #define INT_PIN1 2 #define INT_PIN2 3 #define INT_PIN3 5 #define INT_PIN4 6 #define INT_PIN5 7 #define INT_PIN6 8 #define PULL_UP_EN true //** Enable and select radio type attached #define MY_RADIO_NRF24 #define MY_RF24_CE_PIN 9 #define MY_RF24_CS_PIN 10 #define MY_RF24_PA_LEVEL RF24_PA_HIGH //** DHT defines // Set this to the pin you connected the DHT's data pin to #define DHT_DATA_PIN 4 // Set this offset if the sensor has a permanent small offset to the real temperatures #define SENSOR_TEMP_OFFSET 0
Globals (.h)
#include <DHT.h> #include <SparkFunTSL2561.h> #include <MySensors.h> enum { ON, OFF }; //** Define sleep time // Sleep time between sensor updates (in milliseconds) // Must be >1000ms for DHT22 and >2000ms for DHT11 static const uint64_t UPDATE_INTERVAL = 30000; //** Define force values // Force sending an update of the temperature after n sensor reads, so a controller showing the // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that // the value didn't change since; // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms] static const uint8_t FORCE_UPDATE_N_READS_T = 10; //Temperature force value static const uint8_t FORCE_UPDATE_N_READS_H = 10; //Humidity force value static const uint8_t FORCE_UPDATE_N_READS_L = 10; //LightLevel force value static const uint8_t FORCE_UPDATE_N_READS_B = 50; //Binairy force value // Vars for battery level measurement int batterySensePin = A0; int oldBatteryPcnt = 0; uint8_t nNoUpdatesBatt; // Vars for DHT sensor DHT dht; float lastTemp; float lastHum; uint8_t nNoUpdatesTemp; uint8_t nNoUpdatesHum; bool metric = true; //Vars for TSL2461 SFE_TSL2561 light; int lastLux; double lux; // Resulting lux value int mlux; boolean gain; // Gain setting, 0 = X1, 1 = X16; unsigned char time; unsigned int ms; // Integration ("shutter") time in milliseconds uint8_t nNoUpdatesLight; volatile boolean lightInterrupt=true; //Vars for DI's volatile byte tripped = 0; int intPin[] = {2, 3, 5, 6, 7, 8}; boolean currState[] = {OFF, OFF, OFF, OFF, OFF, OFF}; volatile boolean lastState[] = {OFF, OFF, OFF, OFF, OFF, OFF}; // Prepare messages for gateway MyMessage msgBatt(CHILD_ID_BATT, I_BATTERY_LEVEL); // Battery message MyMessage msgHum(CHILD_ID_HUM, V_HUM); // Humidity message MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); // Temperature message MyMessage msgLight(CHILD_ID_LIGHT, V_TEMP); // Lightlevel message MyMessage msgSwitch1(CHILD_ID_SWITCH1, V_TRIPPED); MyMessage msgSwitch2(CHILD_ID_SWITCH2, V_TRIPPED); MyMessage msgSwitch3(CHILD_ID_SWITCH3, V_TRIPPED); MyMessage msgSwitch4(CHILD_ID_SWITCH4, V_TRIPPED); MyMessage msgSwitch5(CHILD_ID_SWITCH5, V_TRIPPED); MyMessage msgSwitch6(CHILD_ID_SWITCH6, V_TRIPPED);
-
RE: [SOLVED] A2 interrupt doesn't wake node from sleep
@mfalkvidd Hi, first off thanks for taking a look at my problem.
I know I'm not supposed to use Serial.print inside an ISR, this was just for debugging purposses to see if this part of the code even was run. I tried without the Serial.print but same result.
GetDigital looks wich interruptpin was triggered
boolean GetDigital(void) { noInterrupts(); if (tripped) { for (char i = 0; i < NR_OF_SWITCH; i++) { currState[i] = digitalRead(intPin[i]); if (lastState[i] != currState[i]) { lastState[i] = currState[i]; Serial.print("Pin "); Serial.print(intPin[i]); Serial.print(" triggered: "); Serial.println(currState[i]); switch (i) { case 0: send(msgSwitch1.set(currState[i])); break; case 1: send(msgSwitch2.set(currState[i])); break; case 2: send(msgSwitch3.set(currState[i])); break; case 3: send(msgSwitch4.set(currState[i])); break; case 4: send(msgSwitch5.set(currState[i])); break; case 5: send(msgSwitch6.set(currState[i])); break; default: Serial.println("Not an interrupt pin"); } } } tripped = false; //Clear processed triggers interrupts(); return true; } interrupts(); return false; }
Again Serial.print for debugging (but seems to run fine even with Serial.print, granted it takes the ISR alot longer)
I know the node woke up because the timer expired, this is kind of the problem
PCINT0_vect, PCINT1_vect and PCINT2_vect are interruptvectors used in pinchange interrupt on all pins (D8-D13, A1-A5 & D0-D7) see this link: https://playground.arduino.cc/Main/PinChangeInterrupt.
These variables are probably not what the MySensors Sleep function expects, but it seems to work fine for PCINT0_vect and PCINT2_vect, where the digital pins are connected to. When any of the digital pins change the node wakes up immediatly and sends an update about the pin that changed. Should work the same for the interrupt on the analog pin, but something goes wrong
I even tried using absolute pinnumbers for analog pins (A0=14,A1=15,A2=16,...) but still same result. see:
http://forum.arduino.cc/index.php?topic=41238.0I will include the entire sketch in next post, so you can follow all of the code if needed. Its devided into several files and i cant upload a zip appearently so get ready for some serious code blocks
I have these nodes on every door & window in my house for about a year now and they work great. Just wanted to add interrupt functionality to my light measurement now.
-
[SOLVED] A2 interrupt doesn't wake node from sleep
Hello first off here is my code (not all ofcourse):
//**************// //* INTERRUPTS *// //**************// // Install Pin change interrupt for a pin, can be called multiple times 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 } // Use one Routine to handle each group ISR (PCINT0_vect) // handle pin change interrupt for D8 to D13 here { tripped = true; GetDigital(); // digitalWrite(13, digitalRead(8)); } ISR (PCINT1_vect) // handle pin change interrupt for A0 to A5 here { //Only on fall interrupt of TSL2561 if (!digitalRead(A2)) { lightInterrupt = true; Serial.println("falling trigger"); } } ISR (PCINT2_vect) // handle pin change interrupt for D0 to D7 here { tripped = true; GetDigital(); // digitalWrite(13, digitalRead(2) and digitalRead(3) and digitalRead(5) and digitalRead(6) and digitalRead(7)); }
void loop() { //*****************// //* BATTERY LEVEL *// //*****************// //processBattLevel(); //********************// //* DHT: TEMPERATURE *// //********************// //processTemperature(); //*****************// //* DHT: HUMIDITY *// //*****************// //processHumidity(); //*******************// //* TSL: LIGHTLEVEL *// //*******************// //processLightLevel(); if (lightInterrupt == true) { Serial.println("A2 low!!!!!!!!!!!!!!!!!"); processLightLevel(); light.clearInterrupt(); lightInterrupt = false; } //*******************// //* DI: DOOR/WINDOW *// //*******************// //UpdateCurrentState(); //*********// //* SLEEP *// //*********// // Sleep for a while to save energy sleep(PCINT1_vect, CHANGE, PCINT2_vect, CHANGE, UPDATE_INTERVAL); }
I have the problem that a change in PCINT1_vect doesn't wake up my node. The interrupt gets triggered but it doesn't seem to run all of the code in the ISR and doesn't exit the sleep. I get the following in the output:
data0: 1343 data1: 219 TSL2561 interrupts thresholds set successfully lux: 34.25 mlux: 36 lastLux: 36 gain: 1 10764 TSF:MSG:SEND,59-59-0-0,s=3,c=1,t=0,pt=2,l=2,sg=0,ft=0,st=OK:34 LightLevel: 34 lux 10774 MCO:SLP:MS=30000,SMS=0,I1=186,M1=1,I2=59,M2=1 10780 MCO:SLP:TPD 10782 MCO:SLP:WUP=-1 10784 MCO:SLP:MS=30000,SMS=0,I1=186,M1=1,I2=59,M2=1 10790 MCO:SLP:TPD 10792 MCO:SLP:WUP=-1 10795 MCO:SLP:MS=30000,SMS=0,I1=186,M1=1,I2=59,M2=1 10801 MCO:SLP:TPD 10803 MCO:SLP:WUP=-1 10805 MCO:SLP:MS=30000,SMS=0,I1=186,M1=1,I2=59,M2=1 10811 MCO:SLP:TPD faโธฎ
Last line is supposed to be "falling triggr". This Serial.println is located in the ISR PCINT0_vect, but it seems it doesn't get fully executed. after the node wakes up (on timer), it seems like 'lightInterrupt' has been set in the ISR since the lightlevel is processed and updated.
A2 low!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! data0: 1440 data1: 245 TSL2561 interrupts thresholds set successfully lux: 36.30 mlux: 35 lastLux: 35 gain: 1 8491 TSF:MSG:SEND,59-59-0-0,s=3,c=1,t=0,pt=2,l=2,sg=0,ft=0,st=OK:36 LightLevel: 36 lux 8503 MCO:SLP:MS=30000,SMS=0,I1=186,M1=1,I2=210,M2=1 8507 MCO:SLP:TPD 8509 MCO:SLP:WUP=-1 8511 MCO:SLP:MS=30000,SMS=0,I1=186,M1=1,I2=210,M2=1 8517 MCO:SLP:TPD
Stranger even still, PCINT2_vect does work as expected. In this case the node does wake up on interrupt on D2-D7 (if these DI's are enabled in the code). If anyone can help it would be much appreciated. I really don't see the reason PCINT1_vect doesn't wake up the node. If more code is needed tell me, I will happely post the entire code if you want.
-
Help, sensor data is nolonger distributed to items
Since last night i broke something . Now i can see in the logs that my (serial)gateway is receiving sensordata, but it doesn't get distributed to the items anymore. I didn't touch the SerialGW.rules or SerialGW.items files and it was working just fine until yesterday. I do get following error:
2018-12-27 10:16:08.501 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Arduino sends to Openhab': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.StringExtensions.operator_plus(java.lang.String,java.lang.String) on instance: null```
this error comes right after the data is put into openhab from my serial gateway:
2018-12-27 10:16:00.591 [vent.ItemStateChangedEvent] - Arduino changed from 0;255;3;0;9;TSF:SAN:OK to 0;255;3;0;9;TSF:MSG:READ,27-27-0,s=2,c=1,t=0,pt=7,l=5,sg=0:19.0 27;2;1;0;0;19.0 0;255;3;0;9;TSF:MSG:READ,27-27-0,s=1,c=1,t=1,pt=7,l=5,sg=0:48.3 27;1;1;0;1;48.3 0;255;3;0;9;TSF:MSG:READ,27-27-0,s=4,c=1,t=16,pt=1,l=1,sg=0:1 27;4;1;0;16;1 0;255;3;0;9;TSF:MSG:READ,27-27-0,s=5,c=1,t=16,pt=1,l=1,sg=0:1 27;5;1;0;16;1 2018-12-27 10:16:01.669 [vent.ItemStateChangedEvent] - Arduino changed from 0;255;3;0;9;TSF:MSG:READ,27-27-0,s=2,c=1,t=0,pt=7,l=5,sg=0:19.0 27;2;1;0;0;19.0 0;255;3;0;9;TSF:MSG:READ,27-27-0,s=1,c=1,t=1,pt=7,l=5,sg=0:48.3 27;1;1;0;1;48.3 0;255;3;0;9;TSF:MSG:READ,27-27-0,s=4,c=1,t=16,pt=1,l=1,sg=0:1 27;4;1;0;16;1 0;255;3;0;9;TSF:MSG:READ,27-27-0,s=5,c=1,t=16,pt=1,l=1,sg=0:1 27;5;1;0;16;1 to 0;255;3;0;9;TSF:MSG:READ,75-75-0,s=1,c=1,t=1,pt=7,l=5,sg=0:57.5 75;1;1;0;1;57.5 0;255;3;0;9;TSF:MSG:READ,75-75-0,s=4,c=1,t=16,pt=1,l=1,sg=0:1 75;4;1;0;16;1 0;255;3;0;9;TSF:MSG:READ,75-75-0,s=5,c=1,t=16,pt=1,l=1,sg=0:1 75;5;1;0;16;1
I know MY_DEBUG is still on on my serial gateway, but as i said everything worked until yesterday, even with debug on. Does anyone know why openhab is throwing this error? Or why my data is no longer being distributed to the items?
This is my rules file for the serial GW:
import java.util.HashMap var String ArduinoUpdate = "" var String sketchName = "" var int V_TEMP = 0 var int V_HUM = 1 var int V_LIGHT = 2 var int V_DIMMER = 3 var int V_PRESSURE = 4 var int V_FORECAST = 5 var int V_RAIN = 6 var int V_RAINRATE = 7 var int V_WIND = 8 var int V_GUST = 9 var int V_DIRECTION = 10 var int V_UV = 11 var int V_WEIGHT = 12 var int V_DISTANCE = 13 var int V_IMPEDANCE = 14 var int V_ARMED = 15 var int V_TRIPPED = 16 var int V_WATT = 17 var int V_KWH = 18 var int V_SCENE_ON = 19 var int V_SCENE_OFF = 20 var int V_HEATER = 21 var int V_HEATER_SW = 22 var int V_LIGHT_LEVEL = 23 var int V_VAR1 = 24 var int V_VAR2 = 25 var int V_VAR3 = 26 var int V_VAR4 = 27 var int V_VAR5 = 28 var int V_UP = 29 var int V_DOWN = 30 var int V_STOP = 31 var int V_IR_SEND = 32 var int V_IR_RECEIVE = 33 var int V_FLOW = 34 var int V_VOLUME = 35 var int V_LOCK_STATUS = 36 var int V_DUST_LEVEL = 37 var int V_VOLTAGE = 38 var int V_CURRENT = 39 var int msgPresentation = 0 var int msgSet = 1 var int msgReq = 2 var int msgInternal = 3 var int msgStream = 4 var int alarmArmor = 1 // Internal Commands var int I_BATTERY_LEVEL = 0 var int I_TIME = 1 var int I_VERSION = 2 var int I_ID_REQUEST = 3 var int I_ID_RESPONSE = 4 var int I_INCLUSION_MODE = 5 var int I_CONFIG = 6 var int I_FIND_PARENT = 7 var int I_FIND_PARENT_RESPONSE = 8 var int I_LOG_MESSAGE = 9 var int I_CHILDREN = 10 var int I_SKETCH_NAME = 11 var int I_SKETCH_VERSION = 12 var int I_REBOOT = 13 var int I_GATEWAY_READY = 14 // Mappings var HashMap<String, String> sensorToItemsMap = newLinkedHashMap( //**************// // NODE ID's // //**************// // 0 = Gateway // 1-6 = Basement // 7-10 = Stairwell // 11-26 = LivingRoom // 27-42 = DiningRoom // 43-58 = BathRoom // 59-74 = Kitchen // 75-90 = Master Bedroom // 91-106 = Bedroom // 107-122 = Kid's Room // 123-138 = Hallway // 139-142 = Toilet // 143-152 = Attic // 153-168 = Backyard // 169-184 = Front yard // 185-200 = Driveway // 201-216 = Garage // 217-232 = Shed // 233-248 = Terrace // 249-254 = Spare //***Basement*** //*****Sensor1***** "1;0;" -> "BA_Basement_BatteryLevel1", "BA_Basement_BatteryLevel1" -> "1;0;", "1;1;" -> "BA_Basement_Humidity1", "BA_Basement_Humidity1" -> "1;1;", "1;2;" -> "BA_Basement_Temperature1", "BA_Basement_Temperature1" -> "1;2;", "1;3;" -> "BA_Basement_LightLevel1", "BA_Basement_LightLevel1" -> "1;3;", "1;4;" -> "BA_Basement_Window1", "BA_Basement_Window1" -> "1;4;", "1;5;" -> "BA_Basement_Window2", "BA_Basement_Window2" -> "1;5;", //"1;6;" -> "digital", //"digital" -> "1;6;", //"1;7;" -> "digital", //"digital" -> "1;7;", //"1;8;" -> "digital", //"digital" -> "1;8;", //"1;9;" -> "digital", //"digital" -> "1;9;", //***Stairwell*** //*****Sensor1***** "7;0;" -> "BA_Stairwell_BatteryLevel1", "BA_Stairwell_BatteryLevel1" -> "7;0;", "7;1;" -> "BA_Stairwell_Humidity1", "BA_Stairwell_Humidity1" -> "7;1;", "7;2;" -> "BA_Stairwell_Temperature1", "BA_Stairwell_Temperature1" -> "7;2;", "7;3;" -> "BA_Stairwell_LightLevel1", "BA_Stairwell_LightLevel1" -> "7;3;", "7;4;" -> "BA_Stairwell_Window1", "BA_Stairwell_Window1" -> "7;4;", "7;5;" -> "BA_Stairwell_Window2", "BA_Stairwell_Window2" -> "7;5;", //"7;6;" -> "digital", //"digital" -> "7;6;", //"7;7;" -> "digital", //"digital" -> "7;7;", //"7;8;" -> "digital", //"digital" -> "7;8;", //"7;9;" -> "digital", //"digital" -> "7;9;", //***LivingRoom*** //*****Sensor1***** "11;0;" -> "GF_LivingRoom_BatteryLevel1", "GF_LivingRoom_BatteryLevel1" -> "11;0;", "11;1;" -> "GF_LivingRoom_Humidity1", "GF_LivingRoom_Humidity1" -> "11;1;", "11;2;" -> "GF_LivingRoom_Temperature1", "GF_LivingRoom_Temperature1" -> "11;2;", "11;3;" -> "GF_LivingRoom_LightLevel1", "GF_LivingRoom_LightLevel1" -> "11;3;", "11;4;" -> "GF_LivingRoom_Window1", "GF_LivingRoom_Window1" -> "11;4;", "11;5;" -> "GF_LivingRoom_Window2", "GF_LivingRoom_Window2" -> "11;5;", //"11;6;" -> "digital", //"digital" -> "11;6;", //"11;7;" -> "digital", //"digital" -> "11;7;", //"11;8;" -> "digital", //"digital" -> "11;8;", //"11;9;" -> "digital", //"digital" -> "11;9;", //*****Sensor2***** "12;0;" -> "GF_LivingRoom_BatteryLevel2", "GF_LivingRoom_BatteryLevel2" -> "12;0;", "12;1;" -> "GF_LivingRoom_Humidity2", "GF_LivingRoom_Humidity2" -> "12;1;", "12;2;" -> "GF_LivingRoom_Temperature2", "GF_LivingRoom_Temperature2" -> "12;2;", "12;3;" -> "GF_LivingRoom_LightLevel2", "GF_LivingRoom_LightLevel2" -> "12;3;", "12;4;" -> "GF_LivingRoom_Window3", "GF_LivingRoom_Window3" -> "12;4;", "12;5;" -> "GF_LivingRoom_Window4", "GF_LivingRoom_Window4" -> "12;5;", //"12;6;" -> "digital", //"digital" -> "12;6;", //"12;7;" -> "digital", //"digital" -> "12;7;", //"12;8;" -> "digital", //"digital" -> "12;8;", //"12;9;" -> "digital", //"digital" -> "12;9;", //***DiningRoom*** //*****Sensor1***** "27;0;" -> "GF_Dining_BatteryLevel1", "GF_Dining_BatteryLevel1" -> "27;0;", "27;1;" -> "GF_Dining_Humidity1", "GF_Dining_Humidity1" -> "27;1;", "27;2;" -> "GF_Dining_Temperature1", "GF_Dining_Temperature1" -> "27;2;", "27;3;" -> "GF_Dining_LightLevel1", "GF_Dining_LightLevel1" -> "27;3;", "27;4;" -> "GF_Dining_Window1", "GF_Dining_Window1" -> "27;4;", "27;5;" -> "GF_Dining_Window2", "GF_Dining_Window2" -> "27;5;", //"27;6;" -> "digital", //"digital" -> "27;6;", //"27;7;" -> "digital", //"digital" -> "27;7;", //"27;8;" -> "digital", //"digital" -> "27;8;", //"27;9;" -> "digital", //"digital" -> "27;9;", //***BathRoom*** //*****Sensor1***** "43;0;" -> "GF_Bathroom_BatteryLevel1", "GF_Bathroom_BatteryLevel1" -> "43;0;", "43;1;" -> "GF_Bathroom_Humidity1", "GF_Bathroom_Humidity1" -> "43;1;", "43;2;" -> "GF_Bathroom_Temperature1", "GF_Bathroom_Temperature1" -> "43;2;", "43;3;" -> "GF_Bathroom_LightLevel1", "GF_Bathroom_LightLevel1" -> "43;3;", "43;4;" -> "GF_Bathroom_Window1", "GF_Bathroom_Window1" -> "43;4;", "43;5;" -> "GF_Bathroom_Window2", "GF_Bathroom_Window2" -> "43;5;", //"43;6;" -> "digital", //"digital" -> "43;6;", //"43;7;" -> "digital", //"digital" -> "43;7;", //"43;8;" -> "digital", //"digital" -> "43;8;", //"43;9;" -> "digital", //"digital" -> "43;9;", //***Kitchen*** //*****Sensor1***** "59;0;" -> "GF_Kitchen_BatteryLevel1", "GF_Kitchen_BatteryLevel1" -> "59;0;", "59;1;" -> "GF_Kitchen_Humidity1", "GF_Kitchen_Humidity1" -> "59;1;", "59;2;" -> "GF_Kitchen_Temperature1", "GF_Kitchen_Temperature1" -> "59;2;", "59;3;" -> "GF_Kitchen_LightLevel1", "GF_Kitchen_LightLevel1" -> "59;3;", "59;4;" -> "GF_Kitchen_Window1", "GF_Kitchen_Window1" -> "59;4;", "59;5;" -> "GF_Kitchen_Window2", "GF_Kitchen_Window2" -> "59;5;", //"59;6;" -> "digital", //"digital" -> "59;6;", //"59;7;" -> "digital", //"digital" -> "59;7;", //"59;8;" -> "digital", //"digital" -> "59;8;", //"59;9;" -> "digital", //"digital" -> "59;9;", //***Master bedroom*** //*****Sensor1***** "75;0;" -> "GF_MasterBedroom_BatteryLevel1", "GF_MasterBedroom_BatteryLevel1"-> "75;0;", "75;1;" -> "GF_MasterBedroom_Humidity1", "GF_MasterBedroom_Humidity1" -> "75;1;", "75;2;" -> "GF_MasterBedroom_Temperature1", "GF_MasterBedroom_Temperature1" -> "75;2;", "75;3;" -> "GF_MasterBedroom_LightLevel1", "GF_MasterBedroom_LightLevel1" -> "75;3;", "75;4;" -> "GF_MasterBedroom_Window1", "GF_MasterBedroom_Window1" -> "75;4;", "75;5;" -> "GF_MasterBedroom_Window2", "GF_MasterBedroom_Window2" -> "75;5;", //"75;6;" -> "digital", //"digital" -> "75;6;", //"75;7;" -> "digital", //"digital" -> "75;7;", //"75;8;" -> "digital", //"digital" -> "75;8;", //"75;9;" -> "digital", //"digital" -> "75;9;", //***Bedroom*** //*****Sensor1***** "91;0;" -> "GF_Bedroom_BatteryLevel1", "GF_Bedroom_BatteryLevel1" -> "91;0;", "91;1;" -> "GF_Bedroom_Humidity1", "GF_Bedroom_Humidity1" -> "91;1;", "91;2;" -> "GF_Bedroom_Temperature1", "GF_Bedroom_Temperature1" -> "91;2;", "91;3;" -> "GF_Bedroom_LightLevel1", "GF_Bedroom_LightLevel1" -> "91;3;", "91;4;" -> "GF_Bedroom_Window1", "GF_Bedroom_Window1" -> "91;4;", "91;5;" -> "GF_Bedroom_Window2", "GF_Bedroom_Window2" -> "91;5;", //"91;6;" -> "digital", //"digital" -> "91;6;", //"91;7;" -> "digital", //"digital" -> "91;7;", //"91;8;" -> "digital", //"digital" -> "91;8;", //"91;9;" -> "digital", //"digital" -> "91;9;", //***Kid's room*** //*****Sensor1***** "107;0;" -> "GF_KidsRoom_BatteryLevel1", "GF_KidsRoom_BatteryLevel1" -> "107;0;", "107;1;" -> "GF_KidsRoom_Humidity1", "GF_KidsRoom_Humidity1" -> "107;1;", "107;2;" -> "GF_KidsRoom_Temperature1", "GF_KidsRoom_Temperature1" -> "107;2;", "107;3;" -> "GF_KidsRoom_LightLevel1", "GF_KidsRoom_LightLevel1" -> "107;3;", "107;4;" -> "GF_KidsRoom_Window1", "GF_KidsRoom_Window1" -> "107;4;", "107;5;" -> "GF_KidsRoom_Window2", "GF_KidsRoom_Window2" -> "107;5;", //"107;6;" -> "digital", //"digital" -> "107;6;", //"107;7;" -> "digital", //"digital" -> "107;7;", //"107;8;" -> "digital", //"digital" -> "107;8;", //"107;9;" -> "digital", //"digital" -> "107;9;", //***Hallway*** //*****Sensor1***** "123;0;" -> "GF_Hallway_BatteryLevel1", "GF_Hallway_BatteryLevel1" -> "123;0;", "123;1;" -> "GF_Hallway_Humidity1", "GF_Hallway_Humidity1" -> "123;1;", "123;2;" -> "GF_Hallway_Temperature1", "GF_Hallway_Temperature1" -> "123;2;", "123;3;" -> "GF_Hallway_LightLevel1", "GF_Hallway_LightLevel1" -> "123;3;", "123;4;" -> "GF_Hallway_Window1", "GF_Hallway_Window1" -> "123;4;", "123;5;" -> "GF_Hallway_Window2", "GF_Hallway_Window2" -> "123;5;", //"123;6;" -> "digital", //"digital" -> "123;6;", //"123;7;" -> "digital", //"digital" -> "123;7;", //"123;8;" -> "digital", //"digital" -> "123;8;", //"123;9;" -> "digital", //"digital" -> "123;9;", //***Toilet*** //*****Sensor1***** "139;0;" -> "GF_Toilet_BatteryLevel1", "GF_Toilet_BatteryLevel1" -> "139;0;", "139;1;" -> "GF_Toilet_Humidity1", "GF_Toilet_Humidity1" -> "139;1;", "139;2;" -> "GF_Toilet_Temperature1", "GF_Toilet_Temperature1" -> "139;2;", "139;3;" -> "GF_Toilet_LightLevel1", "GF_Toilet_LightLevel1" -> "139;3;", "139;4;" -> "GF_Toilet_Window1", "GF_Toilet_Window1" -> "139;4;", "139;5;" -> "GF_Toilet_Window2", "GF_Toilet_Window2" -> "139;5;", //"139;6;" -> "digital", //"digital" -> "139;6;", //"139;7;" -> "digital", //"digital" -> "139;7;", //"139;8;" -> "digital", //"digital" -> "139;8;", //"139;9;" -> "digital", //"digital" -> "139;9;", //***Attic*** //*****Sensor1***** "143;0;" -> "FF_Attic_BatteryLevel1", "FF_Attic_BatteryLevel1" -> "143;0;", "143;1;" -> "FF_Attic_Humidity1", "FF_Attic_Humidity1" -> "143;1;", "143;2;" -> "FF_Attic_Temperature1", "FF_Attic_Temperature1" -> "143;2;", "143;3;" -> "FF_Attic_LightLevel1", "FF_Attic_LightLevel1" -> "143;3;", "143;4;" -> "FF_Attic_Window1", "FF_Attic_Window1" -> "143;4;", "143;5;" -> "FF_Attic_Window2", "FF_Attic_Window2" -> "143;5;", //"143;6;" -> "digital", //"digital" -> "143;6;", //"143;7;" -> "digital", //"digital" -> "143;7;", //"143;8;" -> "digital", //"digital" -> "143;8;", //"143;9;" -> "digital", //"digital" -> "143;9;", //***Backyard*** //*****Sensor1***** "153;0;" -> "OS_Backyard_BatteryLevel1", "OS_Backyard_BatteryLevel1" -> "153;0;", "153;1;" -> "OS_Backyard_Humidity1", "OS_Backyard_Humidity1" -> "153;1;", "153;2;" -> "OS_Backyard_Temperature1", "OS_Backyard_Temperature1" -> "153;2;", "153;3;" -> "OS_Backyard_LightLevel1", "OS_Backyard_LightLevel1" -> "153;3;", "153;4;" -> "OS_Backyard_Window1", "OS_Backyard_Window1" -> "153;4;", "153;5;" -> "OS_Backyard_Window2", "OS_Backyard_Window2" -> "153;5;", //"153;6;" -> "digital", //"digital" -> "153;6;", //"153;7;" -> "digital", //"digital" -> "153;7;", //"153;8;" -> "digital", //"digital" -> "153;8;", //"153;9;" -> "digital", //"digital" -> "153;9;", //***Front yard*** //*****Sensor1***** "169;0;" -> "OS_FrontYard_BatteryLevel1", "OS_FrontYard_BatteryLevel1" -> "169;0;", "169;1;" -> "OS_FrontYard_Humidity1", "OS_FrontYard_Humidity1" -> "169;1;", "169;2;" -> "OS_FrontYard_Temperature1", "OS_FrontYard_Temperature1" -> "169;2;", "169;3;" -> "OS_FrontYard_LightLevel1", "OS_FrontYard_LightLevel1" -> "169;3;", "169;4;" -> "OS_FrontYard_Window1", "OS_FrontYard_Window1" -> "169;4;", "169;5;" -> "OS_FrontYard_Window2", "OS_FrontYard_Window2" -> "169;5;", //"169;6;" -> "digital", //"digital" -> "169;6;", //"169;7;" -> "digital", //"digital" -> "169;7;", //"169;8;" -> "digital", //"digital" -> "169;8;", //"169;9;" -> "digital", //"digital" -> "169;9;", //***Driveway*** //*****Sensor1***** "185;0;" -> "OS_Driveway_BatteryLevel1", "OS_Driveway_BatteryLevel1" -> "185;0;", "185;1;" -> "OS_Driveway_Humidity1", "OS_Driveway_Humidity1" -> "185;1;", "185;2;" -> "OS_Driveway_Temperature1", "OS_Driveway_Temperature1" -> "185;2;", "185;3;" -> "OS_Driveway_LightLevel1", "OS_Driveway_LightLevel1" -> "185;3;", "185;4;" -> "OS_Driveway_Window1", "OS_Driveway_Window1" -> "185;4;", "185;5;" -> "OS_Driveway_Window2", "OS_Driveway_Window2" -> "185;5;", //"185;6;" -> "digital", //"digital" -> "185;6;", //"185;7;" -> "digital", //"digital" -> "185;7;", //"185;8;" -> "digital", //"digital" -> "185;8;", //"185;9;" -> "digital", //"digital" -> "185;9;", "190;1;" -> "OS_Driveway_Motion1", "OS_Driveway_Motion1" -> "190;1;", "190;2;" -> "OS_Driveway_Motion2", "OS_Driveway_Motion2" -> "190;2;", //***Garage*** //*****Sensor1***** "201;0;" -> "OS_Garage_BatteryLevel1", "OS_Garage_BatteryLevel1" -> "201;0;", "201;1;" -> "OS_Garage_Humidity1", "OS_Garage_Humidity1" -> "201;1;", "201;2;" -> "OS_Garage_Temperature1", "OS_Garage_Temperature1" -> "201;2;", "201;3;" -> "OS_Garage_LightLevel1", "OS_Garage_LightLevel1" -> "201;3;", "201;4;" -> "OS_Garage_Window1", "OS_Garage_Window1" -> "201;4;", "201;5;" -> "OS_Garage_Window2", "OS_Garage_Window2" -> "201;5;", //"201;6;" -> "digital", //"digital" -> "201;6;", //"201;7;" -> "digital", //"digital" -> "201;7;", //"201;8;" -> "digital", //"digital" -> "201;8;", //"201;9;" -> "digital", //"digital" -> "201;9;", //***Shed*** //*****Sensor1***** "217;0;" -> "OS_Shed_BatteryLevel1", "OS_Shed_BatteryLevel1" -> "217;0;", "217;1;" -> "OS_Shed_Humidity1", "OS_Shed_Humidity1" -> "217;1;", "217;2;" -> "OS_Shed_Temperature1", "OS_Shed_Temperature1" -> "217;2;", "217;3;" -> "OS_Shed_LightLevel1", "OS_Shed_LightLevel1" -> "217;3;", "217;4;" -> "OS_Shed_Window1", "OS_Shed_Window1" -> "217;4;", "217;5;" -> "OS_Shed_Window2", "OS_Shed_Window2" -> "217;5;", //"217;6;" -> "digital", //"digital" -> "217;6;", //"217;7;" -> "digital", //"digital" -> "217;7;", //"217;8;" -> "digital", //"digital" -> "217;8;", //"217;9;" -> "digital", //"digital" -> "217;9;", //***Terrace**** //*****Sensor1***** "233;0;" -> "OS_Terrace_BatteryLevel1", "OS_Terrace_BatteryLevel1" -> "233;0;", "233;1;" -> "OS_Terrace_Humidity1", "OS_Terrace_Humidity1" -> "233;1;", "233;2;" -> "OS_Terrace_Temperature1", "OS_Terrace_Temperature1" -> "233;2;", "233;3;" -> "OS_Terrace_LightLevel1", "OS_Terrace_LightLevel1" -> "233;3;", "233;4;" -> "OS_Terrace_Window1", "OS_Terrace_Window1" -> "233;4;", "233;5;" -> "OS_Terrace_Window2", "OS_Terrace_Window2" -> "233;5;" //"233;6;" -> "digital", //"digital" -> "233;6;", //"233;7;" -> "digital", //"digital" -> "233;7;", //"233;8;" -> "digital", //"digital" -> "233;8;", //"233;9;" -> "digital", //"digital" -> "233;9;", ) //receiving msg from mysensors gateway rule "Arduino sends to Openhab" when Item Arduino received update then var String lineBuffer = Arduino.state.toString.split("\n") logInfo("SerialGW","Linebuff="+lineBuffer) logInfo("SerialGW","??????") for (String line : lineBuffer) { var String[] message = line.split(";") var Integer nodeId = new Integer(message.get(0)) var Integer childId = new Integer(message.get(1)) var Integer msgType = new Integer(message.get(2)) var Integer ack = new Integer(message.get(3)) var Integer subType = new Integer(message.get(4)) var String msg = message.get(5) if(msgType == 1 ){ if (subType == V_TEMP){ postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), msg) println ("Temp item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " temp: " + msg ) } if (subType == V_HUM){ postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), msg) println ("Hum item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " hum: " + msg ) } if (subType == V_LIGHT_LEVEL){ postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), msg) println ("Light item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " light: " + msg ) } if (subType == V_VOLTAGE){ postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), msg) println ("Voltage item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " voltage: " + msg ) } if (subType == V_LOCK_STATUS){ var String lockstatus="OPEN" if (msg=="1"){ lockstatus="CLOSED" } postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), lockstatus) println ("Door/Window item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " Status: " + lockstatus ) } if (subType == V_TRIPPED){ var String tripped="CLOSED" if (msg=="1"){ tripped="OPEN" } postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), tripped) println ("Button/Contact item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " Status: " + tripped ) } if (subType == V_LIGHT){ var String light="OFF" if (msg=="1"){ light="ON" } postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), light) println ("Light item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " Light: " + light ) } } // Internal Command if(msgType == 3){ if(subType == I_SKETCH_NAME){ println("Sketch name: " + msg ) sketchName=msg } if(subType == I_SKETCH_VERSION){ println("Sketch version: " + msg ) postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), sketchName+" " +msg ) sketchName="" } } } end
Really could use some help cause this is really fudging up my home automation
PS: as you can see from the enormous rule file i am still using the serial binding in openhab, not the mysensors binding.
-
RE: Serial gateway.rules sharing
@timo Do you use the mySensors binding or the serial binding to get your sensor data into openhab? I use the serial binding, so i have a rule to send the data to the right items. (btw since yesterday something broke and the data is no longer distributed to the items ). Might have to move over to the mySensors binding to. How is it working for you?
-
Batt/temp/hum/light/6*dig pcb for grabs
Can i interrest anyone in a pcb design + code for a battery powered (2*AA) sensornode for arduino pro mini 3v3? Can measure temperature/humidity by DHT22, light intensety by TSL2561 with jumpered interupt trace and 6 digital inputs (with interrupt configurable pull-up/down). Allso has voltagedevider for battery measurement. You can pin on any onewire sensor (3v3) instead of DHT22 (with same pinout) or any I2C sensor (5v) instead of TSL2561 (with same pinout), but code is written for these sensors. You're welcome to rewrite the code or write your own (just share a copy with me). Nodes are running in my home for >1 year now and work great. I'm writing this on my phone so don't have the files at hand, but if anyone is interested just reply to this post and i will post the files. Sharing is power!
Today i allso ordered the prototype pcb's for dual motion sensor/repeater with 230VAC onboard powersupply. If it checkes out i will be sharing this to.
-
Serial gateway.rules sharing
Is there anyone out there who wants to share their serial gateway.rules file? Since i'm not so great at writing rules in openhab in i think Xtend . I would love to see how other people do things. Very likely i can learn alot from it
-
Set sensor name & type (received) in openhab items
Hi guys,
I was wondering if there was a way to ask a node for its name and type (eg. Temp/hum) and put it into openhab items? Right now i have this information hardcoded in openhab, wich means when i swap node id's or upgrade sensors i have to manualy recode these values. If anyone has some example code i would love to see it. Using serial gateway btw, not the binding. -
RE: Cant set static node ID above 254
@mfalkvidd hi, i'm building a home automation system with mysensors, openhab, milight, .... . Like most people who use mysensors i guess. Most of my node id's aren't populated yet. But when i started out i devised a table with node id ranges. One range for every room. To be shure i went ahaid and reserved 20 id's per range. Just so i wouldn't run out of id's in the future, since this looks to be a never ending project. I reserved the higher ranges for zones outside and since up untill now i had no sensors outside i didn't notice my ranges where to high. Now i rewrote my range table so i have 17 id's per zone (should be more then enough) and rooms like toilet only 4 id's (right, like i was going to put 20 sensors in my toilet ). So everything should be fine. I spend today recoding openhab and flashing nodes. Everything is running like it should again and even found some typos.
-
Cant set static node ID above 254
Hello,
I have several mysensors running and reporting to my openhab over serial. I made node ID ranges for every room in the house. been running without a problem for more than a year now. Now i wanted to add some motion sensors to my openhab for the driveway (node ID range 290-310). The first 5 ID's are ment for temp/hum/light/digIn nodes. I wanted to use 295-300 for motion detector nodes. But when i compile my firmware with MY_NODE_ID 295 i see in serial monitor the node got static ID 39? Seems like this happens to any ID above 254. Am I limited to 254 nodes + GW? because if so i have to do a lot of reprogramming in open hab.