Home Assistant 2024.10 - update to emoncms core module

The latest release of Home Assistant (2024.10.0) includes an update to the core Emoncms component thanks to @alexandrecuer for his hard work in navigating the minefield of developing for Home Assistant.

The component is now configured by the UI. 2024.10: Heading in the right direction - Home Assistant (home-assistant.io)
This update also fixes some elements that are being deprecated by HA and adds others that are part of the core HA sensor design now.

Of note, the ‘Scan interval’ option is removed as this is deprecated by HomeAssistant. If you are relying on this to feed emoncms, you will need another mechanism such as NodeRED to feed data at regular intervals.

[edit]
To note the emoncms integration (data from emoncms to HA) has been updated. The emoncms_history integration (data from HA to emoncms) has not been updated and this continues to rely on YAML configuration.

5 Likes

I’ve not updated yet as I never update to the ‘0’ version. I usually wait until the end of the month :slight_smile:

The yaml config will be imported, but new names for the sensors will be assigned - so prepare to fix anything relying on those sensor names!

1 Like

Not sure what you mean by reporting interval… The scan_interval interval is indeed deprecated but you can use an automation to monitor at a period different than 60 seconds…

Cf New implementation of Emoncms integration is missing "scan_interval" parameter · Issue #127469 · home-assistant/core · GitHub

1 Like

Sorry for this, i could not find a better way, as the yaml version did not provide unique ids for the entities created…

I guess this github issue is about the same problem

I dont really use the stats in home assistant…when you say you can fix things, can you explain how ? I dont know what to answer to the github issue…

I just fixed my further downstream template sensors and utility meters to use the new names. I don’t have a lot depending on it so it wasn’t an issue. The guy on GitHub probably has more depending on it and renamed sensors can be a pain. Could you in principle assign a unique id you generate but reuse the “old” name of the sensor as was configured in the yaml?

The state class issue is a different beast, it should be “measurement” (for things like power, temperature etc) or “total” for energy measurements that are accumulated. When those are not set, the data will not be recorded into longterm stats, which is a pity as many would maybe like to use the enoncms data inside their energy dashboards. I guess you could allow setting a state class during config by the user.

Ok so if he changes the names manually, he should reconnect with his old statistics ?

I did not change anything as far as state_class is concerned…all is measurement except energy which is total increasing…

Maybe it is because if there is no unit fixed in emoncms, nothing is fixed in the new code for device_class
Before for feeds that did not have a unit in emoncms, the default device_class was fit to energy…

1 Like

Renaming could work - I didn’t try it myself. Regarding the state class - seems to be all ok. I checked and my emoncms sensors appear to be recording.

How may I merge the long-term statistics recorded against the old entity names with the new names, please?

On the Statistics tab of the Developer tools, the only option offered under “Fix Issues” is to delete the old ones.

Can you try to rename the new entities to the old name?

Fantastic! I’m updating now… :smiley:

Nice work @alexandrecuer :clap:

Update: the Emoncms integration migration went wall, all my Feeds that I had selected via YAML migrated to the UI

Does the new Emoncms HA integration support multiple pulling data from multiple Emoncms account and or multiple Emoncms servers?

As expected, the sensor names changed in HA, which did break elements of my dashboard:

Screenshot 2024-10-04 19.19.19

But it only took a min to select the new sensors:

Screenshot 2024-10-04 19.27.55

1 Like

I have gone through issues like this repeatedly in the past with smart energy meters, changed integrations and so on. My solution is to have template sensors that simply mirror the current meter, e.g. I have a “sensor.energy_persistent” that just gets assigned the state of my current energy smart meter. If I get a new meter that ends up in a different entity, I just need to change the template sensor expression and get to keep my statistics. I use the same approach for heat generated for heating and DHW. It doesn’t help anyone facing the issue now but Inthink it is a good practice to insure against any future issues.

7 Likes

I could, but what impact might that have on the updated integration?
Would they’ll likely get renamed again each time the integration is updated?

Will see if I can find any advice on HA community forums.

It should not have an impact as there is an underlying unique ID that is unchanged if the name is changed.

In any case - please report back if you find another solution. It’s a problem that pops up on the forums again and again.

1 Like

Yes i confirm that @Andre_K is perfectly right on both topics :slight_smile:

  1. use template sensors through the homeassistant template integration…the previous version of the emoncms with the yaml template parameter was really a bad idea…template sensors are the way to go for the ha dev team

  2. you will not have to rename more than one time cause the entities created by the emoncms integration now have a unique identifier

2 Likes

That could be the reason - perhaps add an else to raise a warning in the log?

I think we need to expand the number of SI units covered to match the choice in emoncms (assuming they are all available in HA).
image
image

Yes, sorry did it from memory and should have checked.

Yes. I use NodeRED to do that.

I’d just like to emphasise the level of effort @alexandrecuer has put into this. If you are interested this is the GitHub link Migrate emoncms to config flow by alexandrecuer · Pull Request #121336 · home-assistant/core · GitHub and the number of discussions including one that involved the HA Dev team eventually allowing something they normally don’t (they wanted all available sensors/Feeds imported automatically - they saw sense). There were some other associated changes as well.

This is a major step so many thanks.

1 Like

Yes, it does.

As I say, I never update to a ‘zero’ release - been bitten by things falling over too often :slight_smile: