Welcome! Log in or Join us

Forums The Open Grid S-expression parsing issue

Subscribe to S-expression parsing issue 4 posts, 2 voices

Reply to topic

Feb 8, 2014 1:47am
6 posts


I've updated my code and added a new site so I was playing with discovery, which is great; saves a lot of work.

However, the s-expression parser for automated stream creation seems to be parsing prefixes and suffixes incorrectly.

For example, I'm submitting:

(site blablabla (node mynodename ? (p_dishwasher 2.11)(p_fridge 126.31)(p_tv 175.58)(p_serverroom 4.33))

The discovery works fine for dishwasher and fridge (the p_ prefix works correctly), however p_serverroom is both getting configured as a power stream (p_ prefix) as well as a substracting channels stream (_s suffix).

I think in the code that does this, there is something off with the regex, where it either doesn't have a prefix indicator (e.g. /^p_/) or suffix indicator (e.g. /_s$/) or both, causing this to happen.

I'm not using integers because this way there's nothing to rename once discovery is complete. I'd appreciate it if you can take a look and see if that can be fixed.

Thanks :)

Feb 8, 2014 2:14am
6 posts

One other request, on a stream I can set both "granularity" as well as "current value" to Raw/Aggregate/Days. i am submitting current watt usage in p_ power streams, as well as the total kW used for the previous hour (submitted one time for each hour).

Should I keep both granularity and current value as raw? Or does this only affect the generated graph for that stream and nothing else?

Thanks :)

Feb 10, 2014 2:02am
555 posts

Hi Infernix,

The correct way for the suffixes is to have them as a number after the underscore, p_1 p_2 etc.

With having a descriptor in there, things are going to be peculiar...  (as you have found)

Once the discovery has finished, then go and name your streams, the naming page will come up automatically or just to go


and name them with optional descriptions such as Dishwasher, Server room etc, which will be the useful name for the stream while using SEG.

Also, send all units in the primitave form, i.e. Watts, Watt Hours.  Then use the prefix on the stream edit page to set to taste.

Sam, @samotage


Feb 10, 2014 2:10am
6 posts

It seems to be working fine other than the suffix parsing. In my code (python code to interact with Plugwise smart plugs) I am not using any indexing so I just address my smart plugs with their lowercase description. It has the added advantage that the stream name immediately reflects what I am measuring.

If there isn't anything that can be done to the suffix parsing I will just leave it as-is and check the streams manually after discovery.



Log in to reply to this topic

Forums The Open Grid S-expression parsing issue

copyright © 2008 Smart Energy Groups pty ltd