dinmammas / homebridge-tibberswitch

Allows you to do automation based on the current electricity price
9 stars 1 forks source link

Add setting for currency outside € #6

Closed napthemax closed 6 months ago

napthemax commented 6 months ago

Not a big one, but since Tibber is active also in non € countries, many users do not have "cents". It would be nice to add a setting to select currency. Automating it to all currencies in the world is overkill, better a simple setting. For Sweden (SEK) could be something like this:

    {
        "currency": "SEK",
    }

Or (since it is displayed in öre/øre for Swedish & Norwegian today but it is named cents in the plugin)

    {
        "currencyname": "öre",
    }
dinmammas commented 6 months ago

Det kan la jag ordna ;)

dinmammas commented 6 months ago

Please download the latest version and try it out :)

napthemax commented 6 months ago

Got this: 2024-02-21 17:46:16Tibberswitch Bridge starting 2024-02-21 17:46:54Tibberswitch BridgeLoaded plugin 'homebridge-tibberswitch' 2024-02-21 17:46:54Tibberswitch BridgeLoading 1 accessories... 2024-02-21 17:46:54Tibberswitch BridgeBridge is running on port 51856. 2024-02-21 17:46:55Tibberswitch BridgeTibberSwitchCould not fetch tibber values - ReferenceError: currency is not defined 2024-02-21 17:47:18Tibberswitch BridgeConfiguration change 2024-02-21 17:47:18tibberswitchbridge stopping

From this: { "accessories": [ { "name": "TibberSwitch", "token": "XXX", "threshold": 0, "home": 0, "currency": "öre", "accessory": "HomebridgeTibberswitch" } ], "platforms": [] }

dinmammas commented 6 months ago

That's what I get for coding between meetings. Bugfix coming.

dinmammas commented 6 months ago

Please try the updated index.js and report back.

napthemax commented 6 months ago

Please try the updated index.js and report back.

Just a tiny bit over my comptence level (i.e. Terminal is fine, just pushing the right file from my computer to the correct folder is more than I can do without hours of Google ...).

napthemax commented 6 months ago

... ah. Now 0.3.6 appeared. Updated and voila:

2024-02-21 22:30:41Tibberswitch Bridge starting 2024-02-21 22:31:17Tibberswitch BridgeLoaded plugin 'homebridge-tibberswitch' 2024-02-21 22:31:17Tibberswitch BridgeLoading 1 accessories... 2024-02-21 22:31:18Tibberswitch BridgeBridge is running on port 51856. 2024-02-21 22:31:18Tibberswitch BridgeTibberSwitchDaily prices fetched. Daily average is: 77 öre. 2024-02-21 22:31:18Tibberswitch BridgeTibberSwitchCurrent electricity price is 67 öre. 2024-02-21 22:31:18Tibberswitch BridgeTibberSwitchCurrent price percentage is 87% of the daily average 2024-02-21 22:31:18Tibberswitch BridgeTibberSwitchPrice is below your desired threshold.

dinmammas commented 6 months ago

Alrighty then. Enjoy. 😄