Esphome + Effects = a lots states in database

Hi.

I use esphome in my chrismass tree with light effects. It works fine but the database save all states of my lights (5 states / seconds)…

The effects of my yeelights bulbs no get events in database, so, I think that is fault of esphome or my effect implementation.

This is the code:

     - lambda:
         name: Random
         update_interval: 200ms
         lambda: |-
          auto call = id(tree1).turn_on();
          call.set_transition_length(200);
          

          call.set_brightness((rand() % 255 + 1) / 255.0);
          call.set_color_temperature(rand() % 2 == 0 ? 0: 512);
          call.perform();

For now, I disable chrismass tree for record, but I want find a better solution.

That is the solution.

Solved after two years…

Add

call.set_publish(false);
call.set_save(false);