Assign values, filters, calibrate_linear

Hello everyone,

I have a PH sensor on an ESP32 with Tasmota and transfer the analog values to the HomeAssistant.
The values are also displayed to me.

How can I assign these analog values to a PH value?

My thought process was to create a template sensor in the configuration.yaml.
It worked too.
How do I now use a filter that assigns the values so that PH values are not displayed instead of analog values?

Here’s what I tested.

template:

  • sensor:
    • name: “PoolPH”
      unit_of_measurement: “ph”
      state_class: “measurement”
      state: >
      {{states(‘sensor.tasmotapool_analog_a1’)}}

if I
filters:
- calibrate_linear:
- 1262 → 6.88
- 1486 → 9.22
attachments, the value cannot be seen. Position or typo?

We don’t know but check out how to format your yaml correctly so that people can help you.

On a side note: ESPHome allows what you want to do directly on the device so it wouldn’t be necessary at all to filter/calibrate in HA :rocket:

Sorry about the formatting.
Unfortunately I can’t change it anymore.

I was hoping that there would be a solution with Tasmota and HA.
I have everything running on Tasmota. And thought that the HA can do so much, then decided on this linear value assignment.

Hi there.

Is this a feature-request or a help-request? If it’s a feature request don’t forget to vote for it, but can you also please clarify what the (missing) feature is?

You certainly should be able to edit your post. Just add 3 backticks - ``` - to the line above and the line below your yaml. Without it, it is very hard to understand what you are sharing - and for sure we cannot tell if it is a position issue. If you cannot edit the post, just reply below with the formatted yaml.

Hello everyone,
I have a PH sensor on an ESP32 with Tasmota and transfer the analog values to the HomeAssistant.
The values are also displayed to me.
How can I assign these analog values to a PH value?
My thought process was to create a template sensor in the configuration.yaml.
It worked too.
How do I now use a filter that assigns the values so that PH values are not displayed instead of analog values?
Here’s what I tested.

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

api:

# Example configuration.yaml entry
my:

rest:
  - authentication: basic
    username: xxxxxxxxx
    password: xxxxxxx
    scan_interval: 30
    resource: https://backend.powerfox.energy/api/2.0/my/main/current?unit=kwh
    sensor:
      - name: "poweropti"
        json_attributes:
          - "Watt"
          - "Timestamp"
          - "A_Plus"
          - "A_Minus"
#          - "Outdated"

template:
  - sensor:
      - name: "Strom EWE atuell"
        unit_of_measurement: "W"
        device_class: "power"
        state_class: "measurement"
        state: >
            {{ state_attr('sensor.poweropti', 'Watt') }}
      - name: "Strom Zählerstand"
        unit_of_measurement: "kWh"
        device_class: "energy"
        state_class: "total_increasing"
        state: >
            {{ state_attr('sensor.poweropti', 'A_Plus') }}
      - name: "Strom Einspeisung gesamt"
        unit_of_measurement: "kWh"
        device_class: "energy"
        state_class: "total_increasing"
        state: >
            {{ state_attr('sensor.poweropti', 'A_Minus') }}
#PH
      - name: "PoolPH"
        unit_of_measurement: "ph"
        state_class: "measurement"
        state: >
           {{states('sensor.tasmotapool_analog_a1')}}

if I

filters:
- calibrate_linear:
- 1262 → 6.88
- 1486 → 9.22

attachments, the value cannot be seen. Position or typo?

solved!
I switched to ESP-Home with everything. You have much more freedom in creating and configuring sensors. Well documented.

1 Like

And the best part when coming from Tasmota: All configuration/settings in one place and not scattered between web ui, console, pre-build configs and obscure scripts :ok_hand:

1 Like