Virtual Meter Device with manipulate Value

I cant belive it, but it doesn’t work anymore and i dont know why :frowning:
could you help me a last time @tom_l ?

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
browser:
homeassistant:
  customize:
    #grid consumption
    sensor.zahlerstand_netzbezug:
      state_class: total_increasing
    sensor.zahlerstand_einspeisung:
      state_class: total_increasing
# Text to speech
tts:
  - platform: google_translate

#mqtt:
#  binary_sensor:
#    - name: "Andrea Alarm"
#      state_topic: "andrea/alarm"
#      payload_on: "ON"
#      device_class: presence
#      auto_off: '00:00:30'

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
alarm_control_panel:
  - platform: manual
    name: Home Alarm
    code: "1234"
    arming_time: 30
    delay_time: 20
    trigger_time: 4
    disarmed:
      trigger_time: 0
    armed_home:
      arming_time: 0
      delay_time: 0
binary_sensor:
  - platform: workday
    country: DE
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun, holiday]
    add_holidays:
      - "2022-05-27"
      - "2022-06-17"
microsoft_face:
  api_key: 890b4c33b3da4a39844f131e2fdb059f
  azure_region: germanywestcentral

image_processing:
  - platform: microsoft_face_identify
    group: family
    confidence: 50
    source:
      - entity_id: camera.turstation_live
  - platform: microsoft_face_detect
    source:
      - entity_id: camera.turstation_live

template:
  - trigger:
      - platform: event
        event_type: "doorbird_turstation_klingelt"

  - binary_sensor:
      - name: doorbell_is_ringing
        state: on
        auto_off: "00:00:30"
        device_class: occupancy

      - name: lichtschalter_eingang
        state: "off"
        device_class: light

  - sensor:
      - name: "Justiert"
        unit_of_measurement: "W"
        state_class: measurement
        device_class: power
        state: "{{ states('sensor.sensor.tasmota_energy_power')|float(0) - 8 }}"
        availability: "{{ states('sensor.sensor.tasmota_energy_power')|is_number }}"

sensor:
  - platform: rest
    resource: http://192.168.2.4:8084/
    value_template: >
      {% for i in value_json.data %}
      {% if i.uuid == "F22F6F70-88D1-4AD4-A46D-0FAC01F1B85D" %}
      {{ '%.2f'%(i.tuples[0][1]) | float }}
      {% endif %}
      {% endfor %}
    method: GET
    name: "Zählerstand Einspeisung"
    unit_of_measurement: Wh
    device_class: energy
  - platform: rest
    resource: http://192.168.2.4:8084/
    value_template: >
      {% for i in value_json.data %}
      {% if i.uuid == "14FDB752-A5FC-4174-A20E-698604D3A165" %}
      {{ '%.2f'%(i.tuples[0][1]) | float }}
      {% endif %}
      {% endfor %}
    method: GET
    name: "Zählerstand Netzbezug"
    unit_of_measurement: Wh
    device_class: energy

generic_hygrostat:
  - name: Vorratsraum Entfeuchter
    humidifier: switch.entfeuchter
    target_sensor: sensor.vorratsraum_humidity
    min_humidity: 30
    max_humidity: 70
    target_humidity: 49
    dry_tolerance: 2
    wet_tolerance: 0
    device_class: "dehumidifier"

I’m surprised the template integration ever loaded. You still have not followed the example here: https://www.home-assistant.io/integrations/template/#trigger-based-template-binary-sensors-buttons-numbers-selects-and-sensors

Try this:

template:
  - trigger:
      - platform: event
        event_type: "doorbird_turstation_klingelt"

    binary_sensor: # this needs to be associated with the trigger, so no "-"
      - name: doorbell_is_ringing
        state: on
        auto_off: "00:00:30"
        device_class: occupancy

      - name: lichtschalter_eingang
        state: "off"
        device_class: light

  - sensor:
      - name: "Justiert"
        unit_of_measurement: "W"
        state_class: measurement
        device_class: power
        state: "{{ states('sensor.sensor.tasmota_energy_power')|float(0) - 8 }}"
        availability: "{{ states('sensor.sensor.tasmota_energy_power')|is_number }}"

but my sensor show not available again,
the tasmota works, on the dev tools i see correct values…
since last time i tried to modified the configuration yaml to make sure everything is right, it shows ‘not available’…
:frowning: so terrible

go to Settings → Logs, what errors do you see?

mabye this ?

2023-02-22 08:45:10.448 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.tasmota_energy_reactivepower (var) can not be converted to the unit of previously compiled statistics (VAr). Generation of long term statistics will be suppressed unless the unit changes back to VAr or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2023-02-22 08:45:10.456 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.tasmota_energy_factor (None) can not be converted to the unit of previously compiled statistics (Cos φ). Generation of long term statistics will be suppressed unless the unit changes back to Cos φ or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this

is this enough?

