How can I contribute to app development?

What’s the best way for me to contribute to app development?

I suspect I’m not alone, but I’d like a version of the divert app for battery storage.

Is there a github repo?

Ta!

I think all of the Apps reside in the Organisation Repo Emoncms · GitHub

3 Likes

If you are talking about the PV diversion to hot water (such as Robin’s Mk2 @calypso_rae mk2 I don’t think it could work as a battery charger because it is designed to control an AC supply to a resistive load (hot water heater). For a battery charger you would need to convert the export to DC and be able to control the current/voltage to suit the battery type - not trivial.

Hello @miker, a battery storage app would be great, @glyn.hudson would be interested in this too. The Emoncms Apps module (web apps build into emoncms) is based here: GitHub - emoncms/app: Emoncms App module: application specific dashboards: includes myelectric, mysolarpv, myheatpump and solar + wind app..
and code for the my solarpv divert app is here: app/apps/OpenEnergyMonitor/mysolarpvdivert at master · emoncms/app · GitHub
Let me know if you need any pointers.

1 Like

Several years ago, I posted this suggestion as to how surplus AC power could be used for battery charging. In the proposed scheme, there is no notion of the consumption of the load being variable; it is either on or off.
https://openenergymonitor.org/forum-archive/node/5391.html

Hi all,

I’d like to work on an app similar to “my solar” or “my solar divert”. I’m running solar pv and a powerwall. The Tesla app has room for improvement. With some excellent help from @borpin I’m logging power flow direct from the powerwall gateway (solar, battery in/out, load) and also have a CT clip to measure import/export.

I do not want emonpi to control charging, but do want an app to observe what’s happening.

I’m likely to need a few pointers, being new to php.

Like many, I’m juggling childcare/home schooling with work at the moment - so don’t expect rapid leaps forward!

Building on @icenov’s comment, you could indeed use Robin’s phase-control sketch, but as he says you would need to take the filtered proportional analogue output and use that to control the battery charger.

I think it might be possible to use the burst-mode controller if your battery charger was the simplest possible - i.e. nothing more that a transformer and rectifier, but if it had any sort of intelligence, I think you would fail, because the whole battery charger would be switched on and off every second or so. And even if you did have a simple battery charger, you would be likely to run into problems when switching the transformer - an inductive load.

@miker - I’d be very interested in this, but fear my programming skills are nowhere near good enough. Keep us posted, and Good Luck! :+1:

@haffle - don’t do yourself a disservice. Part of the battle will be nailing down what information the average user wants and how best to present it to them. So ideas welcome!

2 Likes

@miker I’d start a specific thread on the App you want to develop.

For the avoidance of confusion @miker is referring to software apps within emoncms for monitoring battery systems integrated with solar - rather than proposing a control scheme or any hardware implementation.


@miker there is a really basic template app which is available here: app/template.php at master · emoncms/app · GitHub and can help with understanding the basic structure of the emoncms apps.

I’ve made this template app available in the apps list and fixed an issue with the hidden apps settings entry in a commit to the master branch of the app repository this morning.

After getting a feel for the basic app structure you might like to use one of the more complete apps as a starting point for your new app. Lets say it made sense to modify the mysolarpvdivert app:

  1. Make a copy of the apps/OpenEnergyMonitor/mysolarpvdivert directory called say: apps/OpenEnergyMonitor/mysolarpvbattery

  2. Change the app.json entry to provide unique information: app/app.json at master · emoncms/app · GitHub

  3. rename mysolarpvdivert.php to be mysolarpvbattery.php

  4. Check that the new app is available in the emoncms apps list.

  5. Start modifying the mysolarpvbattery app as you like to achieve the results that you are after.

It’s worth noting that while the file name is .php, its actually mostly a html and javascript file, so most of the programming work is javascript - you shouldn’t need to learn much php.

Let me know if you get stuck! best of luck :slight_smile:

1 Like

I think the existing My Solar Divert app might actually be very close already to being something very useful for Powerwallers. I have been using the app with Solar PV and Immersion divert (Solar iBoost) for a couple of years quite happily, and just had a Powerwall 2 installed.

Incidentally I was very pleased to see the 1hour button on My Solar Divert return recently, my gratitude to those who asked for it and, more importantly, who made it happen :slight_smile:

I’m still playing with it but my approach was to treat the Powerwall as both a Generator (a wind turbine actually, which the My Solar Divert app claims optionally to be able to handle - more on that later…) and a Divert. It is a Generator when it is discharging (aka Wind Turbine), a Divert when it is charging. It is fairly straightforward to do the input processing to provide both charging and discharging feeds and specify them in the app.

Because I already have a divert (the immersion) I have added the 2 divert sources together and used the sum as the divert source for the app, for now at least. Some work on the source code should be able to separate the two graphically, which would be nicer.

The app doesn’t seem to work entirely correctly with a Wind Turbine feed specified though (aka Powerwall discharging). The code does a test for a wind value being specified - it is optional:

   if (config.app.wind.value) {
        has_wind = true;
        $(".generationtitle").html("GENERATION");
    } else {
        $(".generationtitle").html("SOLAR");
    }

but in my case the generation title remains stubbornly at SOLAR, although the app is clearly recognising the Wind Turbine feed as an input, as evidenced by:


Note the grey box/white text at the centre, on top of the pale blue area. It clearly shows Solar 0 W, Wind 461 W, so the app is reading the feeds properly. I’ll have to wait until tomorrow to see if I can get a shot of a combination of WIND and SOLAR non-zero together!

I’ve also seen green in the graph, which I’d never seen before, although this was due to a mistake in configuration. I’m hoping that WIND and SOLAR will appear stacked as generation sources in different colours. No time to check the code yet though.

Has anyone seen the Wind Turbine feed work in the My Solar Divert app? I couldn’t find any evidence of it.

Anyway, if that all works correctly, then perhaps the only code change - apart from changing the text WIND to be BATTERY DISCHARGE would be to depict 2 different DIVERT sources, IMMERSION and BATTERY CHARGE. Oh, and add in a way to import and show Battery SOC, which I have seen can be obtained from the Tesla API by a simple http GET. And probably 2 million other things :wink:

Ah, spot the schoolboy error. I hadn’t noticed that the “GENERATION” label in the summary at the bottom! I was only looking at the top row. However, this morning I do see a a mix of Wind and Solar in the tooltip - which is good. I think this looks promising, but the representation needs tweaking for my needs, especially the top row summary, graphing and use of colours.

This morning’s graph:


showing the kettle boiling and (tooltip) being sourced by 725 W solar + 2.489 kW wind/battery :slight_smile: