Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2025 Jibril Sharafi
#pragma once
// AWS Configuration Storage Policy
// =================================
// All constants in this file are intentionally compile-time. They are fleet-wide infrastructure
// values that always require a coordinated change on both firmware and cloud side simultaneously.
// Storing them in NVS would add load/validate/fallback complexity with no practical benefit:
// any endpoint or topic migration requires an OTA anyway to ensure all devices switch atomically.
//
// The only device-specific cloud config is certificates, which are pre-loaded into the factory
// NVS partition at manufacturing (see docs/plans/2026-03-09-aws-config-storage-policy.md).
//
// To change the endpoint or rules: update here and deploy an OTA.
// Connection
#ifdef ENV_DEV
constexpr const char* AWS_IOT_CORE_ENDPOINT = "a19ey2oqxgfcyh-ats.iot.eu-west-1.amazonaws.com";
#else
constexpr const char* AWS_IOT_CORE_ENDPOINT = "a26zjeqaj9a3xc-ats.iot.eu-west-1.amazonaws.com";
#endif
#define AWS_IOT_CORE_PORT 8883
// IoT Core Basic Ingest rule names - routes messages server-side, enabling cheaper MQTT ingestion.
// Basic Ingest ($aws/rules/<name>/...) requires a rule of that exact name to exist server-side,
// per product line: one set for Home, one for Home Pro (see MQTT_TOPIC_2_HOMEPRO below).
#ifdef ENV_DEV
constexpr const char* AWS_IOT_CORE_RULE_METER_HOME = "energyme_home_dev_rule_meter";
constexpr const char* AWS_IOT_CORE_RULE_LOG_HOME = "energyme_home_dev_rule_log";
constexpr const char* AWS_IOT_CORE_RULE_GRID_HOME = "energyme_home_dev_rule_grid";
constexpr const char* AWS_IOT_CORE_RULE_ENERGY_HOME = "energyme_home_dev_rule_energy";
constexpr const char* AWS_IOT_CORE_RULE_ALARM_HOME = "energyme_home_dev_rule_alarm";
constexpr const char* AWS_IOT_CORE_RULE_METER_HOMEPRO = "energyme_homepro_dev_rule_meter";
constexpr const char* AWS_IOT_CORE_RULE_LOG_HOMEPRO = "energyme_homepro_dev_rule_log";
constexpr const char* AWS_IOT_CORE_RULE_GRID_HOMEPRO = "energyme_homepro_dev_rule_grid";
constexpr const char* AWS_IOT_CORE_RULE_ENERGY_HOMEPRO = "energyme_homepro_dev_rule_energy";
constexpr const char* AWS_IOT_CORE_RULE_ALARM_HOMEPRO = "energyme_homepro_dev_rule_alarm";
#else
constexpr const char* AWS_IOT_CORE_RULE_METER_HOME = "energyme_home_prod_rule_meter";
constexpr const char* AWS_IOT_CORE_RULE_LOG_HOME = "energyme_home_prod_rule_log";
constexpr const char* AWS_IOT_CORE_RULE_GRID_HOME = "energyme_home_prod_rule_grid";
constexpr const char* AWS_IOT_CORE_RULE_ENERGY_HOME = "energyme_home_prod_rule_energy";
constexpr const char* AWS_IOT_CORE_RULE_ALARM_HOME = "energyme_home_prod_rule_alarm";
constexpr const char* AWS_IOT_CORE_RULE_METER_HOMEPRO = "energyme_homepro_prod_rule_meter";
constexpr const char* AWS_IOT_CORE_RULE_LOG_HOMEPRO = "energyme_homepro_prod_rule_log";
constexpr const char* AWS_IOT_CORE_RULE_GRID_HOMEPRO = "energyme_homepro_prod_rule_grid";
constexpr const char* AWS_IOT_CORE_RULE_ENERGY_HOMEPRO = "energyme_homepro_prod_rule_energy";
constexpr const char* AWS_IOT_CORE_RULE_ALARM_HOMEPRO = "energyme_homepro_prod_rule_alarm";
#endif
// AWS reserved topic prefixes
#define AWS_TOPIC "$aws"
#define MQTT_BASIC_INGEST AWS_TOPIC "/rules"
#define MQTT_THINGS AWS_TOPIC "/things"
// EnergyMe-Home topic namespace (fleet-wide; change requires OTA + cloud-side update).
// Home Pro gets its own namespace segment, picked at runtime from globalHwProfile->product
// (see Mqtt::_topicProductSegment / _selectByProduct in mqtt.cpp) - not compile-time, since
// product is a factory-NVS value, not a build flag.
#define MQTT_TOPIC_1 "energyme"
#define MQTT_TOPIC_2_HOME "home"
#define MQTT_TOPIC_2_HOMEPRO "homepro"
#define MQTT_TOPIC_VERSION "v1"
// Amazon Root CA 1 - can be public
// https://www.amazontrust.com/repository/AmazonRootCA1.pem
constexpr const char* AWS_IOT_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tMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU\n"
"5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy\n"
"rqXRfboQnoZsG4q5WTP468SQvvG5\n"
"-----END CERTIFICATE-----\n";
f4329a85eThis file is pinned to the selected release. Download the original to open it in your design tool.