Share your configuration as it is now.

@tom_l sorry for this trouble :frowning:
but i really don’t understand the concept, don’t know why it is for me so complicated and thanks for spending time to solve my issue

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
browser:
homeassistant:
  customize:
    #grid consumption
    sensor.zahlerstand_netzbezug:
      state_class: total_increasing
    sensor.zahlerstand_einspeisung:
      state_class: total_increasing
# Text to speech
tts:
  - platform: google_translate

#mqtt:
#  binary_sensor:
#    - name: "Andrea Alarm"
#      state_topic: "andrea/alarm"
#      payload_on: "ON"
#      device_class: presence
#      auto_off: '00:00:30'

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
alarm_control_panel:
  - platform: manual
    name: Home Alarm
    code: "1234"
    arming_time: 30
    delay_time: 20
    trigger_time: 4
    disarmed:
      trigger_time: 0
    armed_home:
      arming_time: 0
      delay_time: 0
binary_sensor:
  - platform: workday
    country: DE
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun, holiday]
    add_holidays:
      - "2022-05-27"
      - "2022-06-17"
#microsoft_face:
 # api_key: 890b4c33b3da4a39844f131e2fdb059f
 # azure_region: germanywestcentral

#image_processing:
#  - platform: microsoft_face_identify
#    group: family
#    confidence: 50
 #   source:
#      - entity_id: camera.turstation_live
#  - platform: microsoft_face_detect
 #   source:
 #     - entity_id: camera.turstation_live

template:
  - trigger:
      - platform: event
        event_type: "doorbird_turstation_klingelt"

    binary_sensor: # this needs to be associated with the trigger, so no "-"
      - name: doorbell_is_ringing
        state: on
        auto_off: "00:00:30"
        device_class: occupancy

      - name: lichtschalter_eingang
        state: "off"
        device_class: light

  - sensor:
      - name: "Justiert"
        unit_of_measurement: "W"
        state_class: measurement
        device_class: power
        state: "{{ states('sensor.sensor.tasmota_energy_power')|float(0) - 8 }}"
        availability: "{{ states('sensor.sensor.tasmota_energy_power')|is_number }}"

sensor:
  - platform: rest
    resource: http://192.168.2.4:8084/
    value_template: >
      {% for i in value_json.data %}
      {% if i.uuid == "F22F6F70-88D1-4AD4-A46D-0FAC01F1B85D" %}
      {{ '%.2f'%(i.tuples[0][1]) | float }}
      {% endif %}
      {% endfor %}
    method: GET
    name: "Zählerstand Einspeisung"
    unit_of_measurement: Wh
    device_class: energy
  - platform: rest
    resource: http://192.168.2.4:8084/
    value_template: >
      {% for i in value_json.data %}
      {% if i.uuid == "14FDB752-A5FC-4174-A20E-698604D3A165" %}
      {{ '%.2f'%(i.tuples[0][1]) | float }}
      {% endif %}
      {% endfor %}
    method: GET
    name: "Zählerstand Netzbezug"
    unit_of_measurement: Wh
    device_class: energy

generic_hygrostat:
  - name: Vorratsraum Entfeuchter
    humidifier: switch.entfeuchter
    target_sensor: sensor.vorratsraum_humidity
    min_humidity: 30
    max_humidity: 70
    target_humidity: 49
    dry_tolerance: 2
    wet_tolerance: 0
    device_class: "dehumidifier"

@tom_l i have no idea which line is corrupted… i tried to move lines but nothing worked, maybe useful move from template to new convention?

@tom_l please can you help me? :frowning: last time

Go to Developer Tools → Statistics and click on the FIX ISSUE buttons and confirm you wan to fix them.

This can’t be so hard to create virtual meter to HA. Over ten years ago with Zipato it took only few clicks, and now i have to write some code? It is not possible…
I have consumption meter in one phase of 3-phase device, and i’d like to create virtual meter, which counts that one-phase value x3. Now it seems need lot of work.

You are posting on a year old topic. A lot has changed since then.

This can now be done from the UI. https://www.home-assistant.io/integrations/template/#ui-configuration

Yeh, there is. But why it is still very difficult and complicated? Right away from start there is second instance, which is unbelievable unintuitive. What the heck i should put in this…?
Someone can’t see, that world is full of peoples, who has never heard anything from yaml-code, or its correct syntax.
I solved it, but not easily.

Home automation is complex.

You’ve only been on the forum 2 months. Give it time you’ll get better at it.

Trying to learn every day. Can’t avoid to compare to previous platform, which was in so different level in easiness. But this is very powerful platform, when get sense of it. In my age (60+) it is not so quick anymore.

This is a community guide with a lot of helpful hints: The Home Assistant Cookbook - Index

Seen that already yes, but i have to cut info to smaller parts, too much english reading. I need first get a target, and then dig out the info for it piece by piece. But thanks anyway.