Temperature comparison with triggers


#1

Hi

I am using a raspberry pi 3 with Cayenne. I have two temperature DS18B20 sensors connected to GPIO4 on the pi. The sensors picked up automatically on Cayenne. I also have a relay connected to another GPIO which turns off and on a light. What I would like to do is set a trigger as follows:

If temperature sensor 1 is higher than temperature sensor 2 then turn the light on, and if the other way around, the light must be off.

Is this possible and if so, how do I set the trigger. For now I can only set the temperature trigger on a slide at a certain temperature for both sensors and can not do a comparison between them for the trigger.

Kind regards


#2

Welcome to cayenne community.
what you are trying with trigger is currently not possible but the same thing can be achieved by some coding and bit long.
do a compare in your code of the two temperature using if loop and depending make a two state widget on or off.
then trigger this two state widget to turn on the relay on.


#3

Thank you for the information @shramiksalgaonkar. Do you perhaps have any documentation and/or examples of the programming to use. I have no programming experience however willing to learn. I am a newbie to this whole IoT and have no idea where to begin.


#4

Have a look at this to get started with Mqtt cayenne.

next have a look at this awesome tutorial which should solve all your problem