Skip to content

OpenHAB

204 Topics 2.4k Posts
  • Motion Sensor Setup in OpenHAB

    4
    0 Votes
    4 Posts
    6k Views
    M
    @Matt-Pitts A very small simplification - in your first rule have you tried: if (hall_motion_raw.state == 1) sendCommand(Toggle_2,ON) I am not sure if it works but hall_motion-raw.state is a number so I think it should but it is always hard to predict how Openhab item states works in rules. I hate all these conversions like "as Decimaltype" needed in many places. How simple the rules can be made depends also on the settings of your sensor. My motion sensor (z-wave) sends ON when triggered and OFF after a set time after untriggered. So the rules become really simple. Without knowing how your sensor type and setup thus it is hard to comment much. From reading about the most common type of sensor it seems that If it has the jumper set to retriggering then the signal stays on until motion is no longer detected while set to non-retriggering the signal varies on/off as triggered. If your sensor works the "retriggering" way the rule for "hallLigtOff" may work with something like: rule "hallLightOff" when Item hall_motion_raw changed then if(hall_motion_raw.state ==0) sendCommand(Toggle_2,OFF) end Sorry for not being entirely sure about how this sensor works but I have not used it or experimented with it. I need to try it some day. UPDATE: I tested one of these sensors today (referring to settings described here http://www.mysensors.org/build/motion) : Jumper set to "auto reset"- sketch sends 1 and then a 0 comes when there is no motion and timer runs out. Jumper set to "no reset" - sketch sends 1 and then 0 comes after timer has run out, if motion still detected a 1 is sent again followed by a 0 when timer runs out and so on. So as long as motion is detected this goes on over and over again. When using "auto-reset" the rule above ought to work (if the "DecimalType conversion can be deleted, otherwise with this added)
  • MQTT Client Gateway with Uno?

    11
    0 Votes
    11 Posts
    5k Views
    G
    Fantastic thanks for the tips and direction. While it may not look look like much... It works! [image: 1455787323187-fullsizerender.jpg] And after a quick update to the openHAB items file they update just the same as the MQTT broker gateway. Now time to build it into a nice plastic box and figure out how to send it data for a relay. Thanks again. Cheers, George
  • Pulse Power Meter with OpenHAB?

    7
    0 Votes
    7 Posts
    5k Views
    M
    @joseraj Yes, the V_VAR2 solution works well. I have used it for a long time. Of course it is possible to modify the sketch so that no request for a start value is made and always start at 0. But I like the idea of getting a start value from the controller when it is needed to restart the node.
  • GatewayW5100MQTTClient - Setup Best Practice

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • MQTT gateway works great but drops the connection every 2 mins?

    9
    0 Votes
    9 Posts
    4k Views
    G
    @DerPest great thanks for that. Yes I will give the MQTT client gateway a try tomorrow. Thanks. Regards, George
  • OpenHab Tests

    6
    0 Votes
    6 Posts
    2k Views
    M
    @soloam Yes, the state makes the difference of course. Because you had used command for all definitions I assumed that your intention was to also send in a command from outside of Openhab to control the light. Glad you found a solution.
  • 0 Votes
    6 Posts
    3k Views
    M
    @gregl I have used this procedure a few times: Define for example a V_VAR1 message for the query (or use any other suitable message type depending on purpose), Make a MQTT binding for this message i Openhab (for example bind it to a switch, a number or whatever fits the purpose) Make a rule in Openhab that reacts on this incoming message ("When Item xxxxx received update then ......) Fix whatever logic is needed in this rule so you can send the queried info back to the sensor. If no existing binding is suitable you can of course define a V_VAR2 message (or use other type which fits) for the return message. In the "Incomingmessage" function use whatever logic is needed to decode the returned message. Reason for choosing a custom type of message (like a V_VAR2) for sending the info back is of course that it is easy to sort it out from the stream entering the incoming messages function. If you have no other incoming messages or the logic for the queried info already is in place then you do not have to think about this. Hope the explanation is understandable, if not please revert.
  • OpenHAB setup

    4
    0 Votes
    4 Posts
    2k Views
    M
    @moskovskiy82 You will find the discussion in the threads if searching. The current v1.5 gateway is a (rough) broker with some problems (even though mine has run well for a long time). The next one is a MQTT client and is based on ESP8266 and is available from the development branch at GitHub. Using this you also need a broker, for example Mosquitto, somewhere in the network. I have just installed Mosquitto at my Openhab RPi gateway and will start testing the WSP8266 MQTT gateway client one of these days. I have already run it for a few minutes and it worked so far.
  • 0 Votes
    2 Posts
    1k Views
    greglG
    im pretty sure I turned it off in mosquito - namely for opentracks.
  • Openhab und mqtt: autoassign node IDs and howto use them

    7
    0 Votes
    7 Posts
    3k Views
    M
    Maybe this information should be put on the webpage for the openhab? It took quite some time to find the answer
  • 3 state switch and what to send via mqtt

    3
    0 Votes
    3 Posts
    1k Views
    dakkyD
    yep, i'm afraid that's the way to go. Thanks for ACK
  • Gui "switches" behaves crazy when pressing

    4
    0 Votes
    4 Posts
    1k Views
    ahmedadelhosniA
    @dakky The sequence is as follows: In the demo script. Go to "Group Demo" > "No. of Active Heaters" I pressed on "Office" to switch it off. GUI updated. then pressed on "Child's Room@ to switch it off. GUI was not updated. then pressed on "Bedroom" to switch it off. GUI was updated + switch position for "Child's room" was set to OFF. I am using 1.7.1 I noticed that this is reproducible more when I connect remotely using my.openhab. 22:36:34.813 [INFO ] [runtime.busevents :22 ] - Heating_FF_Office received command OFF 22:36:34.825 [DEBUG] [.p.rrd4j.internal.RRD4jService:113 ] - Stored 'Heating_FF_Office' with state 'ON' in rrd4j database (again) 22:36:34.828 [DEBUG] [.p.rrd4j.internal.RRD4jService:132 ] - Stored 'Heating_FF_Office' with state '0' in rrd4j database 22:36:35.232 [DEBUG] [o.o.i.r.i.b.GeneralBroadcaster:46 ] - broadcaster 'org.openhab.io.rest.internal.broadcaster.GeneralBroadcaster$1@adfa88' is empty 22:36:35.234 [DEBUG] [o.i.r.i.resources.ItemResource:193 ] - Received HTTP POST request at 'items/Heating_FF_Child' with value 'OFF'. 22:36:35.237 [INFO ] [runtime.busevents :22 ] - Heating_FF_Child received command OFF 22:36:35.248 [DEBUG] [.p.rrd4j.internal.RRD4jService:113 ] - Stored 'Heating_FF_Child' with state 'ON' in rrd4j database (again) 22:36:35.250 [DEBUG] [.p.rrd4j.internal.RRD4jService:132 ] - Stored 'Heating_FF_Child' with state '0' in rrd4j database 22:36:35.260 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at 'sitemaps/demo/030001' for media type 'null'. 22:36:35.944 [DEBUG] [o.i.r.i.resources.ItemResource:193 ] - Received HTTP POST request at 'items/Heating_FF_Bed' with value 'OFF'. 22:36:35.975 [INFO ] [runtime.busevents :22 ] - Heating_FF_Bed received command OFF 22:36:36.017 [DEBUG] [.p.rrd4j.internal.RRD4jService:113 ] - Stored 'Heating_FF_Bed' with state 'ON' in rrd4j database (again) 22:36:36.030 [DEBUG] [.p.rrd4j.internal.RRD4jService:132 ] - Stored 'Heating_FF_Bed' with state '0' in rrd4j database 22:36:36.650 [DEBUG] [o.o.i.r.i.b.GeneralBroadcaster:46 ] - broadcaster 'org.openhab.io.rest.internal.broadcaster.GeneralBroadcaster$1@adfa88' is empty 22:36:36.650 [DEBUG] [o.o.i.r.i.b.GeneralBroadcaster:46 ] - broadcaster 'org.openhab.io.rest.internal.broadcaster.GeneralBroadcaster$1@1539d1c' is empty 22:36:36.773 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at 'sitemaps/demo/0300' for media type 'null'. 22:36:36.776 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at 'sitemaps/demo/030001' for media type 'null'. 22:36:43.528 [DEBUG] [.o.b.http.internal.HttpBinding:163 ] - item 'Weather_Humidity' is about to be refreshed now
  • MQTT Binging - Possible two MQTT broker?

    10
    0 Votes
    10 Posts
    4k Views
    dakkyD
    You're welcome
  • Basic rule/rule file acting temperamental, again.

    2
    0 Votes
    2 Posts
    1k Views
    S
    The rule is now working, i have not changed a thing, just retried it after around 5 hours of leaving it alone. No restart since this morning or anything, just started to work for no reason. If an admin would like to remove this post due to unknown fix then you are more than welcome. Thank you, Sam.
  • Help needed - MQTT Ethernet gateway to Openhab

    mqtt openhab
    8
    0 Votes
    8 Posts
    5k Views
    S
    @gadu I'm sorry to bring up a post from the dead, but could someone point me in the right direction to find the MQTTGateway file/files for the RaspberryPI, i can only find the arduino ones and the possibility of a RPi one, here, but with no MakeFile to compile it.... Just a little background info and an ongoing topic located here at the forums of what I'm attempting to do and what is happening: Link
  • Openhab, Mosquitto, ESP-8266 12E wifi gateway

    10
    0 Votes
    10 Posts
    9k Views
    V
    And how did you configure domoticz? Did you use "Mysensors gateway with lan interface" type in hardware section or anything else? And may you send me the library files you used (I mean that complete zip which worked for you).
  • OpenHAB/MQTT Tips & Hints

    40
    0 Votes
    40 Posts
    58k Views
    YveauxY
    @ericsko sounds to me that you're missing a message instead of the Arduino being too 'slow'. But go ahead, use a single message to send the rgb value and post your findings in here!
  • openhab sendCommand problem with serialbinding (Solved)

    4
    0 Votes
    4 Posts
    5k Views
    Dave DanD
    @Shasha, have you tried this? https://github.com/openhab/openhab/wiki/Rules#concurrency-guard I'm currently trying the same (because I have the same issue) and wondering if you tried this before.
  • MQTT - OpenHAB - Mysensor Library -> How to subscribe?

    2
    0 Votes
    2 Posts
    2k Views
    siodS
    I would like to post my code here, but it´s actually not my code but the code from this website: link I am trying to make it MySensors MQTT Gateway compatible and I am not making any progress right now and need you help. First of all I would like to post the original arduino code from the above mentioned website: #include <SPI.h> #include <Ethernet.h> #include <PubSubClient.h> // http://knolleary.net/arduino-client-for-mqtt/ // MAC Adresse des Ethernet Shields byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; // IP des MQTT Servers byte server[] = { 192, 168, 2, 9 }; // Ethernet Client zur Kommunikation des MQTT Clients EthernetClient ethClient; // MQTT Client zur Kommunikation mit dem Server // Server - Variable des Types byte mit Serveradresse // 1883 - Ist der Standard TCP Port // callback - Function wird aufgerufen wen MQTT Nachrichten eintreffen. Am ende des Sketches // ethClient - Angabe des Ethernet Clients PubSubClient mqttClient(server, 1883, callback, ethClient); // Timervariable für eine Verzögerung. Als alternative zu delay was die verarbeitung anhält. int timer = 0; int EndTimer = 200; // Pins des RGB LED Strip int LEDred=5; int LEDgreen=6; int LEDblue=3; // Übermittelte Farbwerte int LEDredValue = 0; int LEDgreenValue = 0; int LEDblueValue = 0; // Gerade gesetzte Farbe int CURredValue = 0; int CURgreenValue = 0; int CURblueValue = 0; void setup() { // Setzen der PINS als Ausgang pinMode(LEDblue, OUTPUT); pinMode(LEDred, OUTPUT); pinMode(LEDgreen, OUTPUT); // Bei start Farbe Blau setzen analogWrite(LEDred, 0); analogWrite(LEDgreen, 0); analogWrite(LEDblue, 100); // Initialisierung des Ethernets if (Ethernet.begin(mac) == 0) { // Wenn DHCP fehlschlägt dann rot setzen und aufhören analogWrite(LEDred, 100); analogWrite(LEDgreen, 0); analogWrite(LEDblue, 0); while (true); } else { // Wenn DHCP OK ist dann grün setzen LEDgreenValue = 100; } } void loop() { // Aufbau der Verbindung mit MQTT falls diese nicht offen ist. if (!mqttClient.connected()) { mqttClient.connect("arduinoClient"); // Abonieren von Nachrichten mit dem angegebenen Topics mqttClient.subscribe("/openHAB/Nachtlicht/RED/#"); mqttClient.subscribe("/openHAB/Nachtlicht/GREEN/#"); mqttClient.subscribe("/openHAB/Nachtlicht/BLUE/#"); // Alternative Abonierung aller Topics unter /openHAB/Nachtlicht // mqttClient.subscribe("/openHAB/Nachtlicht/#"); } if (timer <= EndTimer) timer++; else { timer = 0; if (LEDredValue < CURredValue) CURredValue--; else if (LEDredValue > CURredValue) CURredValue++; if (LEDgreenValue < CURgreenValue) CURgreenValue--; else if (LEDgreenValue > CURgreenValue) CURgreenValue++; if (LEDblueValue < CURblueValue) CURblueValue--; else if (LEDblueValue > CURblueValue) CURblueValue++; } analogWrite(LEDred, CURredValue); analogWrite(LEDgreen, CURgreenValue); analogWrite(LEDblue, CURblueValue); mqttClient.loop(); // Schleife für MQTT } // =========================================================== // Callback Funktion von MQTT. Die Funktion wird aufgerufen // wenn ein Wert empfangen wurde. // =========================================================== void callback(char* topic, byte* payload, unsigned int length) { // Zähler int i = 0; // Hilfsvariablen für die Convertierung der Nachricht in ein String char message_buff[100]; // Kopieren der Nachricht und erstellen eines Bytes mit abschließender \0 for(i=0; i<length; i++) { message_buff[i] = payload[i]; } message_buff[i] = '\0'; // Konvertierung der nachricht in ein String String msgString = String(message_buff); // Überprüfung des Topis und setzen der Farbe je nach übermittelten Topic if (String(topic) == "/openHAB/Nachtlicht/RED") LEDredValue = round(msgString.toInt() * 2.55); if (String(topic) == "/openHAB/Nachtlicht/GREEN") LEDgreenValue = round(msgString.toInt() * 2.55); if (String(topic) == "/openHAB/Nachtlicht/BLUE") LEDblueValue = round(msgString.toInt() * 2.55); } and here follows my "modified" part. I hope you guys can support me here! #include <MySensor.h> #include <SPI.h> // Timervariable für eine Verzögerung. Als alternative zu delay was die verarbeitung anhält. int timer = 0; int EndTimer = 200; // Pins des RGB LED Strip int LEDred=3; int LEDgreen=4; int LEDblue=2; // Übermittelte Farbwerte int LEDredValue = 0; int LEDgreenValue = 0; int LEDblueValue = 0; // Gerade gesetzte Farbe int CURredValue = 0; int CURgreenValue = 0; int CURblueValue = 0; MySensor gw; MyMessage dimmerMsg(21, V_DIMMER); //21=Sensor ID 21, Dimmer; An/Aus MyMessage lightMsgR(22, V_LIGHT); //21=Sensor ID 21, Rot MyMessage lightMsgG(23, V_LIGHT); //21=Sensor ID 21, Grün MyMessage lightMsgB(24, V_LIGHT); //21=Sensor ID 21, Blau void setup() { //MySensors Library initialisieren gw.begin(); //Sensor ID und Typ übermitteln gw.present(21, S_DIMMER); gw.present(22, V_LIGHT); gw.present(23, V_LIGHT); gw.present(24, V_LIGHT); // Setzen der PINS als Ausgang pinMode(LEDblue, OUTPUT); pinMode(LEDred, OUTPUT); pinMode(LEDgreen, OUTPUT); // Bei start Farbe Blau setzen analogWrite(LEDred, 0); analogWrite(LEDgreen, 0); analogWrite(LEDblue, 100); } void loop() { // Abonieren von Nachrichten mit dem angegebenen Topics mqttClient.subscribe("/openHAB/Nachtlicht/RED/#"); mqttClient.subscribe("/openHAB/Nachtlicht/GREEN/#"); mqttClient.subscribe("/openHAB/Nachtlicht/BLUE/#"); } if (timer <= EndTimer) timer++; else { timer = 0; if (LEDredValue < CURredValue) CURredValue--; else if (LEDredValue > CURredValue) CURredValue++; if (LEDgreenValue < CURgreenValue) CURgreenValue--; else if (LEDgreenValue > CURgreenValue) CURgreenValue++; if (LEDblueValue < CURblueValue) CURblueValue--; else if (LEDblueValue > CURblueValue) CURblueValue++; } analogWrite(LEDred, CURredValue); analogWrite(LEDgreen, CURgreenValue); analogWrite(LEDblue, CURblueValue); mqttClient.loop(); // Schleife für MQTT } // =========================================================== // Callback Funktion von MQTT. Die Funktion wird aufgerufen // wenn ein Wert empfangen wurde. // =========================================================== void callback(char* topic, byte* payload, unsigned int length) { // Zähler int i = 0; // Hilfsvariablen für die Convertierung der Nachricht in ein String char message_buff[100]; // Kopieren der Nachricht und erstellen eines Bytes mit abschließender \0 for(i=0; i<length; i++) { message_buff[i] = payload[i]; } message_buff[i] = '\0'; // Konvertierung der nachricht in ein String String msgString = String(message_buff); // Überprüfung des Topis und setzen der Farbe je nach übermittelten Topic if (String(topic) == "/openHAB/Nachtlicht/RED") LEDredValue = round(msgString.toInt() * 2.55); if (String(topic) == "/openHAB/Nachtlicht/GREEN") LEDgreenValue = round(msgString.toInt() * 2.55); if (String(topic) == "/openHAB/Nachtlicht/BLUE") LEDblueValue = round(msgString.toInt() * 2.55); } I added LED Red, Green and Blue and set child ID´s to 22,23 and 24, 21 is for Dimmer. I have no idea if this done the right way MyMessage dimmerMsg(21, V_DIMMER); //21=Sensor ID 21, Dimmer; An/Aus MyMessage lightMsgR(22, V_LIGHT); //21=Sensor ID 21, Rot MyMessage lightMsgG(23, V_LIGHT); //21=Sensor ID 21, Grün MyMessage lightMsgB(24, V_LIGHT); //21=Sensor ID 21, Blau especially the following part is a big problem to me because I don´t know how to "subscribe" with the MySensors MQTT library: void loop() { // Abonieren von Nachrichten mit dem angegebenen Topics mqttClient.subscribe("/openHAB/Nachtlicht/RED/#"); mqttClient.subscribe("/openHAB/Nachtlicht/GREEN/#"); mqttClient.subscribe("/openHAB/Nachtlicht/BLUE/#"); } how must I modify this??
  • Using OpenHAB, any better (looking) alternatives?

    17
    1 Votes
    17 Posts
    28k Views
    K
    Sorry, I used the native mysensors support, not mqtt.

24

Online

11.7k

Users

11.2k

Topics

113.1k

Posts