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

emoncms integration not removing previous set of entities every time I update configuration #121417

Open
DonGiulio opened this issue Jul 7, 2024 · 13 comments

Comments

@DonGiulio
Copy link

The problem

I have in my configuration.yaml a bunch of emoncms feeds configured as sensors.

sensor:
  - platform: emoncms
    api_key: <cut>
    url: http://192.168<cut>
    id: 1
    ...
  - platform: emoncms
    api_key: <cut>
    url: http://192.168<cut>
    id: 8

any time I change any of these, restarting HA will duplicate the whole list of emoncms entities adding new ones (not removing old ones) with a incremental number every new set added.

at the moment my list of emoncms related entities reached the number of 67, they all show the same values, and they are very confusing,
here's a screenshot:
Screenshot 2024-07-07 at 08 41 34

What version of Home Assistant Core has the issue?

core-2024.6.3

What was the last working version of Home Assistant Core?

core-2024.6.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

emoncms

Link to integration documentation on our website

https://www.home-assistant.io/integrations/emoncms

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Jul 7, 2024

Hey there @borpin, @alexandrecuer, mind taking a look at this issue as it has been labeled with an integration (emoncms) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of emoncms can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign emoncms Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


emoncms documentation
emoncms source
(message by IssueLinks)

@alexandrecuer
Copy link
Contributor

@DonGiulio : thanks for the feedback, this integration code needs updating, some progress were made, but still not enough to have something working cleanly when things go wrong...
I think id=1 and id=8 are different emoncms servers but can you confirm ?

@DonGiulio
Copy link
Author

Hello @alexandrecuer,

Thanks for responding quickly.

id 1, 2, 3, 4, 5, 6, 7, 8 are different feeds on the same emoncms server. I only own one emoncms device, which outputs readings data computed in different ways.

    api_key: <cut>
    url: http://192.168<cut>

in my copy paste have all the same values

@alexandrecuer
Copy link
Contributor

id is not the feed id, it is actually more something like the number of the emoncms server, which can be considered as the server name.
so what you should do is have only one emoncms platform in your yaml config and use inside include_only_feed_id, cf the integration doc : https://www.home-assistant.io/integrations/emoncms/

include_only_feed_id:
  - 1
  - 2
  - 3
  - 4
  - 5
  - 6
  - 7
  - 8

Just be aware not to migrate to core 2024-07 if you use template, because there is a bug as I missed something when migrating the integration to async
but I think you are not using value_template.....

@DonGiulio
Copy link
Author

Thanks, I was rather confused by the docs, indeed leaving only id 1 seems to be still working for all my feeds, I still have the copies though

@alexandrecuer
Copy link
Contributor

The copies are still updating ?

@DonGiulio
Copy link
Author

fantastic, I just realised that the copies have gone. thanks a lot

@peillo-github
Copy link

peillo-github commented Jul 13, 2024

After update HA core from 2024.6.4 to 2024.7.2 the emoncms Entity disappear.
After come back to version 2024.6.4 it works again.
What's append with HA core version 2024.7.2 ?

configuration.yaml
sensor:

  • platform: emoncms
    api_key: .......my_key......
    url: ....my_url.....
    scan_interval: 10
    id: 1
    value_template: "{{ value | round(0) }}"
    unit_of_measurement: "W"
    include_only_feed_id:
    • 7
    • 11
    • 15
    • 35
    • 125
    • 127
    • 119
      sensor_names:
      7: "Emoncms Machine_W"
      11: "Emoncms Heater_W"
      15: "Emoncms PAC_W"
      35: "Emoncms Divers_W"
      125: "Emoncms EV_W"
      127: "Emoncms Use_W"
      119: "Emoncms Grid_W"

@alexandrecuer
Copy link
Contributor

alexandrecuer commented Jul 14, 2024

I think you should remove the value_template in your conf and it should work again with version 2024.7. Sorry for that.

@peillo-github
Copy link

Thank you very much for your help.
Do you think future updates will perpetuate this incompatibility with Value_Template, or is it temporary?
If not, I'm going to remove the Value_Template function used to round my 76 EMONCMS entities and do the rounding with HA's dedicated Template function. It takes time but it's still acceptable.
My HA installation is complex with over 600 entities (only 400 are actually used in automation) and I very often see obsolete functions appear in HA.
It's very annoying to go through this periodically, and I don't know if the HA team is aware of this. I don't blame you, I know it's not your responsibility.
At the moment all my devices are integrated into a single HA on Raspberry Pi5, and I'm thinking of splitting that up into several virtual machines so as to separate MQTT, InfuxDB, Grafana, Z2M, and other functions. This would allow some automations to run on a non-updated HA, and others to use more advanced functions that require updating. To be validated if relevant.

@alexandrecuer
Copy link
Contributor

alexandrecuer commented Jul 14, 2024

Right now I work on a migration of this integration to config flow : #121336

In the migration, I have left the template aside, thinking that the template helper could do the job.

In the config flow PR, the bug you actually faced is corrected, the template is migrated but I've not implemented anything to modify the template, nor to add a template to a new config entry.

With the template helper, you have to do the rounding entity by entity, or can you do it for a whole bunch of entities at once ?

@peillo-github
Copy link

Up today I use HA rounding Template entity by entity.
Never I try to use for a whole bunch of entities at once. I don't know if it works.

@alexandrecuer
Copy link
Contributor

Once migrated to config flow, you should not need anymore the template to make a rounding.

See display precision :

image

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

No branches or pull requests

3 participants