Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration option to start the data import at each start up #18

Merged
merged 6 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM oven/bun:1.1-alpine as depencies
WORKDIR /src
COPY src/package.json src/bun.lockb ./
RUN bun install


FROM oven/bun:1.1-alpine as builder
WORKDIR /src
COPY src .
COPY --from=depencies /src/node_modules/ /src/node_modules/
RUN bun run build

FROM ghcr.io/hassio-addons/base-nodejs:0.2.1
WORKDIR /app
COPY --from=builder /docker/index.mjs .

CMD [ "node", "./index.mjs" ]
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,42 @@ Pluxee Belgium is widely recognized for its diverse range of services, notably i

This add-on being is designed to seamlessly integrate meal voucher transactions into Firefly III, streamlining the process of managing financial data. By automating the import of meal voucher transactions, users can effortlessly track and categorize their expenses within the Firefly III platform. This application simplifies financial management, providing users with a more efficient and organized way to monitor their meal-related expenditures. Its integration capabilities ensure a smooth and user-friendly experience, enhancing the overall functionality of Firefly III for those who rely on meal vouchers as part of their financial transactions..

## Configuration
First create your Firefly [Personal Access Token](https://docs.firefly-iii.org/how-to/firefly-iii/features/api/#personal-access-tokens). Then create your Pluxee accounts manually in Firefly. Note the account's IDs : you can find them in the URL in an account's page. Finally, fill in the mandatory options in the configuration tab of the add-on. You can set a [cron](https://crontab.guru/) to fetch from Pluxee at regular intervals.

- Addon options

```yaml
# Mandatory
"login": your Pluxee login
"password": your Pluxee password
"url": your Firefly instance URL
"token": your Firefly Personal Access Token
# Optional
"cron": the cron used to import data from Pluxee # More info, see https://crontab.guru/
"book": the Firefly account ID for the Pluxee Book account
"eco": the Firefly account ID for the Pluxee Cco account
"gift": the Firefly account ID for the Pluxee Gift account
"lunch": the Firefly account ID for the Pluxee Lunch account
"sportCulture": the Firefly account ID for the Pluxee Sport/Culture account
"transport": the Firefly account ID for the Pluxee Transport account
"conso": the Firefly account ID for the Pluxee Consumption account
"after": the first date to import the transactions from in the format yyyy-mm-dd
"importAtStartUp": true to start the import at each add-on start-up, false otherwise
```

## Installation

The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.

1. Add my add-ons repository to your home assistant instance (in supervisor addons store at top right, or click button below if you have configured my HA)
[![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https://github.com/olibos/ha-addon-pluxee)
1. Install this add-on.
1. Click the `Save` button to store your configuration.
1. Set the add-on options to your preferences
1. Start the add-on.
1. Check the logs of the add-on to see if everything went well.

## Contributing

I'm all about collaboration and would love for you to jump in and contribute to this project. Whether you're spotting bugs, suggesting cool new features, or just want to spruce up the docs, your input is gold. Feel free to fork the repo, make your magic in new branches, and hit me up with pull requests. Let's make this project rock together! Big thanks for your interest and all the cool stuff you bring to the table. Cheers! 🚀
Expand Down
1 change: 1 addition & 0 deletions docker/config.yml → config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ schema:
sportCulture: int?
conso: int?
after: match(^(?:\d{4}-\d{2}-\d{2})$)?
importAtStartUp: bool?
6 changes: 0 additions & 6 deletions docker/Dockerfile

This file was deleted.

File renamed without changes
File renamed without changes
4 changes: 4 additions & 0 deletions repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://developers.home-assistant.io/docs/add-ons/repository#repository-configuration
name: Firefly iii - Pluxee
url: 'https://github.com/olibos/ha-addon-pluxee'
maintainer: olibos
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Options = {
transport?: number
conso?: number
after?: string
importAtStartUp?: boolean
}

type NumericKeys<T> = {
Expand Down Expand Up @@ -133,6 +134,7 @@ async function check({ login, password, ...options }: Options) {

loadOptions(process.env.OPTION_FILE ?? '/data/options.json')
.then(options => {
if (options.importAtStartUp) check(options);
CronJob.from({
cronTime: options.cron,
onTick: async () => { await check(options); }
Expand Down
Loading