I have a HTU21D-F temperature and humidity sensor and IR breakbeam sensor. I am able to send the temperature and humidity values to the Particle Cloud and visualize them in the Dashboard. If the IR beam is broken I made a recipe to receive a notification through IFTTT. Is there any way I can include the readings of the temperature and humidity in the IFTTT notification?
I am not sure if I can achieve the above with IFTTT. Is there any other route I can take to have only one notification including the IR status and environmental conditions?
You’ll have to concatenate several strings together to publish all the data in one publish event. The String class is really adaptable and makes concatenating as easy as this…
String 3 = String 1 + String 2;
You would make String 1 = temperature data.
Make String 2 = humidity data.
Then concatenate them together into String 3.
Then just publish the concatenated string in the publish event in the data field.
The firmware docs for the String class can spell out any details you might want.
While String can be used, a nicer (better?) way to build a string containing multiple values would be sprintf()/snprintf() or if it has to be a String object and you don’t care about heap fragmentation, you can use String::format() which also provides printf() formatting.
The String::format works just fine! What is the formatting of the % symbol? I. e. 50 % in my notification I’m not getting the %. I tried % but it does not work. Thank you.