Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to keep history for external voltage for each phase? #353

Closed
bj00rn opened this issue Jun 7, 2023 · 7 comments · Fixed by #369
Closed

Question: How to keep history for external voltage for each phase? #353

bj00rn opened this issue Jun 7, 2023 · 7 comments · Fixed by #369

Comments

@bj00rn
Copy link
Contributor

bj00rn commented Jun 7, 2023

Wouldn't it be nice to have a a separate sensor for external voltage for each phase for history purposes?

Correct me if i'm wrong, In the current implementation, per phase values are implemented as state attributes and are not recorded.

Phase history is helpful when trying to understand if SSO/EH fault codes are related to grid voltage.

Im using a workaround is to create a template sensor to grab phase voltage..

@bj00rn bj00rn changed the title Question: How to keep history for external voltage sensors for each phase? Question: How to keep history for external voltage for each phase? Jun 7, 2023
@argoyle
Copy link
Collaborator

argoyle commented Jun 9, 2023

This is of course doable. We have lots of attributes on different entities so maybe we should extract all of them? Thoughts on this @henricm ?

@henricm
Copy link
Owner

henricm commented Jun 9, 2023

I've also thought about this actually. I think it's a good idea to extract the values for each phase to be sensors of their own. Or are there other attributes too? I'm thinking about the sensors that have L1, L2, L3 attributes.

@argoyle
Copy link
Collaborator

argoyle commented Jun 9, 2023

There is a pos/neg somewhere and probably something else but most are L1, L2, L3. I'll see if I can find the time to do something.

@bj00rn
Copy link
Contributor Author

bj00rn commented Jun 9, 2023

There is a pos/neg somewhere and probably something else but most are L1, L2, L3. I'll see if I can find the time to do something.

For diagnostics it would be a nice feature. I guess downside is there will be a lot of sensors 🤓 .

  • external_voltage => external_voltage_l1, external_voltage_l2, external_voltage_l3
  • grid_current => grid_current_l1, grid_current_l2, grid_current_l3
  • external_reactive_current => external_reactive_current_l1,external_reactive_current_l2,external_reactive_current_l3
  • etc..

Maybe it's a good idea to keep the original the original sensors (including state attrs too). For sensors like grid_power I guess the general use case is looking at all phases combined rather than individual phases.

@robinostlund
Copy link
Contributor

robinostlund commented Jun 9, 2023

Think also this feature would be good, i have solved this today by creating templates:

