HomeAssistant energy management component

Just wanted to give everyone a heads up that Home Assistant released version 2021.8.0 today which contains a bunch of new features around energy monitoring/management. I had previously been pumping my data into a influxdb/graphana instance hosted on my home assistant server, but will have to check into whether this new integration integrates more seamlessly into my existing home assistant setup. Looking forward to how the new HA code can interface with IotaWatt.

I believe the developer of the following integration is working the necessary changes to work properly with Home Assistant’s new Energy features.

1 Like

I have already integrated the data from IotaWatt into the new Home Assistant energy management component effortlessly using the above custom component .

A very nice visibility on my daily electricity usage with breakdown on the individual device consumption.

3 Likes

@polyfaces Thanks for this. I integrated mine last night. For someone who already had a running HomeAssistant instance, this was super easy to setup. Previously I was running grafana with influxdb which required me to “leave” the home assistant interface to see energy usage (even though is was framed inside HA). This new native energy integration presents the most useful info easily, natively inside the HA interface. I highly recommend it for anyone who is looking for a simple high level overview of their utilization.

1 Like

Ive got mine setup too.
In my case, my iotawatt feeds emonCMS, and i use that integration to get data into HA.
I had to create template sensors for each attribute i wanted to use in the energyt monitor to add last_reset, but other than that it all works!

I’ve got mine set up as well. Looks nice. I’m using the Iotawatt custom component. I had my HA server down for 1 hr this morning for some maintenance and noticed there was a 1 hr gap in my readings. I guess the custom component pulls data from Iotawatt real-time and has no sync-up mode so if HA is down, you will lose the data for that down time. I’ll probably still stick to using influxdb/grafana for now but its nice to have this visibility in HA.

I’m just now trying to come up to speed on the integration. IoTaWatt has the historical data, so if its possible, I’ll pursue that functionality. I think the integration is currently using the status API which is real-time. It should be possible to change over tio using query where history is available.

I could use any help I can get to understand how this all works as I regret to say I have not yet taken the time to learn Python.

Can you please elaborate on what you did calculation/ouptut wise to work with the Energy inputs on Home Assistant’s new Energy panel?

Just add the following two configurations for each input channel. The input (i.e. sensor.iotawatt_input_kitchen_heater) should be using the unit “Amp”. Then, perform integration over the amps, then you will get the total energy spent in kWH since you create the sensor.

sensor:
  - platform: integration
    source: <sensor.iotawatt_input_kitchen_heater>
    name: <energy_spent_kitchen_heater>
    unit_prefix: k
    unit_time: h
    unit: kWh

The utility meter below helps you to reset the energy usage in kWH daily, and this value can be feed into the energy mangament component for display.

utility_meter:
  <kitchen_heater_energy>:
    source: <sensor.energy_spent_kitchen_heater>
    name: <Kitchen Heater Daily Energy>
    cycle: daily

Please replace the above brackets to suit your need.

Not sure if this is what you’re asking help with… If you’re using the Iotawatt custom integration, the integration automatically senses and creates all lotawatt’s Input/Output as sensors. No need to manually define each sensor unless you want to have some calculated values which are derived from Iotawatt’s input/output sensors.

Under Lovelace, click on Configuration > Energy. Under Electricity Grid on left, click on Add Consumption to add all your “supply” feeds, i.e. grid, solar, generator etc. This is where I added my Main CT clamped to the main’s feeds. This will give you the nice Energy Usage graphic. Then click on Individual devices on the right and add yr individual input/output sensors as you defined in Iotawatt or sensors which you manually created. HA’s Energy is still in its infancy and a bit lacking in its functions but its a good start. Hopefully this answers your Q.

1 Like

Hi @overeasy ,

I think the current way of working is that the HA sensors get their data real-time through the API. This means that if HA was offline for a certain period and then comes back online, the sensors wouldn’t get (or ask for) the measured data from Iotawatt for the missed period. It would just continue taking real-time data and leave a data gap.

This also means that timestamps wouldn’t be correct anymore. If there is some delay over the API calls, HA would receive data from a few seconds ago and consider it as current data.

A nice solution would be to have a push logic instead of pull, similar to Iotawatt’s current integrations for InfluxDB and Emoncms. Iotawatt should be able to see the timestamp of the most recent data in the HA sensors and then push the data after that timestamp to HA.

