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

How to make only_self_usage devices unavailable #2936

Open
3 tasks done
michalk-k opened this issue Jan 11, 2025 · 4 comments
Open
3 tasks done

How to make only_self_usage devices unavailable #2936

michalk-k opened this issue Jan 11, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@michalk-k
Copy link
Contributor

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

In most circumstances, PowerCalc creates entries for switch or light, meaning, it tracks state of the entity, including unavailability.

In the case of energy meters and generic IoT devices, there is no entity to be tracked.
As a result, if the device is being turned off (for whatever reason), PowerCalc continues to generate power/energy on behalf of this device.

Describe the solution you'd like

I would like to have the option to assign any sensor informing PC about unavailability.

It could be one of the entities being members of a tracked device. For example power entity. There is no need to track all entities. If device goes off, all entities turn unavailable.

States unavailable and unknown identify the unavailability of the device.
Then Ignore unavailable state and Unavailable power could be applied afterward to make it coherent with the rest of the flow.

the

Describe alternatives you've considered

Maybe templates are offered by config flow? But not sure it's possible get unavailable result from them.

Additional context

N/A

@michalk-k michalk-k added the enhancement New feature or request label Jan 11, 2025
@bramstroker
Copy link
Owner

WIP: #2947

@bramstroker
Copy link
Owner

@michalk-k can you verify if this is also fixed for you in v1.17.1? Then the issue can be closed

@michalk-k
Copy link
Contributor Author

michalk-k commented Jan 18, 2025

Some findings:

  1. for pure metering devices like Shelly mini PM gen3 or Shelly Pro EM, all sensors are available to select from (power, voltage etc)
  2. for multi-switch devices like Shelly 2.5 or Shelly plus 2PM, it provides only switches to choose from.

Is it intentional?

Another observation is, that config flow steps during adding a device from discovery are somehow remembered which might be unwanted behavior. How to reproduce:

  1. click Add button
  2. information about device matching library appears
  3. click Next
  4. form to choose a sensor to track availability appears
  5. click Next
  6. next form appears
  7. click Close button to close popup
  8. click Add button again
  9. config flow opens starting from step 6

Not sure if is it controlled by PowerCalc or by HA. But if I make a bad decision, it's no option to start over. The only way is to finish adding a device, remove it from PC, and then call the service to reload library.

@bramstroker
Copy link
Owner

Some findings:

  1. for pure metering devices like Shelly mini PM gen3 or Shelly Pro EM, all sensors are available to select from (power, voltage etc)
  2. for multi-switch devices like Shelly 2.5 or Shelly plus 2PM, it provides only switches to choose from.

Is it intentional?

This is by design. It uses the same device_type -> domain mapping which is used for the entity discovery.
https://github.com/bramstroker/homeassistant-powercalc/blob/master/custom_components/powercalc/power_profile/power_profile.py#L72

So for power_meter device type it will show all sensor. entities possible for selection.

Not sure if is it controlled by PowerCalc or by HA. But if I make a bad decision, it's no option to start over. The only way is to finish adding a device, remove it from PC, and then call the service to reload library.

This is a HA core issue, not something I have control over unfortunately.

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

No branches or pull requests

2 participants