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

Make sensor settings editable (OptionHandler) #102

Open
dsl10007 opened this issue Jan 3, 2022 · 16 comments · May be fixed by #434
Open

Make sensor settings editable (OptionHandler) #102

dsl10007 opened this issue Jan 3, 2022 · 16 comments · May be fixed by #434
Labels
enhancement New feature or request

Comments

@dsl10007
Copy link

dsl10007 commented Jan 3, 2022

It would be nice if it was possible to edit the sensor setup data.

Right now you can only setup the sensor data when creating it, and if you want to change some setting, you need to delete the sensor and make it again, with the new data.

I would suggest, either putting the settings in a "text file" that can be edited or make the sensor data editable from the GUI.

@Hellowlol
Copy link
Collaborator

The old way of setting it up using yaml is still supported. But you can’t mix yaml and config flow.

@Hellowlol Hellowlol changed the title Make sensor settings editable Make sensor settings editable (OptionHandler) Jan 10, 2022
@Hellowlol Hellowlol added the enhancement New feature or request label Jan 10, 2022
@bj00rn
Copy link
Contributor

bj00rn commented Mar 8, 2022

+1 for adding option handler to configure the integration in UI. Just showing the configured values would be a good start

@elektrinis
Copy link

I have a weird issue. I have not set VAT when installing the plugin, and later on I have configured in the yaml with VAT.
The end result it I get two entities: ne with VAT, one without.
Only the one without VAT is displayed under the integration. The other one is in the general entity list, but not displayed under the integration.

How do I sort this mess out?

@bj00rn
Copy link
Contributor

bj00rn commented Sep 7, 2022

@Hellowlol are there any showstoppers for implementing Options support?

I would love to help out if I can

@bj00rn
Copy link
Contributor

bj00rn commented Dec 14, 2022

from looking at the code
it seems that entity id is derived from configuration.

Probably need a major rewrite since changing these tough options would generate a new entity.

It would be nice if softer things like lowprice_cutoff and VAT was editable through Options and thus not included in entity id.

Any thoughts on this @Hellowlol?

@Hellowlol
Copy link
Collaborator

Hmm. The only thing that needs to be set initially is currency. The rest should be easy to change. We do need another logic for creating ids.

your welcome to send a pr if you want

@KennethLavrsen
Copy link

The huge problem is actually the additional costs

In Denmark the tarifs have 4 steps per day and the actual amount changes each month.
And politicians also change the tax

you have to adjust the additionals almost monthly. Below is my current additional cost

I have had to experiement and tweaking the numbers to match the app from the supplier. I had to restart Home Assistant at least 20 times just yesterday because the only way you can edit this is in yaml and the only way to reload yaml based integration is a restart.

and it is not possible to edit this in a UI added sensor. In fact the UI sensor is in my view useless unless all you want is the raw Nordpool price.

We really need to be able to edit this in the UI. Both at creation and changing it.

additional_costs: >
    {% if now().month >= 1 and now().month <= 1 %}
        {% if now().hour >=0 and now().hour < 6 %}
            {{0.42|float}}
        {% elif now().hour >=6 and now().hour < 17 %}
            {{0.843|float}}
        {% elif now().hour >=17 and now().hour < 21 %}
            {{2.12|float}}
        {% else %}
            {{0.843|float}}    
        {% endif %}
    {% elif now().month >= 2 and now().month <= 3 %}
        {% if now().hour >=0 and now().hour < 6 %}
            {{0.4129|float}}
        {% elif now().hour >=6 and now().hour < 17 %}
            {{0.8723|float}}
        {% elif now().hour >=17 and now().hour < 21 %}
            {{2.0959|float}}
        {% else %}
            {{0.8723|float}}    
        {% endif %}
    {% elif now().month >= 4 and now().month <= 6 %}
        {% if now().hour >=0 and now().hour < 6 %}
            {{0.4129|float}}
        {% elif now().hour >=6 and now().hour < 17 %}
            {{0.5278|float}}
        {% elif now().hour >=17 and now().hour < 21 %}
            {{1.0779|float}}
        {% else %}
            {{0.5278|float}}    
        {% endif %}
    {% else %}
        #tarifs after june 2023 not available
        {{0|float}}
    {% endif %}

@Dominic-070
Copy link

It would be very nice to change the configuration via the UI. In order to update the additional costs annually.

@erkr
Copy link

erkr commented Apr 28, 2023

Many integrations offer a reconfigure option to revisit the options

@martinarva
Copy link

Also voting for a reconfiguration option in UI. Need to change cost template

@Dominic-070
Copy link

Also voting for a reconfiguration option in UI. Need to change cost template

Yes, same here, tax is changed

@elektrinis
Copy link

+1

@samulit
Copy link

samulit commented Jan 18, 2024

What is the workflow now to change sensor settings (trying to switch from EUR -> cents) when it has been configured through UI?

PS. It would be helpful to note on the setup instructions that settings set via UI can not be changed afterwards! I regret using the UI :D

@KennethLavrsen
Copy link

Create a new sensor in yaml so you have control. And remove the old. The integration can work with mix of yaml and UI sensors. The yaml you can change later. The UI sensors you have to delete and create a new.

@bj00rn
Copy link
Contributor

bj00rn commented Oct 28, 2024

Home assistant now support to change configuration without implementing options flow.

Pretty straightforward implementation, I might just give it a go with a PR

https://developers.home-assistant.io/docs/config_entries_config_flow_handler#reconfigure

@bj00rn
Copy link
Contributor

bj00rn commented Oct 28, 2024

#365 is a showstopper for implementing reconfiguration flow. Reconfig flow is a 2024.4 feature. 2024.4 requires python 3.12 and the (now deprecated) devcontainer image is python 3.11.

@bj00rn bj00rn linked a pull request Oct 30, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

9 participants