[APP][Pro] Piggy Bank

After installing todays Homey update 11.1.0 I’m having some issues with Piggy Bank:

In Piggy Bank settings all my Heat-It thermostats should lower temperature when price get’s over normal. But after this Homey update Piggy Bank turn off all my thermostats…

Anyone else having this issue?..

EDIT:

Found the issue…
I have checked the limitation for max 5000 kWh/month and suddenly Piggy Bank believe I’m over that limit - even that I’m not…
So switched of that option and things are working again

In order for the MQTT reader to be compatible with piggy it needs the following capabilities:

  • measure_power
  • meter_power.day

Do you know the names of the capabilities for your MQTT device?

Confirmed, “supported” meter readers cannot be listed right now… Hmm… I should probably make a better reporting option for meter readers. Thanks for letting me know.

There is only one way to get that message and that is when piggy sends instructions to the charger to change the offered current, and later it finds out that the offered power capability did not have the value that was written to it.

What happens if you remove the piggy charge controller and try to manually drag the sliders that control the power in the easee app (try both the sliders), do they jump back to some other positions after a while? Is there a log in the Easee app that can indicate where the change came from?

The response test that failed for you tries to set the offered amps to 10A, but if you say it’s forced to 11A, maybe that’s why it says something else is controlling the charger. What about the car, is a car connected when you do this test? I’m not sure if the offered amps jump to 0 if there is no car. Maybe that could be it?

Otherwise, If you give me access to your charger one evening I might try to figure out what is happening.

Hmmm… It sounds like the estimated power usage is a bit off. Did you install Piggy this month, or did you use Piggy before May? If you installed it during May the app just estimate that you used as many kW as you would if you maxed the budget for the time there is no data. This may be a bit over the top, maybe I should reduce it… If you used Piggy before May, then this is a new issue I have never heard of…

Yes, among the capabilities are these two which I believe are the relevant ones.
I see that my the daily energy meter capability is named meter_power.1 rather than .day
Maybe that is why. I can try to change it, but this is how the naming defaults to when setting it up the mqtt device manually by the MQTT Hub app.
So if you have more than one meter_power capability, it gets the numbers afterwards, .1, .2, .3 etc. to separate them.

