Logbook should use the raw value of states rather than "Prettier ones"

I understand the intention behind logbook entries being prettified, to appeal to the average user. However it is not useful and can be very confusing. Since it is the main (and probably) only way to check what values a state can take it will be more useful if it just shows the actual value. Casing is very confusing and leads to lots of errors. For example, take a look at this not working automation:

I just took the value that logbook was telling me (as you can see in the below screenshot) but it turns out that the actual value is all lowercase.

Is it really that nicer to show a modified value at the cost of not knowing what actual value you should use on automations/scripts/templates?

I find this one of the main frustrating things while writing automations and in general in home assistant

The place to check the actual state of an entity isn’t the Logbook. It’s the (appropriately named) Developer Tools / States menu.

Except that it only shows the current state.
So unless you are lucky enough to get the state you are after when you check it, or you spend hours looking at it until you get all the possible states I don’t think that is the best place.

3 Likes

Agreed. I ended up here while trying to find anywhere to look in the UI for a full list of the exact state values that have been seen for an entity so I would know what to use in an automation without resorting to trial-and-error.

Definitely would love to find that somewhere.

This is a good point. I am also pretty used to directing people to developer tools for this but you’re right, there really is no good way to see historical values without them being capitalized.

I don’t think logbook should always do this though. I think a toggle for “show raw state values” that only shows up for admins in both history and logbook would be nice.

1 Like

Wait until tomorrow…

Home Assistant is getting more and more shaped towards the beginner and at the cost of advanced and automations and scripts.
If this continues further then HA will be unusable.
We need to see the real states.
We need to see the real entity IDs.
This is used in automations and scripts, the very core of home automation.

1 Like

Having access to both the state history and translated state history wouldn’t hurt.

Hi, I have had the same (frustrating) experience for several automations: the dev tools will only allow me to see the current value, while the log function will only give me translated and inadequate value (e.g. “smoke has been detected” for my smoke sensor). @tom_I: you mentioned “wait for tomorrow” - this sounds like such a toggle (show raw values) should be available? Haven’t found anything like that so far. Would be awesome if you can point it out.
Best Hendrik

1 Like

Almost two years later, and this whit still pisses me off when it happens.
Just a few weeks ago I wanted to remove a tracker from a person.
I had a binary sensor and a device tracker and both had the same friendly name (because it was tracking the same person).
I needed to remove one. I could not see which is which.
The dumbest shit of Home Assistant so far, and hopefully forever.
And there is no yaml mode where you can see the entity names.

Also very annoyed by this. My automation doesn’t work - the gui builder doesn’t offer dropdown values for states of running / finished etc - typing them in manually doesn’t work because they’re friendly UI values - what the heck is the correct raw value? Don’t know, have to run the whole appliance to that specific state and read the raw state value? give me a break

1 Like

I feel your pain. It will be very easy to make the raw value par of the friendly name, but nobody seems to agree

Here’s one workaround I’ve found, install the SQLite Web addon.

Then run this query I modified from the new database structure doco

SELECT states_meta.entity_id, states.state,
       DATETIME(states.last_updated_ts, 'unixepoch') as last_updated,
       DATETIME(COALESCE(states.last_changed_ts, states.last_updated_ts), 'unixepoch') as last_changed
FROM states
LEFT JOIN states_meta ON states.metadata_id = states_meta.metadata_id
WHERE states_meta.entity_id = 'sensor.YOUR_DEVICE_ENTITY_ID_GOES_HERE'
AND DATE(DATETIME(states.last_updated_ts, 'unixepoch')) = DATE('now')
ORDER BY states.last_updated_ts DESC;

That will at least get you the entity historical values, with a human readable time (note it will be in UTC or whatever your platform is in) and in reverse chronological order.

I hope that helps someone.

1 Like

This is the best solution so far. Now all I expect is to that extension to be deprecated and the team to move to another storage solution without any backward compatible alternative :joy:
Thank you very much sir.

The query I’m iusing is much more simple, just this:

SELECT 
    state,
    entity_id,
     domain
FROM "states"
where state GLOB '[^-]*[^0-9.]*'
GROUP BY state, entity_id
order by entity_id
1 Like