Egg counter

Hi
I have to make a daily and cumulative counter which feeds according to the state of a sensor. I created a counter but I do not know how to retrieve the value of the sensor to increase the value of the counter.
Regards