savjee / home-energy-monitor Goto Github PK
View Code? Open in Web Editor NEWESP32-based Home Energy Monitor
Home Page: https://savjee.be/2019/07/Home-Energy-Monitor-ESP32-CT-Sensor-Emonlib/
ESP32-based Home Energy Monitor
Home Page: https://savjee.be/2019/07/Home-Energy-Monitor-ESP32-CT-Sensor-Emonlib/
Hi I love your project and am wondering do you think this ready made board will work with your code.
I prefer the idea of WiFi & MQTT reconnecting that your have on yours.
This guy makes boards on eBay but recommends his code.
Thanks
https://www.ebay.co.uk/itm/ESP8266-Mains-Current-Sensor-Wemos-Current-transformer-SCT013-100A-50mA-/133077015640?mkcid=16&mkevt=1&_trksid=p2349624.m46890.l49286&mkrid=710-127635-2958-0
Correct credentials , IP and port are used, but doesn't subscribe to the mosquito broker
After successfully download the firmware on the board, it stucks on wifi connecting page and then reboots forever every second or less.
After running exception decoder, I found that it was due to line #47 on wifi-connection.h task, that shows the status and the IP adress.
After commenting this line everything works fine and pass to the next page, showing power consumption.
Thanks for your awesome work!
After setting all up if I plug the CT sensor but with no wire through it, I have a non-zero readings, about 0,1A.
I suspect that this is caused by the difference on the voltage divider resistors, that gives a reference voltage something different than 3,3V/2=1.65V.
It would be interesting to implement some kind of calibration routine to add an offset and get more accurate readings.
Also, when connecting a (theorically) 2000W air heater, readings go around 1800W-1900W. But in this case, I don't know if it's related with the same issue.
Thanks for your time and dedication @Savjee
I was wondering if any one tried this on esp8266 without screen?
I have started to implement the same project using esp8266 and was thinking in theory instead using platformIO code, if I send the measurements to AWS IOT MQTT server via a basic esp8266 AWS iot example then the other parts of the projects still work.
Any input and help is much appreciated.
Thanks in advance.
Is this possible to use one of the other inputs on the ESP32 to add another sensor?
I am going to set this up in my main panel and wanted to track a few other things.
I want to be able to use AWS IOT for archiving all my raw data, but I also want to send data to my local Home Assistant instance.
I didn't found 3D models of v2 project. Please, can you publish it?
Hi,
Interesting project! Thanks for that.
A quick question - how is the voard powered? I don't see any mention of power-supply for ESP32 itself.
Thanks.
Hallo and thank you for your nice project! Very well done.
A question: I would like to make some calls to the graphQL using tray.io but, every time I try to call the endpoint It doesnt work with an error
"message": "Syntax Error: Expected Name, found String "query"",
"locations": [
My question is: is the graphql.js a complete server? Shouldnt it be available on port 9000? Does it lack of introspection query to fetch the field names?
Thank you for supporting ms
Hi
I see that you have deployment as a TODO, but is there a 100 words or less version ?
I've blundered my way through i think...
Installing serverless cli tools
Installing the dependencies (webpack etc)
But when I do a serverless deploy, the unit tests fail..
Now, I'm a complete beginner when it comes to AWS and serverless tech, I come from the esp32 side of the house :)
Thanks
Hi I am Trying to upload sensor data, current and voltage to mysql database. But I am struck. where
Irms value updating only two decimal places e.g X.XX, But I need X.XXXX, How to do it? I tried
Hi, I'm very interristing on building it, but I don't understand the wiring process ...
Would it be possible to have a complete scheme with resistors, sct-013 plug ... ?
On the blog, it's just 2 pictures and I see nothing ...
Thank you fo your help.
Via MQTT (+ auto discovery and device registry)
The time series in chart x axis is not in the user's timezone / reading's timezone.
Not exactly sure how to fix this because the timestamp returned with readings has correct time but on chart this reflects that the readings are approx 5-5.5 hours before.
Ex: Following screenshot show time & readings from 5AM to 10AM but actually the readings are of time between 11 AM to 4:30 PM.
Hello.
Is it possible to connect the SCT013 directly to the ESP32 board and measure amps? You mention that your initial thought was to cut it off and connect the wires directly to the ESP32 board, I would like to do this but I don't know where to connect the wires on the board.
If you could please guide me in connecting these wires on the board directly it would be greatly appreciated.
Regards and awesome project.
Maybe once every 30 minutes?
When I restart homeassistant for, say , a configuration change or whatever reason the sensor remain in entity not available for quite a long time.
I use mosquitto as broker and all my other sensor ( not "autoconfigured" ) start sending data to broker and get sent to HASS as soon as the HASS itself is up and running.
The only one that remains in "Entity not available" is your ( wonderful ) sensor.
From the mosquitto log I can see that my ESP32 send the message :
1628280703: Received PUBLISH from IoTEnMon (d0, q0, r0, m0, 'homeassistant/sensor/IoTEnMon/state', ... (14 bytes))
but being that HASS does not have a configuration for it, mosqutto don't forward it to HASS.
After some time ( 10 minutes or more ) the ESP32 send the config message:
1628281285: Received PUBLISH from IoTEnMon (d0, q0, r0, m0, 'homeassistant/sensor/IoTEnMon/config', ... (318 bytes))
and from this moment everything works as expected.
Is it possible to have some config item to choice between autoconfig and manually config ?
Hi, I'm getting an error when trying to build from src-aws.
$ serverless deploy
Serverless: Bundling with Webpack...
Time: 133ms
Built at: 06/09/2020 11:55:04 am
Asset Size Chunks Chunk Names
functions/cron-rotate-daily.js 5.63 KiB 0 [emitted] functions/cron-rotate-daily
Entrypoint functions/cron-rotate-daily = functions/cron-rotate-daily.js
[0] ./core/aws-connections.js 157 bytes {0} [built]
[1] ./core/config.js 177 bytes {0} [built]
[2] ./functions/cron-rotate-daily.js 3.35 KiB {0} [built]
[3] external "aws-sdk" 42 bytes {0} [built]
[4] ./core/helpers.js 4.71 KiB {0} [built]
[5] external "util" 42 bytes {0} [built]
[6] external "zlib" 42 bytes {0} [built]
[7] ./core/helpers/CalculateKwh.js 961 bytes {0} [built]
[8] ./core/helpers/IsNightTarif.js 492 bytes {0} [built]
Time: 121ms
Built at: 06/09/2020 11:55:04 am
Asset Size Chunks Chunk Names
functions/graphql/graphql.js 8.56 KiB 0 [emitted] functions/graphql/graphql
Entrypoint functions/graphql/graphql = functions/graphql/graphql.js
[0] ./core/config.js 177 bytes {0} [built]
[1] ./core/aws-connections.js 157 bytes {0} [built]
[2] ./core/helpers.js 4.71 KiB {0} [built]
[3] ./functions/graphql/graphql.js 1.25 KiB {0} [built]
[4] external "graphql/index" 42 bytes {0} [built]
[5] ./functions/graphql/resolvers/realtime.js 967 bytes {0} [built]
[6] external "aws-sdk" 42 bytes {0} [built]
[7] external "util" 42 bytes {0} [built]
[8] external "zlib" 42 bytes {0} [built]
[9] ./functions/graphql/resolvers/usageData.js 543 bytes {0} [built]
[10] ./functions/graphql/resolvers/stats.js 1.38 KiB {0} [built]
[11] ./node_modules/graphql-fields/build/index.js 4.98 KiB {0} [built]
[12] ./core/helpers/CalculateKwh.js 961 bytes {0} [built]
[13] ./core/helpers/IsNightTarif.js 492 bytes {0} [built]
[14] external "jStat" 42 bytes {0} [built]
Serverless: Package lock found - Using locked versions
Serverless: Packing external modules: graphql@^14.7.0, jStat@^1.8.6
Running command: npm run test
> [email protected] test /Users/home/home-energy-monitor
> mocha "tests" "./core/helpers/*.test.js"
Warning: Cannot find any files matching pattern "tests"
Calculate kWh
1) should return 1 when consuming 1000W for 1 hour
2) should return 0.5 when consuming 1000W for 30min
IsNightTarif
3) should return true for night hours
4) should return false for day hours
✓ should return true for weekends
✓ should also work when we pass integers instead of date objects
2 passing (7ms)
4 failing
1) Calculate kWh
should return 1 when consuming 1000W for 1 hour:
AssertionError [ERR_ASSERTION]: 0 == 1
+ expected - actual
-0
+1
at Context.<anonymous> (core/helpers/CalculateKwh.test.js:14:15)
at processImmediate (internal/timers.js:461:21)
2) Calculate kWh
should return 0.5 when consuming 1000W for 30min:
AssertionError [ERR_ASSERTION]: 0 == 0.5
+ expected - actual
-0
+0.5
at Context.<anonymous> (core/helpers/CalculateKwh.test.js:26:15)
at processImmediate (internal/timers.js:461:21)
3) IsNightTarif
should return true for night hours:
AssertionError [ERR_ASSERTION]: false == true
+ expected - actual
-false
+true
at Context.<anonymous> (core/helpers/IsNightTarif.test.js:8:15)
at processImmediate (internal/timers.js:461:21)
4) IsNightTarif
should return false for day hours:
AssertionError [ERR_ASSERTION]: true == false
+ expected - actual
-true
+false
at Context.<anonymous> (core/helpers/IsNightTarif.test.js:13:16)
at processImmediate (internal/timers.js:461:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 4
npm ERR! [email protected] test: `mocha "tests" "./core/helpers/*.test.js"`
npm ERR! Exit status 4
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/home/.npm/_logs/2020-09-06T02_25_13_084Z-debug.log
Error --------------------------------------------------
Error: Command failed: npm run test
at checkExecSyncError (child_process.js:616:11)
at execSync (child_process.js:652:15)
at Scriptable.runCommand (/Users/home/home-energy-monitor/node_modules/serverless-scriptable-plugin/index.js:48:12)
at /Users/home/home-energy-monitor/node_modules/serverless-scriptable-plugin/index.js:41:21
at tryCatcher (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/util.js:16:23)
at Object.gotValue (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/reduce.js:166:18)
at Object.gotAccum (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/reduce.js:155:25)
at Object.tryCatcher (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromiseCtx (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/promise.js:641:10)
at _drainQueueStep (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:461:21)
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 14.9.0
Framework Version: 1.82.0
Plugin Version: 3.8.3
SDK Version: 2.3.1
Components Version: 2.34.9
When a request fails, it's kept in the pendingRequest array and so the loaders appear on all the screens.
Hi @Savjee great job!
It would be very good if you could include a three phase version. I mean to read the currents and voltages for the three phases. These would open the possibility for several other applications and house sizes!
Does the EmonLib-esp32 support the three phase calculations?
By the way I will open source my small board to adapt current from the sct-013-000.
Hi, while building the actual project I get the following error:
Compiling .pio/build/esp32doit-devkit-v1/libd11/Adafruit GFX Library/Adafruit_GrayOLED.cpp.o
In file included from .pio/libdeps/esp32doit-devkit-v1/Adafruit GFX Library/Adafruit_GrayOLED.cpp:20:0:
.pio/libdeps/esp32doit-devkit-v1/Adafruit GFX Library/Adafruit_GrayOLED.h:30:32: fatal error: Adafruit_I2CDevice.h: No such file or directory
which is easy solved by adding the following lib in lib_deps ( platformio.ini )
Adafruit BusIO
which download the needed library and build successful.
Maybe Adafruit chenge some libraries ?
Can you check, please ?
Hello,
I am going through the project but one thing still I am not able to understand is about the standby power consumption (Always -ON)
. What is the purpose of calculating it and how is it being calculated ?
It would be great if you can give me a hint about that .
Thanks
Hi
Finally decided to ditch the esp8266 and move to esp32. Made necessory modifications and uploaded code on ESP32.
AWS IOT registers the device, esp32 shows MQTT msg sent in serial monitor but the message is never recived on AWS iot.
No rules executed, nothing. Tried changing the rule, also tried the test menu from AWS IOT to subscribe to "#" i.e. all topics, here also the result is same. No message received.
Also, in thing's activity menu I can see the device was connected but in next 10 seconds the device was disconnecting, this behavior was consistant.
The serial monitor shows: AWS publish then AWS Connecting. Is this normal?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.