---
sensor:
  - name: "Ferroamp Adaptive Current Equalization Phase 1"
    unique_id: "ferroamp_adaptive_current_equalization_phase_1"
    device_class: current
    icon: "mdi:current-ac"
    unit_of_measurement: A
    state_class: measurement
    state: >
      {{ state_attr('sensor.ferroamp_adaptive_current_equalization','L1') }}

  - name: "Ferroamp Adaptive Current Equalization Phase 2"
    unique_id: "ferroamp_adaptive_current_equalization_phase_2"
    device_class: current
    icon: "mdi:current-ac"
    unit_of_measurement: A
    state_class: measurement
    state: >
      {{ state_attr('sensor.ferroamp_adaptive_current_equalization','L2') }}

  - name: "Ferroamp Adaptive Current Equalization Phase 3"
    unique_id: "ferroamp_adaptive_current_equalization_phase_3"
    device_class: current
    icon: "mdi:current-ac"
    unit_of_measurement: A
    state_class: measurement
    state: >
      {{ state_attr('sensor.ferroamp_adaptive_current_equalization','L3') }}

  - name: "Ferroamp Grid Current Phase 1"
    unique_id: "ferroamp_grid_current_phase_1"
    device_class: current
    icon: "mdi:current-ac"
    unit_of_measurement: A
    state_class: measurement
    state: >
      {{ state_attr('sensor.ferroamp_grid_current','L1') }}

  - name: "Ferroamp Grid Power Phase 1"
    unique_id: "ferroamp_grid_power_phase_1"
    device_class: power
    icon: "mdi:power-plug"
    unit_of_measurement: W
    state_class: measurement
    state: >
      {% set power = int(state_attr('sensor.ferroamp_grid_power','L1'), 0) %}
      {{ power }}

  - name: "Ferroamp Grid Current Phase 2"
    unique_id: "ferroamp_grid_current_phase_2"
    device_class: current
    icon: "mdi:current-ac"
    unit_of_measurement: A
    state_class: measurement
    state: >
      {{ state_attr('sensor.ferroamp_grid_current','L2') }}

  - name: "Ferroamp Grid Power Phase 2"
    unique_id: "ferroamp_grid_power_phase_2"
    device_class: power
    icon: "mdi:power-plug"
    unit_of_measurement: W
    state_class: measurement
    state: >
      {% set power = int(state_attr('sensor.ferroamp_grid_power','L2'), 0) %}
      {{ power }}


  - name: "Ferroamp Grid Current Phase 3"
    unique_id: "ferroamp_grid_current_phase_3"
    device_class: current
    icon: "mdi:current-ac"
    unit_of_measurement: A
    state_class: measurement
    state: >
      {{ state_attr('sensor.ferroamp_grid_current','L3') }}


  - name: "Ferroamp Grid Power Phase 3"
    unique_id: "ferroamp_grid_power_phase_3"
    device_class: power
    icon: "mdi:power-plug"
    unit_of_measurement: W
    state_class: measurement
    state: >
      {% set power = int(state_attr('sensor.ferroamp_grid_power','L3'), 0) %}
      {{ power }}


  - name: "Ferroamp Consumption Current Phase 1"
    unique_id: "ferroamp_consumption_current_phase_1"
    device_class: current
    icon: "mdi:current-ac"
    unit_of_measurement: A
    state_class: measurement
    state: >
      {% set power = int(states('sensor.ferroamp_consumption_power_phase_1'), 0) %}
      {% set current = float(power / 230, 0) %}
      {% if current < 0 %}
        {% set current = 0 %}
      {% endif %}
      {{ current | round(2) }}

  - name: "Ferroamp Consumption Power Phase 1"
    unique_id: "ferroamp_consumption_power_phase_1"
    device_class: power
    icon: "mdi:power-plug"
    unit_of_measurement: W
    state_class: measurement
    state: >
      {% set power = int(state_attr('sensor.ferroamp_consumption_power','L1'), 0) %}
      {{ power }}


  - name: "Ferroamp Consumption Current Phase 2"
    unique_id: "ferroamp_consumption_current_phase_2"
    device_class: current
    icon: "mdi:current-ac"
    unit_of_measurement: A
    state_class: measurement
    state: >
      {% set power = int(states('sensor.ferroamp_consumption_power_phase_2'), 0) %}
      {% set current = float(power / 230, 0) %}
      {% if current < 0 %}
        {% set current = 0 %}
      {% endif %}
      {{ current | round(2) }}

  - name: "Ferroamp Consumption Power Phase 2"
    unique_id: "ferroamp_consumption_power_phase_2"
    device_class: power
    icon: "mdi:power-plug"
    unit_of_measurement: W
    state_class: measurement
    state: >
      {% set power = int(state_attr('sensor.ferroamp_consumption_power','L2'), 0) %}
      {{ power }}


  - name: "Ferroamp Consumption Current Phase 3"
    unique_id: "ferroamp_consumption_current_phase_3"
    device_class: current
    icon: "mdi:current-ac"
    unit_of_measurement: A
    state_class: measurement
    state: >
      {% set power = int(states('sensor.ferroamp_consumption_power_phase_3'), 0) %}
      {% set current = float(power / 230, 0) %}
      {% if current < 0 %}
        {% set current = 0 %}
      {% endif %}
      {{ current | round(2) }}

  - name: "Ferroamp Consumption Power Phase 3"
    unique_id: "ferroamp_consumption_power_phase_3"
    device_class: power
    icon: "mdi:power-plug"
    unit_of_measurement: W
    state_class: measurement
    state: >
      {% set power = int(state_attr('sensor.ferroamp_consumption_power','L3'), 0) %}
      {{ power }}

@argoyle
Copy link
Collaborator

argoyle commented Jun 9, 2023

There is a pos/neg somewhere and probably something else but most are L1, L2, L3. I'll see if I can find the time to do something.

For diagnostics it would be a nice feature. I guess downside is there will be a lot of sensors 🤓 .

Yes, not really a problem I would say.

Maybe it's a good idea to keep the original the original sensors (including state attrs too). For sensors like grid_power I guess the general use case is looking at all phases combined rather than individual phases.

Yes, I didn't plan on removing the current entities, just add new for each phase.

@bj00rn
Copy link
Contributor Author

bj00rn commented Jul 7, 2023

Also affected, DC link voltage sensor

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants