Can I read the second-to-last value of a sensor somewhere, if necessary using Python?
Or the latest value of a sensor that is a number?
Do you just want to see it, or use it for something else?
You could use a Trigger-based template sensor with defined not_to and/or a condition.
template:
- triggers:
- trigger: state
entity_id: sensor.YOUR_ORIGINAL_SENSOR
not_to:
- unavailable
- unknown
conditions:
- condition: template
value_template: "{{ trigger.to_state.state | is_number }}"
sensor:
- name: My Always Number Sensor
state: "{{ trigger.to_state.state }}"
You can also use a triggered template sensor to trigger on state change on the sensor and use the trigger.from_state.state to set this to your template sensor.
That means it will always lagg behind with one step.