Skip to content

Commit

Permalink
Merge pull request #2249 from MichaelDvP/dev
Browse files Browse the repository at this point in the history
Fix custom entity factor validator and add entities for #1996
  • Loading branch information
proddy authored Nov 25, 2024
2 parents c59657a + eeef5a8 commit 89ccaf1
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
4 changes: 2 additions & 2 deletions interface/src/app/main/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ export const entityItemValidation = (entity: EntityItem[], entityItem: EntityIte
{ type: 'number', min: 0, max: 255, message: 'Must be between 0 and 255' }
],
factor: [
{ required: true, message: 'Bytes is required' },
{ type: 'number', min: 1, max: 255, message: 'Must be between 1 and 255' }
{ required: true, message: 'is required' },
{ type: 'number', message: 'Must be a number' }
]
});

Expand Down
29 changes: 29 additions & 0 deletions src/devices/heatpump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Heatpump::Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, c
register_telegram_type(0x4AE, "HPEnergy", true, MAKE_PF_CB(process_HpEnergy));
register_telegram_type(0x4AF, "HPMeters", true, MAKE_PF_CB(process_HpMeters));
register_telegram_type(0x99A, "HPStarts", false, MAKE_PF_CB(process_HpStarts));
register_telegram_type(0x12E, "HPEnergy1", false, MAKE_PF_CB(process_HpEnergy1));
register_telegram_type(0x13B, "HPEnergy2", false, MAKE_PF_CB(process_HpEnergy2));

// device values
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &airHumidity_, DeviceValueType::UINT8, FL_(airHumidity), DeviceValueUOM::PERCENT);
Expand Down Expand Up @@ -180,6 +182,18 @@ Heatpump::Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, c
register_device_value(DeviceValueTAG::TAG_DHW1, &meterWw_, DeviceValueType::UINT24, DeviceValueNumOp::DV_NUMOP_DIV100, FL_(meterWw), DeviceValueUOM::KWH);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &heatStartsHp_, DeviceValueType::UINT24, FL_(heatingStarts), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DHW1, &wwStartsHp_, DeviceValueType::UINT24, FL_(wwStartsHp), DeviceValueUOM::NONE);

register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &fuelHeat_, DeviceValueType::UINT32, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(fuelHeat), DeviceValueUOM::KWH);
register_device_value(DeviceValueTAG::TAG_DHW1, &elDhw_, DeviceValueType::UINT32, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(fuelDhw), DeviceValueUOM::KWH);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &fuelHeat_, DeviceValueType::UINT32, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(elHeat), DeviceValueUOM::KWH);
register_device_value(DeviceValueTAG::TAG_DHW1, &elDhw_, DeviceValueType::UINT32, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(elDhw), DeviceValueUOM::KWH);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&elGenHeat_,
DeviceValueType::UINT32,
DeviceValueNumOp::DV_NUMOP_DIV10,
FL_(elGenHeat),
DeviceValueUOM::KWH);
register_device_value(DeviceValueTAG::TAG_DHW1, &elGenDhw_, DeviceValueType::UINT32, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(elGenDhw), DeviceValueUOM::KWH);
}

/*
Expand Down Expand Up @@ -280,6 +294,21 @@ void Heatpump::process_HpStarts(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, wwStartsHp_, 14, 3);
}

// 0x0112E energy consumption
void Heatpump::process_HpEnergy1(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, fuelHeat_, 3);
has_update(telegram, fuelDhw_, 7);
has_update(telegram, elHeat_, 11);
has_update(telegram, elDhw_, 15);
}

// 0x013B energy generated
void Heatpump::process_HpEnergy2(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, elGenHeat_, 3);
has_update(telegram, elGenDhw_, 7);
}


/*
* Broadcast (0x099A), data: 05 00 00 00 00 00 00 37 00 00 1D 00 00 52 00 00 13 01 00 01 7C
* Broadcast (0x099B), data: 80 00 80 00 01 3C 01 38 80 00 80 00 80 00 01 37 00 00 00 00 64
Expand Down
8 changes: 8 additions & 0 deletions src/devices/heatpump.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ class Heatpump : public EMSdevice {

uint32_t heatStartsHp_;
uint32_t wwStartsHp_;
uint32_t fuelHeat_;
uint32_t fuelDhw_;
uint32_t elHeat_;
uint32_t elDhw_;
uint32_t elGenHeat_;
uint32_t elGenDhw_;

void process_HPMonitor1(std::shared_ptr<const Telegram> telegram);
void process_HPMonitor2(std::shared_ptr<const Telegram> telegram);
Expand All @@ -89,6 +95,8 @@ class Heatpump : public EMSdevice {
void process_HpEnergy(std::shared_ptr<const Telegram> telegram);
void process_HpMeters(std::shared_ptr<const Telegram> telegram);
void process_HpStarts(std::shared_ptr<const Telegram> telegram);
void process_HpEnergy1(std::shared_ptr<const Telegram> telegram);
void process_HpEnergy2(std::shared_ptr<const Telegram> telegram);

bool set_controlStrategy(const char * value, const int8_t id);
bool set_lowNoiseMode(const char * value, const int8_t id);
Expand Down
6 changes: 6 additions & 0 deletions src/locale_translations.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,12 @@ MAKE_TRANSLATION(gasMeterWw, "gasmeter", "gas meter", "Gaszähler", "", "", "lic
MAKE_TRANSLATION(hpCurrPower, "hpcurrpower", "compressor current power", "akt. Kompressorleistung", "", "", "", "", "", "", "", "aktuálny výkon kompresoru", "aktuální výkon kompresoru") // TODO translate
MAKE_TRANSLATION(hpPowerLimit, "hppowerlimit", "power limit", "Leistungsgrenze", "", "", "", "", "", "", "", "obmedzenie výkonu", "omezení výkonu") // TODO translate
MAKE_TRANSLATION(powerReduction, "powerreduction", "power reduction", "Leistungsverringerung", "", "", "", "", "", "", "", "obmedzenie výkonu", "omezení výkonu") // TODO translate
MAKE_TRANSLATION(fuelHeat, "fuelheat", "fuel consuption heating", "Verbrauch Heizen", "", "", "", "", "", "", "", "obmedzenie výkonu", "omezení výkonu") // TODO translate
MAKE_TRANSLATION(fuelDhw, "fueldhw", "fuel consuption", "Verbrauch", "", "", "", "", "", "", "", "", "") // TODO translate
MAKE_TRANSLATION(elHeat, "elheat", "el. consuption heating", "el. Verbrauch Heizen", "", "", "", "", "", "", "", "", "") // TODO translate
MAKE_TRANSLATION(elDhw, "eldhw", "el consuption", "el. Verbrauch", "", "", "", "", "", "", "", "", "") // TODO translate
MAKE_TRANSLATION(elGenHeat, "elgenheat", "el. generation heating", "el. Erzeugung Heizen", "", "", "", "", "", "", "", "", "") // TODO translate
MAKE_TRANSLATION(elGenDhw, "elgendhw", "el generation", "el. Erzeugung", "", "", "", "", "", "", "", "", "") // TODO translate

// HIU
MAKE_TRANSLATION(netFlowTemp, "netflowtemp", "heat network flow temp", "Systemvorlauftemperatur", "Netto aanvoertemperatuur", "", "temp. zasilania sieci cieplnej", "", "", "ısıtma şebekesi akış derecesi", "temperatura di mandata della rete di riscaldamento", "teplota prívodu tepelnej siete", "teplota přívodu tepelné sítě") // TODO translate
Expand Down

0 comments on commit 89ccaf1

Please sign in to comment.