{
  "measure_power": {
    "capability": "measure_power",
    "stateTopic": "Pow-U/meter/import/active",
    "setTopic": "",
    "valueTemplate": "",
    "outputTemplate": "",
    "title": "Power"
  },
  "meter_power.1": {
    "capability": "meter_power",
    "stateTopic": "Pow-U/realtime/import/day",
    "setTopic": "",
    "valueTemplate": "",
    "outputTemplate": "",
    "title": "Energy this day"
  },

Ok, so I changed the id to meter_power.day, and now it works!

1 Like

Great, maybe I should add a note so it is easier for others with MQTT devices to set it up.
I just assumed everyone with MQTT meter readers was setting up the devices according to this description:

I also used that guide initially. However there is a bug? in the MQTT Hub app (that is not likely to be fixed any time soon), that if you don’t add every cability manually, but paste in the text in the device setting as suggested by the guid, the app will ignore the different capability display name and just show same name for every capability. So I set it up manually.

I’ve later learned that if you replace “displayName” with “title” it will show the custom capability name. So then you can follow the guide and just replace this string to make it work.

So maybe it isn’t really a problem generally.

I have a question about the charge cycle visualization.
My understanding is that it should show how far it is in its charge cycle and should thus follow the battery capacity curve as the charging progress.
But for me this is not happening, the charge cycle doesn’t progress smoothly, but makes some sudden jumps as seen in example picture from tonights charge session.

Just wondering if this is normal behaviour or a bug of some sort, or I’m missing som setting or flow.

I also have a question about the “charge plan” json output.

The “cycleStart” and “cycleEnd” tag are currently timestamped as the time the charge plan is created, and the chosen end time.
Rather than the start and end of the “green area” in the charge plan where it plans to do the actual charging.

If this is intentional, is it possible to also add the start and end time of the “green area” in the charge plan to the json output?

Hi Frode. It seams that something was stuck in the Easee app in Homey. Ex. the Phase was set to three phase, but in the Easee charger this has always been one Phase 230v. So I dont know what happend here. But I tried to reinstall the easee app and thats seams to work. So I have now managed to add the easeee charger in the controll app again. But still the max current is set to 11A, so this is still a problem. How should i give you access to the charger?

Hmm… maybe there is a bug there, I will have to check that…, but I believe it only updates at the start of every new hour…

But the green area can be split and doesn’t have to be continuous… so that wouldn’t help you.
I believe there is already a part of the json-string that contains the schedule, so you see which hours have charging scheduled from there…

If you disable the charge controller and are able to adjust the sliders in the Easee Homey app itself (and the current stays at another level than 11A), then this should be fixable from piggy, otherwise it’s a problem external to Piggy. I am a bit tied up right now so this is as far as I can help you right now, but I may be able to come back to this in a week, sorry for the delay.

Yes the green are can be split, but that is not so important to me. In my opinion it would be better to have the cycleStart at the beginning of the first green, and cycleEnd at the end of the last green. Then I know within which time frame it plans to charge, splits or not.
I could get this from the current json as you say, but I need a lot more elaborate flows to get it, so it would just be more convenient for me if the start and end cycle time was based of the start and end of the green area.

Here’s how you do it.
You install the homeyscript app. Insert this THEN card:
image
You use the JSON-variable token @frodeheg kindly has provided and insert it as the argument:
image
Then you paste this code:

//Get charge data text
var parsedData = JSON.parse(args[0]);
var startTime = new Date(parsedData.cycleStart);
var estimatedEndTime = new Date(parsedData.cycleStart);
var cycleEndTime = new Date(parsedData.cycleEnd);

// Function to find the first non-null index in array
function findFirstNonNullIndex(array) {
    for (var i = 0; i < array.length; i++) {
        if (array[i] !== null) {
            return i;
        }
    }
    return -1; 
}
// Function to count non-null and non-zero elements in array
function countNonNullElements(array) {
    var nonNullElements = array.filter(function(element) {
        return element !== null && element !== 0;
    });
    return nonNullElements.length;
}

// Function to find the last non-null and non-zero index in array
function findLastNonNullIndex(array) {
    for (var i = array.length - 1; i >= 0; i--) {
        if (array[i] !== null && array[i] !== 0) {
            return i;
        }
    }
    return -1;
}

// Find start time by finding the first non-null index in originalPlan
var firstNonNullIndex = findFirstNonNullIndex(parsedData.originalPlan);
startTime.setHours(startTime.getHours() + firstNonNullIndex);
var startH = startTime.toLocaleTimeString('nb-NO', { hour: 'numeric', timeZone: 'Europe/Oslo' });

// Estimated end time = cycleStart+last nonNull index in currentPlan
var lastNonNullIndex = findLastNonNullIndex(parsedData.currentPlan);
estimatedEndTime.setHours(estimatedEndTime.getHours() + lastNonNullIndex); 
var endH = estimatedEndTime.toLocaleTimeString('nb-NO', { hour: 'numeric', timeZone: 'Europe/Oslo' });

// Extract the deadline time
var deadlineH = cycleEndTime.toLocaleTimeString('nb-NO', { hour: 'numeric', timeZone: 'Europe/Oslo' });

// Number of non-null elements in ORIGINAL plan = Originally planned number of charge hours
var numPH = countNonNullElements(parsedData.originalPlan);
// Number of non-null elements in CURRENT plan = Currently planned number of charge hours
var numCH = countNonNullElements(parsedData.currentPlan);

//Comment the code (place // in front) of the "return" you don't need
//This one is suited for "order X number of hours", the charge session is going to stop when it's scheduled to stop
return `Start: ${startH}:00 | Slutt: ${endH}:00\n${numPH} ${numPH === 1 ? "time" : "timer"} | Innen: ${deadlineH}:00`;

//This one is suited for "order X number of kWh". The end time can change based on kWh received pr. hour
//return `Start: ${startH}:00 | Beregnet Slutt: ${endH}:00\nBestilt: ${numPH} ${numPH === 1 ? "time" : "timer"}  |  Nå-plan: ${numCH} ${numCH === 1 ? "time" : "timer"}\nInnen: ${deadlineH}:00`;

Then you for instance can do like this:


Which uses the image tag Piggy provides to the charge controller, and get a pop-up on your phone like this:

This pop-up can be triggered by you opening Siri on your phone and say “charge plan” or however you prefer.

1 Like

Hi Frode,
I’m pretty new to Piggy Bank and came up with 2 questions:

  1. Is there any way to support solar power? Using excess solar power to store in water heater and in car charging would be nice. Needs a bit of different calculation: price is 0 as long as total power use stays negative so can unleash heating and car charging even if prices are high otherwise.
  2. Would a car charger work if both Tibber (or any other entity) and Piggy Bank manages it? I kind of just want to make sure that Piggy Bank can keep the total use below a certain limit even if Tibber is managing the smart charge schedule.

Peter

Ok, I can probably make a shortcut for it in the json-string as more people probably will ask for it when I make it public.

It’s on the plan, any input you have can be placed here: Add suport for electricity production · Issue #2 · frodeheg/no.sparegris · GitHub

No, only one source can control the charging, otherwise they will battle each other and you’ll see a lot of fluctuations in the controlled power. I don’t know how often Tibber try to control the charger, you may try if you want, but I doubt that they will be very happy if you’re overriding their signals for the charger control given that you need to follow their schedule to get their price guarantee or however that works.

@madpet If i’m not mistaken, letting Tibber control the power output is optional. Meaning, you could let Tibber control just “smart charging” and let Piggy Bank control the power output.
I was under the impression that Piggy after releasing the new charge controller is configurable to support just throttling the power?

I was under the impression that Tibber guarantees 20% off your average kWh price (not the NordPool average), and it’s not possible to get more than 20%. Have you gotten more? If not I’ve seen a user who measured his %-earnings each month and concluded he saved more than 20% on the regular just by picking the cheapest hours and duly calculating his need of charge. Hence you pay a monthly fee for something that’s inferior to Piggy. Except the willingness to pay for layout and ease of access of course…

@frodeheg thanks, I’ll add some input to the new feature!

Also Tibber seemed to only control schedule and on/off (even with solar) so adding control of output probably would not harm more then throwing off Tibber’s expected resulting charge levels in the plan. I mainly think of adding control of output myself for solar charging and let Piggy Bank do emergency shut off when needed for staying within the desired hourly limit.

@dooniem I’m experimenting now so will see how does that scale up. But according to what I saw so far, one can combine the 3 ways: Tibber for schedule (cheap and solar), power output “manually” for solar and piggy for non-solar plus cut off if needed.

The latter 2 features can be supported by piggy completely when it has power production features.

Yes, but I assume it is using the same capabilities to control power as tibber is (target_circuit_current and target_charger_current). Are you saying that you want tibber to control target_circuit_current and piggy to control target_charger_current?)

