diff --git a/doc/EventCHConsumptionUpdatedValuesReceived b/doc/Challenge(Event) Replies/EventCHConsumptionUpdatedValuesReceived similarity index 100% rename from doc/EventCHConsumptionUpdatedValuesReceived rename to doc/Challenge(Event) Replies/EventCHConsumptionUpdatedValuesReceived diff --git a/doc/EventCHDetailsUpdatedValuesReceived.json b/doc/Challenge(Event) Replies/EventCHDetailsUpdatedValuesReceived.json similarity index 100% rename from doc/EventCHDetailsUpdatedValuesReceived.json rename to doc/Challenge(Event) Replies/EventCHDetailsUpdatedValuesReceived.json diff --git a/doc/EventFlexDetailsUpdatedValuesReceived.json b/doc/Challenge(Event) Replies/EventFlexDetailsUpdatedValuesReceived.json similarity index 100% rename from doc/EventFlexDetailsUpdatedValuesReceived.json rename to doc/Challenge(Event) Replies/EventFlexDetailsUpdatedValuesReceived.json diff --git a/doc/Device Replies/DeviceListInitialValuesReceived.json b/doc/Device Replies/DeviceListInitialValuesReceived.json new file mode 100644 index 0000000..e69de29 diff --git a/doc/ChallengeAdded.json b/doc/Old JSONs (pre 2025-26 season)/ChallengeAdded.json similarity index 100% rename from doc/ChallengeAdded.json rename to doc/Old JSONs (pre 2025-26 season)/ChallengeAdded.json diff --git a/doc/ChallengeConsumptionUpdatedValuesReceived.json b/doc/Old JSONs (pre 2025-26 season)/ChallengeConsumptionUpdatedValuesReceived.json similarity index 100% rename from doc/ChallengeConsumptionUpdatedValuesReceived.json rename to doc/Old JSONs (pre 2025-26 season)/ChallengeConsumptionUpdatedValuesReceived.json diff --git a/doc/ChallengeDetailsInitialValuesReceived.json b/doc/Old JSONs (pre 2025-26 season)/ChallengeDetailsInitialValuesReceived.json similarity index 100% rename from doc/ChallengeDetailsInitialValuesReceived.json rename to doc/Old JSONs (pre 2025-26 season)/ChallengeDetailsInitialValuesReceived.json diff --git a/doc/ChallengeListInitialValuesReceived.json b/doc/Old JSONs (pre 2025-26 season)/ChallengeListInitialValuesReceived.json similarity index 100% rename from doc/ChallengeListInitialValuesReceived.json rename to doc/Old JSONs (pre 2025-26 season)/ChallengeListInitialValuesReceived.json diff --git a/doc/ChallengeListUpdatedValuesReceived.json b/doc/Old JSONs (pre 2025-26 season)/ChallengeListUpdatedValuesReceived.json similarity index 100% rename from doc/ChallengeListUpdatedValuesReceived.json rename to doc/Old JSONs (pre 2025-26 season)/ChallengeListUpdatedValuesReceived.json diff --git a/doc/Readme.md b/doc/Readme.md new file mode 100644 index 0000000..4f7502d --- /dev/null +++ b/doc/Readme.md @@ -0,0 +1,105 @@ +# Using get_tokens.py +This python script will let you use it to log in to your Hilo account. + +From there, you will be asked to copy the full HA redirect(callback) URL and go back to your python script and press enter. + +Negotiation will take place and you will receive three distinct tokens: +- Your access token +- Your devicehub token +- Your challengehub token + +Take care not to share your tokens as they are not encrypted and contain personally identifiable information. + +1. Run get_tokens.py, you will be provided with a link. Either click it or copy it in your favourite browser. +image + +2. Login using your Hilo Credentials + + image + +3. Once you get to this page, select the URL and copy it to clipboard +image +image + +4. Go back to get_tokens.py and press enter, you'll get all 3 tokens: + +image + + +# Using Postman to send payloads to devicehub or challengehub +## Prerequisite: you need to have your tokens on hand, they are relatively short lived so once you have them, get to connecting! + +### DeviceHub + +1. Open up a new websocket connection and paste the DeviceHub URL +2. In Headers, add "Authorization". +3. In the Authorization field, type in "Bearer" then a space, and paste your DeviceHub token. + image +4. Go to the "Messages" tab and type in. Notice the control character at the end chr(30). It is required. + +``` +{ + "protocol": "json", + "version": 1 +} +``` +5. You can then invoke "SubscribeToLocation" to get your device informations. +``` +{ + "arguments": [ + 69420 + ], + "invocationId": "0", + "target": "SubscribeToLocation", + "type": 1 +} +``` +6. You should received the DeviceListInitialValuesReceived message back. + +### ChallengeHub + +1. Open up a new websocket connection and paste the DeviceHub URL +2. In Headers, add "Authorization". +3. In the Authorization field, type in "Bearer" then a space, and paste your DeviceHub token. + image +4. Go to the "Messages" tab and type in. Notice the control character at the end chr(30). It is required. + +``` +{ + "protocol": "json", + "version": 1 +} +``` +5. You can send various messages to the ChallengeHub to request different information. For the 2025-2026 season with the addition of Flex D, the messages were split between Winter Credit (Crédit Hivernal) and Flex D. Winter Credit messages will contain CH in their target, and Flex D event will contain Flex in their target. Each of rates has its own event id, for example, event 337 was for Winter Credits, and event 338 was for Flex D, both occured at the same time. You will have access to one, or the other, depending on your rate. + + +### Examples of various invokesto the ChallengeHub + +#### SubscribeToEventCH or SubscribeToEventFlex + +This invoke is used: +``` +{ + "arguments": [ + { + "locationHiloId": "urn:YOUR-URN", + "eventId": ID(numberic) + } + ], + "invocationId": "1", + "target": "SubscribeToEventCH", + "type": 1 +} +``` + +And should return +``` +EventCHDetailsInitialValuesReceived +```` +Or +``` +EventFlexDetailsInitialValuesReceived +``` + + +