File: __init__.py

package info (click to toggle)
python-ovoenergy 3.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 352 kB
  • sloc: python: 1,519; makefile: 4
file content (212 lines) | stat: -rw-r--r-- 7,056 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
"""Setup for tests."""

from typing import Final

USERNAME: Final[str] = "test"
PASSWORD: Final[str] = "test"
ACCOUNT: Final[int] = 123456789
ACCOUNT_BAD: Final[int] = 654321789

RESPONSE_JSON_BASIC: Final[dict] = {"test": "test"}

RESPONSE_JSON_AUTH: Final[dict] = {"code": "test"}

# The token value is fake, don't panic.
#
# Decoded token:
#
# {
#   "alg": "HS256",
#   "typ": "JWT"
# }
#
# {
#   "sub": "5cafe9c4-a942-46b5-a67c-5882eba0a03c",
#   "permissions": [
#     "account::123456789"
#   ],
#   "iat": 1640995200,
#   "exp": 1640998800
# }
#
RESPONSE_JSON_TOKEN: Final[dict] = {
    "accessToken": {
        "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1Y2FmZTljNC1hOTQyLTQ2YjUtYTY3Yy01ODgyZWJhMGEwM2MiLCJwZXJtaXNzaW9ucyI6WyJhY2NvdW50OjoxMjM0NTY3ODkiXSwiaWF0IjoxNjQwOTk1MjAwLCJleHAiOjE2NDA5OTg4MDB9.ZXZcYyG6vT0NMdKlUy9KDnCj4DJyC7o3rX_AmPef6hw"
    },
    "expiresIn": 3600,
    "refreshExpiresIn": 0,
}

RESPONSE_JSON_BOOTSTRAP_ACCOUNTS: Final[dict] = {
    "data": {
        "customer_nextV1": {
            "id": "5cafe9c4-a942-46b5-a67c-5882eba0a03c",
            "customerAccountRelationships": {
                "edges": [
                    {
                        "node": {
                            "account": {
                                "id": ACCOUNT,
                                "accountNo": str(ACCOUNT),
                                "accountSupplyPoints": [
                                    {
                                        "startDate": "2024-01-01T23:00:00Z",
                                        "supplyPoint": {
                                            "sprn": "3456766576",
                                            "fuelType": "gas",
                                            "isOnboarding": False,
                                            "isPayg": False,
                                            "address": {
                                                "addressLines": ["ADDR"],
                                                "postCode": "SW1A 1AA",
                                            },
                                            "meterTechnicalDetails": [
                                                {
                                                    "meterSerialNumber": "3456766576",
                                                    "mode": "credit",
                                                    "type": "AB123",
                                                    "status": "active",
                                                }
                                            ],
                                        },
                                    },
                                    {
                                        "startDate": "2024-01-01T23:00:00Z",
                                        "supplyPoint": {
                                            "sprn": "4536756746",
                                            "fuelType": "electricity",
                                            "isOnboarding": False,
                                            "isPayg": False,
                                            "address": {
                                                "addressLines": ["ADDR"],
                                                "postCode": "SW1A 1AA",
                                            },
                                            "meterTechnicalDetails": [
                                                {
                                                    "meterSerialNumber": "4536756746",
                                                    "mode": "credit",
                                                    "type": "AB123",
                                                    "status": "active",
                                                }
                                            ],
                                        },
                                    },
                                ],
                            },
                        },
                    }
                ],
            },
        },
    },
}

RESPONSE_JSON_DAILY_USAGE: Final[dict] = {
    "electricity": {
        "data": [
            {
                "consumption": 10.24,
                "interval": {
                    "start": "2024-01-01T00:00:00Z",
                    "end": "2024-01-01T23:59:59.999000Z",
                },
                "meterReadings": {
                    "start": "12345",
                    "end": "67890",
                },
                "hasHalfHourData": None,
                "cost": {"amount": "2.94", "currencyUnit": "GBP"},
                "rates": {
                    "anytime": 0.25,
                    "standing": 0.45,
                },
            }
        ],
    },
    "gas": {
        "data": [
            {
                "consumption": 14.68,
                "volume": None,
                "interval": {
                    "start": "2024-01-01T00:00:00Z",
                    "end": "2024-01-01T23:59:59.999000Z",
                },
                "meterReadings": {
                    "start": "12345",
                    "end": "67890",
                },
                "hasHalfHourData": None,
                "cost": {"amount": "2.56", "currencyUnit": "GBP"},
                "rates": {
                    "anytime": 0.18,
                    "standing": 0.35,
                },
            }
        ],
    },
}

RESPONSE_JSON_HALF_HOURLY_USAGE: Final[dict] = {
    "electricity": {
        "data": [
            {
                "consumption": 0.5,
                "interval": {
                    "start": "2024-01-01T00:00:00Z",
                    "end": "2024-01-01T00:30:00Z",
                },
                "unit": "kWh",
            }
        ],
    },
    "gas": {
        "data": [
            {
                "consumption": 0.2,
                "interval": {
                    "start": "2024-01-01T00:00:00Z",
                    "end": "2024-01-01T00:30:00Z",
                },
                "unit": "m³",
            }
        ],
    },
}

RESPONSE_JSON_FOOTPRINT: Final[dict] = {
    "from": "2024-01-01T00:00:00Z",
    "to": "2024-01-01T23:59:59.999000Z",
    "carbonReductionProductIds": [],
    "carbonFootprint": {
        "carbonKg": 2200.1234,
        "carbonSavedKg": 0.0,
        "kWh": 1578.3246,
        "breakdown": {
            "electricity": {
                "carbonKg": 200.1234,
                "carbonSavedKg": 230.02,
                "kWh": 65645.92,
            },
            "gas": {
                "carbonKg": 2000.1234,
                "carbonSavedKg": 340.02,
                "kWh": 10664.74363579,
            },
        },
    },
}

RESPONSE_JSON_INTENSITY: Final[dict] = {
    "forecast": [
        {
            "from": "2pm",
            "intensity": 82,
            "level": "low",
            "colour": "#0A9928",
            "colourV2": "#0D8426",
        },
    ],
    "current": "low",
    "greentime": None,
}