For @madpet 's info, in an ideal world you would let Piggy handle the output continuously, but if the charger is set to “off”, then nothing would really happen/output. But “on/off” on the Easee charger writes data to the storage medium in the charger, which have a limited number of writes before it’s dead. So Piggy and Tibber stay away from the “on/off” and control just the “dynamic power” which somehow doesn’t write to disk and in turn doesn’t reduce the lifetime of your box.

I don’t have Tibber anymore, but I assume their smart charging, with output throttle disabled, only communicates one way. If Tibber says it’s fine to smart charge, circuit current = 32A. If not set 4A to pause, 0A when battery full or “smart-period=over”. Internal fuse settings will prohibit 32A if 16A is max.

So my theory is that Piggy should be able to send multiple signals in between without disturbing. @madpet could maybe test drive this theory? :sweat_smile:
If Piggy is set to “just control the output”-mode, Piggy will sense a non-scheduled charge session and instead of canceling it, basically think “A valid charge session has started” and treat it like it treats a thermostat. Adjust output as it see’s fit. Then interpret and abide by Tibber’s one-way commands for when to pause because of an expensive hour and so on. In fact any incoming changes, for instance a user made change through the Easee app…But I’m clearly just speculating!

Thanks, this works great!

Ok, I can probably make a shortcut for it in the json-string

Allthoug @dooniem’s method works great, this would make it easier for those (like me) that are not well versed in HomeyScript

Feature request: Max Hourly Consumption Step 0: 0kWh

This might seem a bit weird, but hear me out… :wink:

In my house I have both electric radiators and electric floor heating.
I’ve been using Piggy Bank for a year now, and it works well to avoid peak power usage.
But as the house is old and not very well insulated, on the coldest winter days I use a flow to determine if the Max Consumption in Piggy Bank need to increase in order to keep it somewhat comfortable indoors.
So the advanced flow considers the outside temperature, and adjusts the consumption limit in Piggy Bank accordingly. This works very well.

But, as summer approached, I noticed that even when the outside temperature was getting higher (15°C up), some of my heated floors still activated as the room temperature had fallen during the night. They typically turned on only for a few minutes, maybe an hour tops, but still, I don’t need that in say June.
My advanced flow was configured to set the limit to 0 kWh at these temperatures, but I noticed that the lowest step in Piggy Bank is 0-2kWh, allowing (I guess?) for up to 2 kWh total use.

My question is therefore, if it could be possible to have a Step 0 allowing zero kWh.
Of course, each would need to make sure other appliances that are managed by Piggy Bank are not affected (water heater, car charger, etc.).

Another use for this would be vacation mode - being able to easily say that for the next week or until changed, I allow 0 kWh spent on heating (again, the user need to understand any implications here, in the winter time this could be dangerous in terms of freezing water pipes etc.).

Hello and thanks for making a great app.

I have difficulties understanding and setting på my two Easee chargers in the app. Can you help me with what settings I should pick to accomplish the following?

  • I want each charger to offer a minimum of 7A at all times, with absolutely no exceptions (including busting a tariff). Under no circumstances will the chargers be allowed to pause, wait or offer less than 7A each.
  • I want SpareGris to regulate power between the minimum stated above, and the maximum, which is 32A shared between both chargers. But only throttling - never go below 7A on each charger.
  • I also (at least for now) don´t want to use schedules, I only want SG to regulate power draw between min and max.

I don´t quite understand the settings - under “modus og prioritet”, what does “always on”, “styrt” or “always off” mean, when IIRC, SpareGris will never switch off of send start/stop commands to Easee, only regulate current?

Also, under “prisstyring” - what are the meaning of the modes “foretrukket på”, “alltid av”, “ignorer”, given the above assumption?

Is what I want even possible or is it better to regulate it with flows and leave SG to only control temperature and everything else?

Thanks!