Community
OpenEnergyMonitor

Community

IotaWatt 4.0

iotawatt
Tags: #<Tag:0x00007f1bdb136110>

(jan) #41

I was suspecting something like an autoupdate looking at the boot message :wink: . Personally i’m not such a big fan (don’t fix it if it isn’t broken), so maybe you can make this feature user selectable (haven’t looked if it’s not already)?
I was planning on making an adapted version on one of the other pcb’s i got, but with spare parts (i have 5 more mcp3008 lying around, and another rtc), so i’ll look into this autoupdate version.

I used the latest version from git for the ino files (i compiled it myself to change the voltage referenced). The changelog says 2.02.10.
I updated the files on the sd card as well, and it stays 0 for the outputs. (just for the record, i’m not running a “server” (Web Service Type is set to none"))

Copy-pasting the “refvolts”:1, strangely didn’t work, but manually typing it worked :wink:


(Inactive) #42

Will be doing a lot with this, but not right away. In the meantime you can remove the statement

NewService(updater);

in setup so that the update service does not run.

given that your device seems to be working properly, I assume you are using MCP3208.

No idea why its not working. Would need to see your config.txt file and pictures of your configure outputs screen and the status screen.


(jan) #43

Sorry to keep bothering you, just let me know to stop :wink:
I have my config.txt here: www.hetgrensland.be/iota/config.txt
a screenshot for the configure outputs: www.hetgrensland.be/iota/inputs.JPG
a screenshot for the configure outputs detail: www.hetgrensland.be/iota/inputs2.JPG
a screenshot for the status screen: www.hetgrensland.be/iota/status.JPG

I also tried to use emonCMS with my own server, but it seems to fail, maybe due to a IP? (server is running on a synology)

UPDATE: seems to be related to the HTTP/1.1 on line 311 in eMonService)

a screenshot for the server config: www.hetgrensland.be/iota/server.JPG (see also the config.txt)
and a screenshot of the serial console: www.hetgrensland.be/iota/serial.JPG
Pasting the url visible in the serial console, with the 10.0.2.115 in front does work (the feeds show up on the server) but with an error (SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data) and raw data (in firefox (ok) This server also receives input from my diy emonPi
Strange thing: sending it to the emonPi first gave error (invalid api key) but after a reset worked…

Another minor problem: the link in the serial console http://IotaWatt.local seems not to work on my system, maybe you could add the IP also?

To answer your other question: yes, i used the mcp3208 for this version, but since i have them lying around, and 30 circuits to measure, i was thinking of making a “lesser” version


(Inactive) #44

Everything looks OK to me, so I have no idea what might be going on. It’s possible that some of the other include libraries that I have are modified or older versions and so we don’t have the same code. What I would recommend is that you leave the updater service startup in place, set the version of your code to 02.02.09, load it ans let it auto update to my 02.02.10. Then see if it works, making double sure you have the index.htm that’s on the Github site.

https doesn’t work. Use http for now. It’s about not having enough heap to support ClientSecure. We have a solution but it’s not ready yet.

should work with the ip address. to use IotaWatt.local, your browser device must support mDNS (muticast DNS). The most common implementation is Apple’s Bonjour, which you can download from them. There are others as well.

I’ve only coded and tested for emoncms.org. Glyn Hudson recently got his IotaWatt running with his eMonPi. Version 2.02.10 has the changes that enabled that. This is a whole area that will have to be tackled as time allows. The immediate intent is to support emoncms.org and the pi as configured by OEM. If you figure it out before I do, please share.


emonPi with IoTaWatt
(jan) #45

I found out that the problem with the “normal” http send in eMonSend is that it’s not accepted by the synology standard webserver. I think it’s connected to the fact that it’s HTTP/1.0 i changed the
"WifiClient.println(String("GET “) + req);”

So now it reads:

