Also from my side many thanks to the organizers, the presenters, and the other participants. I enjoyed the exchange very much and had a great day.
Posts made by 27maximilian
-
RE: Meetup in the Netherlands - Saturday July 30th, in Breda!
-
RE: Meetup in the Netherlands - Saturday July 30th, in Breda!
@Sander-Stolk if you didn't sell your ticket yet, then I would take it. My calender has freed up and I would be happy to join.
-
RE: Meetup in the Netherlands - Saturday July 30th, in Breda!
I would also be interested. But I didn't fill out the doodle because my schedule for the next month is not fully set yet. So it doesn't make sense to accommodate my preferences for the date as they might change.
I would just wait for you to set a date and then join if I am available, if you don't mind. South of Rotterdam would be perfectly fine for me. I would only suggest to meet somewhere close to a train station as some people (me included) might not have a car.
Regarding things to do, a workshop-like meeting in which people present their projects might be nice. I saw something similar in the OpenHAB forum.
-
RE: Guide: Setting up and testing MQTT Client Gateway
I am not sure because I never did this myself but I would try to not only use the command class but also the state class in OH.
Something like this could work:
Switch LIGHT_test {mqtt=">[mosqMQTT:mysensors-in/2/1/1/0/2:command:*:default],<[mosqMQTT:mysensors-out/2/1/1/0/2:state:default]"}
Please be aware that this is just an idea. I never implemented this so far, neither did I test the code. The syntax could be wrong or it might conceptually not work.
-
RE: Guide: Setting up and testing MQTT Client Gateway
Update: I guess I was answering while @hek also posted his answer.
I didn't do it, so I can only guess. But I believe this was done because otherwise the MQTT-topic would not include any information who the recipient is. This would on the one hand (1) make the GW send every message from a sensor back to the sensor and on the other hand (2) could cause infinite loops with controllers such as openhab.
Regarding (1), imagine the topic-strucutre would be like:
mysensors/6/1/1/0/0
for a temperature sensors with node id 6 and child id 1 without the in/out separation. If the sensor now sends a message with the temperature, e.g. 23, to the GW, then the GW posts a message with the payload 23 to the topic. However, because there is no in/out separation, the GW listens to all messages on the topic
mysensors/#
and hence receives it own message, which it then sends back to the originating sensor. Not only would this double the traffic in your radio network, it might also be problematic for bidirectional sensors, such as a relay, because it would also cause an infinite loop.
Regarding the infinite loop, I will use (2) as an example but the same would happen for a bidirectional sensor. Consider you would have a relay sensors, that can be locally or remotely trigged, as for example a lights relay with switch. In openhab this relay could be defined like this:
Switch LIGHT_test {mqtt=">[mosqMQTT:mysensors/2/1/1/0/2:command:*:default],>[mosqMQTT:mysensors/2/1/1/0/2:command:default]"}
Imagine the local switch is trigged on the relay, then the sensor sends a message to the GW, which posts this message on the mqtt-topic:
mysensors/2/1/1/0/2
The OH receives this message, updates the state of this item but also posts a message on the topic because of the item configuration, which would generate an infinite loop. If the sensor would do the same then we would have an infinite loop, in which the number of messages would double each iteration.
-
RE: Guide: Setting up and testing MQTT Client Gateway
I believe these examples are mostly referring to the older MQTT (Broker) Gateway. As @hek said in post #1 the client gateway resembles the serial protocol. The difference between the two is on the one hand a slightly modified topic structure and on the other hand that instead of names the topics make use of the number representation of the message types (see the Serial API).
In your example you would have to use 3 instead of V_DIMMER as CMD-TYPE in your topic-configuration.
If you are wondering whether there is a library which you can included in your items-file in openhab such that you can use the name representation instead of the values for the message type, then I am afraid I don't have a solution for you. I am, moreover, pretty sure that this won't be possible with the mqtt-binding but would require a specific mysensors binding for openhab.
-
Event Drops: Visualizing message frequencies with d3.js
For the fine tuning of my MySensors network (e.g. for placing the sensor nodes), I was so far checking the incoming messages via the log of my controller. But since this becomes a bit tedious over time, I was looking for a simple way to visualize the frequency of these messages. To be precise, I do not mean to visualize the content of the incoming messages but only that the controller received a message from a node. The result looks like this:
The graph is made with Event Drops, which makes use of the d3.js library. I basically just installed the demo in an apache and modified it such that it gets the data about my MySensor nodes. The data is stored in two tables, sensors and pings, in a MySQL-database:
sensors --------- id: INT name: CHAR(25)
pings --------- sensor: INT date: DATETIME
The table sensors holds a row for each sensor that I want to be included in the graph, in which id is equal to the node id. In the table pings, my controller inserts a new entry with the node id in the field sensor and the current time in the field date each time it receives a message from a node.
A php-script that replaces the index.html of the Event Drops demo, queries the data and builds a JS-array according to this definition:
<?php $username = "db_user"; $password = "passwd"; $host = "localhost"; $dbname="mysensors_db"; // Create connection $conn = new mysqli($host, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT id, name FROM sensors"; $result = $conn->query($sql); $outdata = "var data = ["; $firstA = True; if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { if (! $firstA) {$outdata = $outdata . ", "; } $firstA = False; $outdata = $outdata . "{ name : \"" . $row["name"]. "\" , dates : [ " ; $sqlPings = "SELECT date FROM pings WHERE sensor=".$row["id"]; $resultPings = $conn->query($sqlPings); $firstB = True; while($rowPings = $resultPings->fetch_assoc()) { if (! $firstB) {$outdata = $outdata . ", "; } $outdata = $outdata . "new Date('". str_replace("-","/",$rowPings["date"]) ."')"; $firstB = false; } $outdata = $outdata . "] }"; } } else { echo "0 results"; } $outdata = $outdata . "]"; mysqli_close($conn); ?> <!DOCTYPE html> <meta charset="utf-8"> <html> <head> <title>Event Drops Demo</title> <link rel="stylesheet" href="../eventdrops/eventDrops.css" /> </head> <body> <h1>Event Drops MySensors</h1> <script src="../d3/d3.js"></script> <script src="../eventdrops/eventDrops.js"></script> <script> <?php echo $outdata; ?> </script> <script src="./demo.js"></script> <p> Released under MIT license, courtesy of <a href="http://marmelab.com/">marmelab</a> and <a href="https://github.com/canalplus">Canal Plus</a>. More details on our <a href="https://github.com/marmelab/EventDrops">GitHub repository</a>. </p> </body> </html>
In the demo.js I just removed all declarations to create random data and changed the interval from 6 months to half a day:
/*eslint-disable */ var endTime = Date.now(); var day = 24 * 60 * 60 * 1000; var startTime = endTime - 0.5 * day; var color = d3.scale.category20(); // create chart function var eventDropsChart = d3.chart.eventDrops() .eventLineColor(function (datum, index) { return color(index); }) .start(new Date(startTime)) .end(new Date(endTime)); console.info(data); // bind data with DOM var element = d3.select("body").datum(data); // draw the chart eventDropsChart(element);
I am posting this in the hope that maybe someone finds it useful and of course to hear your comments and suggestions.
-
RE: Cannot get my sitemap to show humidity reading
That's is good to hear.
In case you would like to check your events.log at a later stage, you can find it (depending on your installation) here:
/var/log/openhab/
OR
/opt/openhab/logs/
See also: Openhab Log-files
-
RE: Housing for BH1750
Hey @dakky how did you progress in building the housing? I would be happy to hear (of course also see) about your experiences since I am planing something very similar.
-
RE: Cannot get my sitemap to show humidity reading
I think for now it is not necessary to modify the nodes. If you can see the messages on the humidity in the mqtt topic, then they must be read by your node.
Could you instead post what you see in mqtt.fx and in openhab's
events.log
?Btw, what gateway are you using: the mqtt gateway or the mqtt client gateway?
-
RE: Cannot get my sitemap to show humidity reading
@CJ-Cassarino said:
The temperature works fine I don't understand why humidity doesn't work. I got the mqtt binding from MQTT.fx from what shows up after the Arduino sends the information.
I am not sure if I understand you correctly. Do you mean that you can see with mqtt.fx your gateway posting the temperature and the humidity on the respective topics or only the temperature?
In my experience the DHT11 is relatively unreliable, so I am wondering if the humidity is actually been read and sent to your controller. You could examine this by checking the serial monitor on your node, on the gateway and the event-log of your openhab instance (
events.log
).I am happy to have a look if you post the respective logs here.