NILM Please!

I think this could be a game changer for HA

It could be cool for sure. Sounds like you have a nice project to jump into integration coding in HA!

+1 on this!

I believe that NILMTK would not be interesting to integrate. In addition to running locally, it is more research-oriented, for comparing ML algorithms.

I’m working on something in that direction.

I’m using an esp + pzem004t (esphome/tasmota) to capture the data and I’m having good results using KNN to disaggregate and classify some appliances, looking only at the data from the electricity meter that sits between the house and the grid (after training).

The idea is to use this information together with the information on total consumption, solar production and solar production predictions*, that already exists in HA, and make a recommendation system.

But as I’m new to HA, I still don’t know exactly which way to go. Maybe integrate HA with a local application (API or MQTT?), or try something in the cloud…

Maybe make this recommender system completely outside of HA (getting everything) and only the recommendations that would go into HA. I still do not know.

*Another thing, does anyone know how this “Supercharge your solar panels” works? Here it talks about “Schedule power usage based on solar production predictions”. Is there something already implemented in HA? I didn’t find anything.

Hello, I’m interested in your work, I’m doing some tests too, with poor results, could you give me some tips thanks.

@henriquebol

I have searched far and wide trying to assess the state of NILM in Home Assistant. (The disappointing truth is that this seems to be no prioritized area).

I am interested in your results. Are you still running this setup? Does the KNN still works good? Do you have any code you are willing to share?

@magicus @Valerioweb

I’m still working on it, when I have time.

I’m not doing anything too complex (Seq2point, Seq2Seq, etc…).

It’s just tests:

  • Captured 6 days of data (voltage, current, power factor, powers, frequency) from general electricity meter with pzem
  • I manually noted the moment when the loads of interest were turned on and off (12 in total)
  • The training and testing between these data are with good results. Always above 95% accuracy with KNN.

The problem is in the validation:

  • When I try to use these models trained on a day captured later, the results are poor. Trying with KNN, MLP and RF. With RandomUnderSampler, SMOTE, Scaler…
  • With cross-validation (5 folds), the results with knn are better, but I’m not seeing a way to save the cross-validation models to use them in real-time predictions. Save all models, test them all and take the average? Do I choose the one with the best score? I don’t think it would work.
  • I believe that in the end, it won’t be anything general. If it works, it should only work for my home, but I should try to choose a specific algorithm and parameters for each load. (For example: Air conditioning (knn 3 neighbors), Microwave (MLP, 100hl), etc…) Maybe think about some voting system too.
  • This is not the best way to capture. Some data was corrupted, desynchronized, annotated wrong. Maybe if I work with this data better, I’ll have better results.

I’ve already made an api that receives the date and returns what each model, from each algorithm, recognized as connected, but with poor results still.
Captura de tela de 2022-09-16 11-30-21

If you have any other ideas to give me a direction, I’d appreciate it.

3 Likes

Thank you for sharing your status.

I don’t have any ideas. My hope was that I could find some already working component, but that seems naive by now. Unfortunately I will not have any time to spend on the problem myself. I wish you good luck though, and please post any progress you might make!

absolutely ! go fot it :slight_smile:

See Energy Disaggregation or Non-Intrusive Load Monitoring (NILM) blueprint for a blueprint that uses derivative sensors to detect resistive or similar loads with a sudden increase followed by an almost equal sudden decrease some time later, often many times until the appliance is off.