GuyKh / iec-custom-component

HomeAssistant Custom Component for IEC
MIT License
131 stars 5 forks source link

Specify custom discount rates per hour #66

Closed GuyKh closed 5 months ago

GuyKh commented 8 months ago

Checklist

Is your feature request related to a problem? Please describe.

No.

Describe the solution you'd like

With private electric providers, many offer a discount per hours - e.g. 15% off on weekdays between 08:00-17:00. Need to think about how to model, and use it within the component to get a more clear estimation of the cost.

I've thought about a json with hour ranges describing the discount from the full tariff, but that's a longshot.

e.g.

{
    // Sunday
    "0": { 
        "from": "08:00",
        "to": "17:00",
        "price": 0.50
    },
    "1": { 
        "from": "20:00",
        "to": "23:59",
        "discountPercent": 15
    },
    "2": { 
        "from": "00:00",
        "to": "08:08",
        "discountPercent": 15
    }
    // ...
}

Downside is that it's not very intuitive, and hard to maintain.

OnFreund commented 7 months ago

HA has existing mechanisms for this.

GuyKh commented 7 months ago

@OnFreund awesome, however, it requires creation of a manual helper, no?

OnFreund commented 7 months ago

It requires a separate helper, but there's a UI to add and maintain it, and it appears within your device. I use it for water consumption and it's working really well.

GuyKh commented 7 months ago

One thing to mention, in this component, there's no way to use it witg the LongTermStatistics - i.e. Energy dashboars as far as I understand

OnFreund commented 7 months ago

UtilityMeter supports long term statistics

maorcc commented 5 months ago

@OnFreund / @GuyKh, I think it would be best to integrate with a source like Kamaze and get all possible plans data. Let the user select the current plan, and based on the last month's consumption pattern, the system can even suggest a better plan if there is such.

GuyKh commented 5 months ago

@maorcc while it's not a bad idea, I think the implementation is rough since kamaze.co.il doesn't have a valid API and the values are textually vague and require parsing - i.e. הנחה בימים א'-ש' בשעות 23:00 ועד 7:00 למחרת - what's the discount rate? how to set it into a valid json structure instead of parsing Hebrew each time;

Another maybe more interesting option would be Chashmalink (by @sinaini) Need to dig deeper into their API

OnFreund commented 5 months ago

Also worth noting that HA doesn't accept scraping-based integrations, so using kamaze would make it impossible to contribute this integration into core. In any case, if you are going for it, I would recommend decoupling the two - one integration for Kamaze that exposes the relevant sensors, and one for IEC that lets you select sensors for the different tariffs.