WifiClient.println(String("GET “) + req + " HTTP/1.1\r\n” +
"Host: " + eMonURL + “\r\n” +
“User-Agent: IotaWatt\r\n” +
“Connection: close\r\n\r\n”);

Because of this i had to change the check of the reply (it’s not just ok anymore but HTTP/1.1 200 OK and a lot more)
I changed it to: (i guess that the first check isn’t needed anymore.
if(reply.substring(0,2) != “ok” && reply.substring(13,15) != “OK” ){

This works, for me. however, sometimes i get a timeout . Increasing the timeout from 200 to 1000 seems to solve this.
I tried this solution with my emonpi (the old way worked with this also) and with the emoncms running on my synology.


(Inactive) #46

That whole area was coded a long time ago and tested to work with emonCMS.org. It will be changing soon to use http POST, with encrypted data. Post also seems to be returning the full http header info to client.read, so there needs to be code to parse that and get at the data that follows which will be a sha256 acknowledgement. I’m looking at using httpclient to do that, although I’m not really sure at this point.


(jan) #47

With the auto update the outputs work. Could it be that the github version isn’t the latest? (or maybe there is a difference in libraries)


(Inactive) #48

The GitHub master version definitely isn’t the latest, but it should match the auto-update 2.02.10.

Yes, it’s possible my libraries are different from yours, although I cant imagine why that would cause outputs not to work. I’ll make a note to refresh my libraries. I do have an old version of arduinoJson.


(jan) #49

Could it be that webServer.ino file has been changed since the github version, more specific the if(server.hasArg(“outputs”)) on line 281 and next?

Because if I uncomment your Serial.print lines in IotaOutputChannel.h (lines 146-150) I always get 0.00; 1, 0.00 on serial. (when calling /status?outputs=yes)
No matter how may operands the output has in it, i only shows up one time.


(Inactive) #50

No, that’s not it. If that were evaluated false, there would be no attempt to send any output channels.

That’s a good clue. Every script evaluation should begin with that line as those are the initial values when entering the function, but more lines should be generated as the tokens are evaluated. I would have expected a line when the input_3 line was evaluated. It looks as if the script was not properly encoded into runtime tokens.

On the surface it is indicative of a mismatch between my libraries and what you have, and it may be something that eventually comes to the surface, but I don’t want to spend the back-and-forth to try and determine if that’s really it and if we have different libraries.

Unfortunately, I have little motivation to work on the problem as is because I have another branch containing a complete rework of the scripting feature that is just waiting to go. I haven’t rolled it out because I need to more thoroughly test the code that converts old scripts to new, and because the configuration app also has a complete rework of the logic under the “calculator” interface. This is one of the few remaining major changes on my short list to an actual release.

I believe you should be able to see that branch called convert-to-new-output-script. That branch is compatible with the current master branch, so if you want to head farther out on the bleading edge, compile that and try it, otherwise, I’ll be merging it into master in the next week or two. Make sure to grab the index.htm file in that branch as it wont work without it.


(Inactive) #51

A little ahead of schedule. Updated master branch to 2.02.11 to convert to the new scripting format. If you still have auto update on, it should load within an hour. This version will still accept the old scripts, converting them to the new format for internal use but leaving the old format in the config.txt file.

After the update, installing the latest index.htm from the SD directory on Github will convert the old scripts the next time it stores an updated config file (after any edit).

If you like, you could try just compiling the new source to see if outputs work with your libraries. I’d be interested in the result.


(jan) #52

Nice work!
I recompiled it (with the changes for my emoncms server), and changed the index.htm through the website
The result is a partial succes.
The output does work now (on the input channels status page) , but there seems to be a problem with the webpage for the configure outputs : the first tim (with the old rules in the txt file) it works normal. But after changing them it does not anymore: i attached a screenshot with the errors from firefox console. It seems that there is a TypeError. I haven’t looked into it yet but wanted to share it.
screenshot: www.hetgrensland.be/iota/configout.JPG

edit: in config.txt it reads:

“outputs”: [
{
“name”: “test”,
“units”: “watts”,
“script”: “@3
}
],

UPDATE: i think i found the problem: it’s in the function checkConfig()
there it checks config.format == 1, this is always true it seems, disabeling
config.outputs[i].script = old2newScript(config.outputs[i].script);
makes it to work.
I think maybe you forgot to set and read the format type in config.txt?


(Inactive) #53

I’ll look into that, but can I see the config.txt file?


(Inactive) #54

I found it. I will post the corrected index.htm today, but the damage is done for you. Please edit your config.txt file to change the format to 2.

“Format”: 2,

There was one last bug ( if you believe that) that didn’t make it to the Git. Line 1247 in index.htm should read config.format = 2;
(Instead of config.format == 2;)

UPDATE: Done.


(jan) #55

Yes it works :wink: , stupid of me not to see the == that should have been been = when i commented out the line


(Inactive) #56

You’re doing just fine.


(Inactive) #57

Frankly I,m amazed that you were able to build one and get it working first try with only the schematic to go on. Also, that the software is working as well as it is fresh to the outside world. These problems were all minor and easily solved - no hardware issues to speak of.

I’ve got a few IotaWatt running in various sites in the US, but they are really just people who agreed to let me run them in their homes. They contribute nothing to the testing and development.

I’m looking forward to you getting the three phase going because I don’t have any three phase test sites. I’ve programmed for it, but I feel like the guy in Flight of the Phoenix who built “model” planes. We’ll see how it flies.

If you’re up for it, there are some experiments that I would like to run to determine the accuracy of measuring three phase with only only one VT. The approach is the same as the Emon “three phase sketch”, but can be done through the config utility and should be more accurate because the sample rate is ten times that of the TX.


(Elias - RExometer) #58

As soon as the developer kits are available I’d also be happy to help with testing the three phase approach.


(Inactive) #59

I’ll probably start a new thread “IotaWatt three phase” when the time is right. There will probably be some configuration options to turn on three phase specific configuration options so as not to burden the 99% with that complexity. Same goes for the forum thread.


(jan) #60

Thanks, i’ve been looking at the project for some time and i have build my own frankenstein emon (first 3 ct but adapted to 7) with a custom 3-phase script i adapted from the forum. So i wasn’t completely a noob :wink: .
However, looking at your project and code i’m still amazed how good it is put together and how good it has been engineered. (i still can’t grasp everything from your code, so i’ll have some more digging to do :wink:

Sure i’m willing to help you out with a 3 phase test, just let me know. (currently i have 5 extra ct and 2 extra vt next to the running old setup)

The 3 phase setup (emon) i have running now is doing relatively ok, but i can see that the measurements of a minor consumer (eg 5 to 10 watts) is sometimes influenced by a big one. Since i was at the limit of the arduino nano running it (without using extenders etc) i was happy that your project came along!