As I have an advisory role in Home Assistant Energy, I can raise that idea to the HA team. It would however require the implementation of a logic in Iotawatt firmware, to be able to push to a HA instance.

That’s my understanding as well.

It’s unlikely that API calls woud not be serviced for several seconds, but the query API works from the datalog which has 5 second resolution.

Exactly. All of the IoTaWatt uploaders are synchronized with their respective servers. Those servers are all time-series based and there is complete historical integrity with the IoTaWatt regardless of communication or server outages.

A push protocol could be implimented very quickly as the present uploaders use a base class that provides for the synchronization and uploading.

The added benefit is that it would completely solve the outstanding issue of integrating import and export data, which also does not exist with influx, PVoutput or Emoncms.

[quote=“michaelpiron, post:11, topic:3163”]
As I have an advisory role in Home Assistant Energy, I can raise that idea to the HA team. It would however require the implementation of a logic in Iotawatt firmware, to be able to push to a HA instance.

I’m very interested in that. I’m currently looking at hacks to resolve the import/export issue. It would be easier, cleaner, quicker and better to use a push protocol. If I understand the way HA works, it could also require minimal configuring of HA, with the desired sensors being defined as outputs in the IoTaWatt uploader.

I recently ordered one of those HA Blue devices to get more familiar with HA. Unfortunately they are backordered. If need be, I can get a RPi going with SD for now.

1 Like

I’m also waiting for a HA Blue from Ameridroid, it’s indeed backordered. Installation on a RPi with SD c rf is also easy to realise, or any other machine. You can also run HA core (without the operating system layer) in a Docker container.

I will voice the question to the HA team: does the architecture allow for the push approach we described. If interested, I can include you into the discussions (takes place on Discord). Let me know.

I like Iotawatt, and I like Home Assistant. Would be great to tightly integrate them, it would make a great combination. :hugs:

It absolutely does. That’s the standard way of uploading to servers.

I have resisted requests to add an MQTT output specifically because all of the MQTT based services don’t allow for synchronization.

I do think that the data integrity IoTaWatt brings to the mix would be a key differentiator. By all means make the introductions and I can work with the developers. I’m now registered in the HA community as…… @overeasy.

3 Likes

I like the way this is working out. I jumped ship from the Vue (owned both v1 and v2) looking for a more actively developed platform. This thread proves I made the right decision.

2 Likes

In the next release of Home Assistant, 2021.9, the core will be bundled with an IoTaWatt integration.

There has been previous releases of the IoTaWatt integration using the custom component route. This upcoming release will do away with that and will not require extra software to discover the IoTaWatt.

3 Likes

Wow, thats amazing news. Thanks to all who made that happen!

Would you mind giving us a preview? Will the integration be home assistant “pulling” from the API or iotawatt “pushing” to home assistant like it does from influx db for instance?

Indeed great news. There was already a nice custom component, and after a chat with Bob, Paulus from HA and myself, and subsequent collaboration with Greg, things got moving really fast. Congrats to all!

The integration can already previewed in the latest beta release of HA. Feel free to test and give feedback to the team!


1 Like

Thanks to @gregtd who originally conceived this integration and who put in countless hours in the sprint to get this into the next scheduled release of HA.

He worked directly with the HA founder to resolve a punch list of review issues in the amazingly small time window opened with the help of @michaelpiron .
This integration, coupled with the new Energy support in HA, opens up a new way to use IoTaWatt in a comprehensive home monitoring/control system that is not reliant on cloud functionality.

This is a first step. The integration is well structured to provide the data needed to drive the Energy features in HA and to support tighter integration in the future for new functions.

As a first time HA user myself, I’m impressed with the HA package itself, and the ease with which IoTaWatt can be added to the ecosystem. I’ll be starting a HA specific thread here once released, and adding specific integration details in the IoTaWatt docs.

Many thanks to @gregtd and @michaelpiron.


5 Likes

The HACS current version and the HA pending one does address this concern.
When the communication between the HA instance and the iotawatt is interrupted for whatever reason, then next time it’s enabled again the old missing data will be fetched. This works provided you don’t use what HA has documented and use thé intégration intégration (Riemann sum)

Note however that while the energy totals will be right, the time information will be lost. There’s no way to feed data to HA other than now. If you used 100kWh in say the 5 hours the HA last talked to the iota. Those 100kWh will appear as if they had happened the moment connection resumed.