Influx db cloud help

Would anyone have some advise for how to send data to Influx db cloud?

Would best practice to do this in Node Red or just consume the data directly on the cloud instance? For example my Node Red Flow I am consuming data via MQTT from a building, would I just install from the pallet node-red-contrib-influxdb but its not a locally installed db.

I notice on the influx cloud instance that I created, they have some options to consume the data but there doesnt seem to be a Node Red option, node/javascript but not specially Node Red.

I also notice on Influx Cloud services called Telegraf which I know nothing about has an MQTT option, maybe this would be the easiest way to get MQTT on Influx cloud...? Where I don't think I would need to do anything on my Node Red instance at all if Telegraf can just listen to topics on the same MQTT message bus.

Next to zero wisdom here, any tips on best road to travel at the fork greatly appreciated....

You should be able to configure the Influx node to access the cloud server. You may not be able to feed the MQTT straight in though, it depends on your database schema. Read the help for the Influx Out node to see how to format the data for Influx.

Thanks for the tips, I think this "The Batch Output Node" is what I am looking for. At least I think I need to write a function node that can transform my MQTT data to look like this from below, their example:

msg.payload = [
    {
        measurement: "weather_sensor",
        fields: {
            temp: 5.5,
            light: 678,
            humidity: 51
        },
        tags:{
            location:"garden"
        },
        timestamp: new Date()
    },
    {
        measurement: "alarm_sensor",
        fields: {
            proximity: 999,
            temp: 19.5
        },
        tags:{
            location:"home"
        },
        timestamp: new Date()
    }
];
return msg;

AND then I think I can send this to the Influx cloud instance

What does the data coming from MQTT look like?

So this is something I am completely making up on the fly and have complete control over. Can you give me any tips? pv stands for present value in a BACnet sensor read.

One thing I sill have to factor in is some sort of parameter for a building or site with something of the nature below. For example I am hoping to run MQTT clients in a few different buildings/site IDs where the data will all be slightly different sensor names / readings but the general data structure would be the same.

Not a lot of wisdom for how a data structure would even look like for MQTT so any tips appreciated.

{'boiler_temp': {'pv': 67.36},
 'cooling_plant_temp': {'pv': 70.02},
 'air_handler_setpoint1': {'pv': 90.0},
 'air_handler_setpoint2': {'pv': 55.0},
 'hot_water_valve_command': {'pv': 'inactive'}}

Would a better approach be individual topics for each sensor reading from MQTT side? For example I am making this up now:

Publish individual message on MQTT side instead of a batch of messages?

sensor/telemetry/site_id/boiler_temp/67.36
sensor/telemetry/site_id/cooling_plant_temp/70.02
sensor/telemetry/site_id/air_handler_setpoint/90.0
sensor/telemetry/site_id/air_handler_setpoint/55.0
sensor/telemetry/site_id/hot_water_valve_command/inactive

It depends where the data are coming from. If they all come from one device at the same time then, for Influx at least, put them in one message and send them to one Measurement in MQTT. It is most efficient in MQTT to do that rather then have multiple measurements. However, if they are read separately from individual sensors then use separate measurements.

@Colin so my topics will look something like this:

sensor/telemetry/hvac/5219_Oneida/zone/temp/67.54

Is there anything funny with using _ characters or float values for the sensor reading?

In the Output Node examples, I notice they utilize "tags" quite a bit. Is that something specific for Influx?

So I think my function node would need look something like this, thanks for any tips.

msg.payload = [{
    sensor: '67.54',
},
{
    tag1:"sensor",
    tag2:"telemetry",
    tag3:"hvac",
    tag4:"5219_Oneida",
    tag5:"zone",
    tag6:"temp",
}];
return msg;

Where are your sensor values coming from?

Do they come in one sensor at a time or several together?

Tags are used when you have the same type of values from a number of different places or machines or similar. So for example if I had the temperature in a number of rooms then I might have a Measurement called temperature, with a field called value, and a tag called room. Then when I wrote the kitchen temperature the value field would contain the temperature and the tag would contain "kitchen". Similarly other room temperature would go in the same measurement but the tag would be "bedroom" and so on.

Hi @Colin,

Thanks again for your time and help. Not a lot of wisdom here....

So the sensor values come from a BACnet mqtt app I wrote in Python. The Python BACnet stacks are real good well maintained and they have very friendly/good support for help when needed. They are also used in industry on other frameworks too.

MQTT side is what I am trying to learn, as well as node red, and influx. My expertise is on the building automation system implementation and contracting, so I am new to IoT : )

My thoughts are to run an MQTT publishing app inside the building behind a firewall on the same LAN as a BACnet building automation system, and publish data on regular intervals to the broker. This seems to work Ok from my limited experience using a test bench at my house with BACnet devices and a Node Red instance on the cloud.

Large HVAC systems for buildings (which I am after) the sensors would be very redundant, for example a typical school, office, or hospital could have 50 of the same exact zones. This is how I was organizing the topics for MQTT for the type of sensor that would be very redundant in a multi-zone HVAC system.

For example there could be 50 zone/temp, 50 zone/temp/setpoint, 50 vav/reheat/valve, so on publish 50 sensor values at a time on a set interval.

BACnet app for loops through each topic, publishes 50 sensors at a time and then waits 300 seconds:

f"sensor/telemetry/hvac/{site_id}/zone/temp",
f"sensor/telemetry/hvac/{site_id}/zone/temp/setpoint",
f"sensor/telemetry/hvac/{site_id}/vav/reheat/valve",
f"sensor/telemetry/hvac/{site_id}/vav/reheat/temp",
f"sensor/telemetry/hvac/{site_id}/vav/damper",

Hopefully that makes sense, so at one time 50 of this "style" publishing to the broker:

sensor/telemetry/hvac/{site_id}/zone/temp/67.36

Or would doing batches be a better practice? I can do both, I can modify the Python BACnet app to do either or; what would be better practice for MQTT & cloud influx?

sensor/telemetry/hvac/{site_id}/zone/temp/{'vav1': {'pv': 67.36},'vav2': {'pv': 70.02},'vav3': {'pv': 90.0},'vav4': {'pv': 55.0},'vav4': {'pv': '55.9'}}

Any feedback for the newbie great appreciated, I'm learning a ton!

There are two issues here, how you organise the MQTT topics and how you organise the database schema. Initially I would concentrate on determining what the influxdb schema should be. Once you have determined that then worry about MQTT.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.