You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include login link in Easee authentication error messages (#35)
* Initial plan
* Add ApplicationOptions and update Easee error message with login link
Co-authored-by: thomasneuberger <23504477+thomasneuberger@users.noreply.github.com>
* Add Application.BaseUrl to development settings
Co-authored-by: thomasneuberger <23504477+thomasneuberger@users.noreply.github.com>
* Update documentation to include Application.BaseUrl configuration and login link feature
Co-authored-by: thomasneuberger <23504477+thomasneuberger@users.noreply.github.com>
* Use port 5271 from launch config and make login link clickable in Telegram
Co-authored-by: thomasneuberger <23504477+thomasneuberger@users.noreply.github.com>
* Switch from HTML to MarkdownV2 for clickable links in Telegram
Co-authored-by: thomasneuberger <23504477+thomasneuberger@users.noreply.github.com>
* Send login URL as separate plain text message instead of formatted link
Co-authored-by: thomasneuberger <23504477+thomasneuberger@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thomasneuberger <23504477+thomasneuberger@users.noreply.github.com>
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -127,6 +127,7 @@ public static class Bootstrap
127
127
- Configuration sections match the domain (e.g., `HomeAssistant`, `Telegram`, `SmartHome`)
128
128
- Store sensitive data externally (marked as `<set externally>` in appsettings.json)
129
129
- Use user secrets for development, environment variables for production
130
+
-**URL Configuration**: When configuring URLs in appsettings files that reference services in the same repository, always use the same port as defined in the launch configuration (`Properties/launchSettings.json`). For example, if `launchSettings.json` specifies `"applicationUrl": "http://localhost:5271"`, then `Application.BaseUrl` in appsettings should also use port `5271`.
Copy file name to clipboardExpand all lines: TgHomeBot.Charging.Easee/README.md
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,10 +11,13 @@ This project provides integration with the Easee API for electric vehicle chargi
11
11
12
12
## Configuration
13
13
14
-
Add the following section to your `appsettings.json`:
14
+
Add the following sections to your `appsettings.json`:
15
15
16
16
```json
17
17
{
18
+
"Application": {
19
+
"BaseUrl": "http://localhost:5271"
20
+
},
18
21
"Easee": {
19
22
"BaseUrl": "https://api.easee.com"
20
23
},
@@ -24,6 +27,10 @@ Add the following section to your `appsettings.json`:
24
27
}
25
28
```
26
29
30
+
-**Application.BaseUrl**: The base URL where your TgHomeBot application is hosted. This is used to generate login links in error messages. Use the same port as defined in `launchSettings.json` (default: 5271).
31
+
-**Easee.BaseUrl**: The Easee API endpoint (typically `https://api.easee.com`)
32
+
-**FileStorage.Path**: Directory where the authentication token will be stored
33
+
27
34
The authentication token will be stored in `{FileStorage.Path}/easee-token.json`.
28
35
29
36
## Authentication
@@ -34,6 +41,25 @@ Navigate to `/Easee/Login` to access the authentication page where you can enter
34
41
35
42
**Important**: The credentials are not stored - they are only used to authenticate with the Easee API. The resulting access token and refresh token are stored persistently.
36
43
44
+
### Authentication Errors
45
+
46
+
When using the Telegram bot commands (e.g., `/monthlyreport`, `/detailedreport`) without valid authentication, the bot will respond with two messages:
47
+
48
+
1. An error message:
49
+
```
50
+
❌ Fehler beim Abrufen der Ladevorgänge:
51
+
Nicht mit Easee API authentifiziert. Bitte anmelden.
52
+
```
53
+
54
+
2. A follow-up message with the login URL:
55
+
```
56
+
http://localhost:5271/Easee/Login
57
+
```
58
+
59
+
The URL in the second message can be clicked to open the login page directly in the browser.
60
+
61
+
This makes it easy to authenticate directly from the Telegram error message.
62
+
37
63
### Programmatic Authentication
38
64
39
65
You can also authenticate programmatically using the `IChargingConnector` service:
0 commit comments