myhouse-project/myHouse

Receiving data via Mosquitto

user2684 opened this issue · 2 comments

Reported by: ellardpostma

I am trying to connect the sensors of my weather station with Myhouse via MQTT.
I would prefer to do this directly without going via the "mysensors" interface.
The sensors report each in a separate topic as I programmed it until now:
static char *topicPub1 = "weatherstation/wind/speed";
static char *topicPub2 = "weatherstation/wind/temp";
static char *topicPub3 = "weatherstation/rainstart";
static char *topicPub4 = "weatherstation/UV";
static char *topicPub5 = "weatherstation/DS18temp";
static char *topicPub6 = "weatherstation/wind/heading";
static char *topicPub7 = "weatherstation/bme280/temp";
static char *topicPub8 = "weatherstation/bme280/hum";
static char *topicPub9 = "weatherstation/bme280/pres";
static char *topicPub11 = "weatherstation/light";
static char *topicPub12 = "weatherstation/rainvolume";

How do I arrange for correctly getting these data into Myhouse?

A second issue is the following:
I made my own "tipping bucket" to gather data about the amount of rain.
I do not know what data Myhouse is expecting at what time interval.
Could you please enlighten me on this topic?

Regards
Ellard

Original comment by: user2684

Hi, welcome to the forum first of all. For MQTT, first of all ensure you have enabled the plugin in your "plugins" configuration and the hostname and port are correct (once restarted the logs should tell you if the connection is working fine).
Then create a sensor for each measure, and use "mqtt" as the plugin like the following:

          "plugin": {
            "plugin_name": "mqtt",
            "mode": "subscribe",
            "topic": "weatherstation/wind/speed"
          },

When something is published on the topic, myHouse will save the measure.

Regarding the tipping bucket, the way I had it working is the following: every hour the tipping bucket sends to the mysensors controller (the same would be by using MQTT) the accumulated rain of the previous hour and I have configured a sensor like the below:

        {
          "module_id": "outdoor",
          "group_id": "precipitation",
          "sensor_id": "rain",
          "enabled": true,
          "display_name": {
            "en": "Rain"
          },
          "plugin": {
            "plugin_name": "mysensors",
            "node_id": 5,
            "child_id": 1,
            "command": "SET",
            "type": "V_RAIN",
            "gateway_id": "serial_1"
          },
          "format": "length",
          "summarize": {
            "avg": true,
            "sum": true
          },
          "series": [
            {
              "series_id": "sum",
              "type": "bar"
            }
          ]
        }

The trick is in "summarize" and in "series". If you want the daily/historical stat, you can only register 1 single measure per hour so the average will be the same measure, likewise the sum. This is because there is a limitation currently and "sum" will only work with avg, not with the single measures, so having a single value would make it working (see attachment)

Original comment by: ellardpostma

Thanks for the swift reaction.
I will start working with it. I will report back any results.
Ellard