HW button bar in all pages

Partially solves #1835
Partially solves #1517
Solves #1507
This commit is contained in:
Edward Firmo
2024-02-26 18:36:12 +01:00
parent 692e145162
commit 16e9b899d6
30 changed files with 1523 additions and 496 deletions

View File

@@ -18,17 +18,17 @@ namespace nspanel_ha_blueprint {
* @return A HomeAssistantEntity struct containing the extracted domain and the unique ID.
*/
HomeAssistantEntity extractHomeAssistantEntity(const std::string& entity_id) {
size_t dotPos = input.find(".");
size_t dotPos = entity_id.find(".");
HomeAssistantEntity result;
if (dotPos != std::string::npos) {
// Extract domain and id from the input string
result.domain = input.substr(0, dotPos);
result.id = input.substr(dotPos + 1);
// Extract domain and id from the entity_id string
result.domain = entity_id.substr(0, dotPos);
result.id = entity_id.substr(dotPos + 1);
} else {
// No dot found, the entire input is considered as id.
// No dot found, the entire entity_id is considered as id.
result.domain = "invalid";
result.id = input;
result.id = entity_id;
}
return result;
}

View File

@@ -61,7 +61,8 @@ namespace nspanel_ha_blueprint {
// Bits 6 and 7 are reserved for future expansion.
};
void update_bitwise_setting(uint8_t& settings, bool condition, RelaySettings flag) {
template<typename SettingsEnum>
void update_bitwise_setting(uint8_t& settings, bool condition, SettingsEnum flag) {
if (condition) {
settings |= flag; // Set bit
} else {