How to update a sensors state to a user defined string?

im trying to create my own logbook that only deals with entities, but I want to put them into human readable form.

Currently Im doing this triggered by an automation:

      - service: logbook.log
        data:
          message: >-
           my custom string with {{ sensor.custom_template_string }} 
          name: "The watcha ma call it"
          entity_id: sensor.custom_logbook

What is reported in the UI logbook card has all the other stuff that I dont want like “triggered by logbook automation” etc etc.

So in an effort to remove that part from the string, I tried the custom:logbook-card which is pretty good BUT it only logs states - not entries made by logbook.log

Unfortunately, logbook.log does not log the string into the sensor as a state and seems to log directly into the logbook database (which is fair enough). If you go into dev tools and look at the states after the log operation has been made the sensor state is always blank.

So in an effort to achieve this I want to update a sensor state (with a string through an automation using a BUTTON as a trigger (stateless, so if/elif in a template sensors is out)

So how do I update a sensor with a state “manually” these days???

Is @petros suggestion still best practise these days? https://community.home-assistant.io/t/how-to-manually-set-state-value-of-sensor/43975/115?

Make a template sensor. That whole setup was only needed because trigger based template sensors weren’t a thing.

Im using a button to do the trigger (its stateless)

How do I do a trigger based template sensor on a stateless entity???

it takes a trigger, and you can pass any value to the template sensor or just have it turn on for a short duration. You have endless options. It depends on what you choose as the trigger and what you’re looking to get out of the template entity.

A button entity’s state value is the date and time when it was activated. In other words, it’s a value that changes so it can be detected by a State Trigger.

Oh I didnt think of using the date/time as the trigger.

Many thanks

ok… am looking at it now.

Thx for the input