diff --git a/Examples/README.md b/Examples/README.md deleted file mode 100644 index ebca193..0000000 --- a/Examples/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Example configs - -Here I want to collect different samples for different kind of meters and different countries diff --git a/Examples/dutch-dsmr-2.2.yaml b/Examples/dutch-dsmr-2.2.yaml deleted file mode 100644 index 24b3d19..0000000 --- a/Examples/dutch-dsmr-2.2.yaml +++ /dev/null @@ -1,127 +0,0 @@ ---- -substitutions: - device_name: slimmelezer - device_description: "DIY P1 module to read your smart meter" - -esphome: - name: ${device_name} - comment: "${device_description}" - platform: ESP8266 - esp8266_restore_from_flash: true - board: d1_mini - name_add_mac_suffix: false - project: - name: zuidwijk.slimmelezer - version: "1.0" - -wifi: - networks: - - ssid: "JouwSSID" - password: "JouwWiFiWachtwoord" - - # Enable fallback hotspot (captive portal) in case wifi connection fails - ap: - ssid: ${device_name} - ap_timeout: 15s - -captive_portal: - -# Enable logging -logger: - baud_rate: 0 - -# Enable Home Assistant API -api: - -ota: - -web_server: - port: 80 - -uart: - rx_pin: D7 - baud_rate: 9600 - data_bits: 7 - parity: EVEN - stop_bits: 1 - -dsmr: - gas_mbus_id: 1 - crc_check: false - -sensor: - - platform: dsmr - energy_delivered_tariff1: - name: "Energy Consumed Tariff 1" - energy_delivered_tariff2: - name: "Energy Consumed Tariff 2" - energy_returned_tariff1: - name: "Energy Produced Tariff 1" - energy_returned_tariff2: - name: "Energy Produced Tariff 2" - power_delivered: - name: "Power Consumed" - accuracy_decimals: 3 - power_returned: - name: "Power Produced" - accuracy_decimals: 3 - electricity_failures: - name: "Electricity Failures" - icon: mdi:alert - electricity_long_failures: - name: "Long Electricity Failures" - icon: mdi:alert - voltage_l1: - name: "Voltage Phase 1" - voltage_l2: - name: "Voltage Phase 2" - voltage_l3: - name: "Voltage Phase 3" - current_l1: - name: "Current Phase 1" - current_l2: - name: "Current Phase 2" - current_l3: - name: "Current Phase 3" - power_delivered_l1: - name: "Power Consumed Phase 1" - accuracy_decimals: 3 - power_delivered_l2: - name: "Power Consumed Phase 2" - accuracy_decimals: 3 - power_delivered_l3: - name: "Power Consumed Phase 3" - accuracy_decimals: 3 - power_returned_l1: - name: "Power Produced Phase 1" - accuracy_decimals: 3 - power_returned_l2: - name: "Power Produced Phase 2" - accuracy_decimals: 3 - power_returned_l3: - name: "Power Produced Phase 3" - accuracy_decimals: 3 - gas_delivered: - name: "Gas Consumed" - - platform: uptime - name: "SlimmeLezer Uptime" - - platform: wifi_signal - name: "SlimmeLezer Wi-Fi Signal" - update_interval: 60s - -text_sensor: - - platform: dsmr - identification: - name: "DSMR Identification" - p1_version: - name: "DSMR Version" - - platform: wifi_info - ip_address: - name: "SlimmeLezer IP Address" - ssid: - name: "SlimmeLezer Wi-Fi SSID" - bssid: - name: "SlimmeLezer Wi-Fi BSSID" - - platform: version - name: "ESPHome Version" - hide_timestamp: true diff --git a/Examples/dutch-dsmr-4-and-5.yaml b/Examples/dutch-dsmr-4-and-5.yaml deleted file mode 100644 index d6f4eb2..0000000 --- a/Examples/dutch-dsmr-4-and-5.yaml +++ /dev/null @@ -1,122 +0,0 @@ -substitutions: - device_name: slimmelezer - device_description: "DIY P1 module to read your smart meter" - -esphome: - name: ${device_name} - comment: "${device_description}" - platform: ESP8266 - esp8266_restore_from_flash: true - board: d1_mini - name_add_mac_suffix: false - project: - name: zuidwijk.slimmelezer - version: "2.0" - -wifi: - networks: - - ssid: "JouwSSID" - password: "JouwWiFiWachtwoord" - - # Enable fallback hotspot (captive portal) in case wifi connection fails - ap: - ssid: ${device_name} - -captive_portal: - -# Enable logging -logger: - baud_rate: 0 - -# Enable Home Assistant API -api: - -ota: - -web_server: - port: 80 - -uart: - baud_rate: 115200 - rx_pin: D7 - rx_buffer_size: 1700 - -dsmr: - max_telegram_length: 1700 - -sensor: - - platform: dsmr - energy_delivered_tariff1: - name: "Energy Consumed Tariff 1" - energy_delivered_tariff2: - name: "Energy Consumed Tariff 2" - energy_returned_tariff1: - name: "Energy Produced Tariff 1" - energy_returned_tariff2: - name: "Energy Produced Tariff 2" - power_delivered: - name: "Power Consumed" - accuracy_decimals: 3 - power_returned: - name: "Power Produced" - accuracy_decimals: 3 - electricity_failures: - name: "Electricity Failures" - icon: mdi:alert - electricity_long_failures: - name: "Long Electricity Failures" - icon: mdi:alert - voltage_l1: - name: "Voltage Phase 1" - voltage_l2: - name: "Voltage Phase 2" - voltage_l3: - name: "Voltage Phase 3" - current_l1: - name: "Current Phase 1" - current_l2: - name: "Current Phase 2" - current_l3: - name: "Current Phase 3" - power_delivered_l1: - name: "Power Consumed Phase 1" - accuracy_decimals: 3 - power_delivered_l2: - name: "Power Consumed Phase 2" - accuracy_decimals: 3 - power_delivered_l3: - name: "Power Consumed Phase 3" - accuracy_decimals: 3 - power_returned_l1: - name: "Power Produced Phase 1" - accuracy_decimals: 3 - power_returned_l2: - name: "Power Produced Phase 2" - accuracy_decimals: 3 - power_returned_l3: - name: "Power Produced Phase 3" - accuracy_decimals: 3 - gas_delivered: - name: "Gas Consumed" - - platform: uptime - name: "SlimmeLezer Uptime" - - platform: wifi_signal - name: "SlimmeLezer Wi-Fi Signal" - update_interval: 60s - -text_sensor: - - platform: dsmr - identification: - name: "DSMR Identification" - p1_version: - name: "DSMR Version" - - platform: wifi_info - ip_address: - name: "SlimmeLezer IP Address" - ssid: - name: "SlimmeLezer Wi-Fi SSID" - bssid: - name: "SlimmeLezer Wi-Fi BSSID" - - platform: version - name: "ESPHome Version" - hide_timestamp: false diff --git a/components/dsmr/fields.cpp b/components/dsmr/fields.cpp index 645c9a4..7a293cf 100644 --- a/components/dsmr/fields.cpp +++ b/components/dsmr/fields.cpp @@ -52,283 +52,328 @@ constexpr char units::GJ[]; constexpr char units::MJ[]; constexpr char units::kvar[]; constexpr char units::kvarh[]; +constexpr char units::Hz[]; constexpr ObisId identification::id; -constexpr char identification::name_progmem[]; -constexpr const __FlashStringHelper *identification::name; +constexpr char identification::name[]; constexpr ObisId p1_version::id; -constexpr char p1_version::name_progmem[]; -constexpr const __FlashStringHelper *p1_version::name; +constexpr char p1_version::name[]; /* extra field for Belgium */ constexpr ObisId p1_version_be::id; -constexpr char p1_version_be::name_progmem[]; -constexpr const __FlashStringHelper *p1_version_be::name; +constexpr char p1_version_be::name[]; constexpr ObisId timestamp::id; -constexpr char timestamp::name_progmem[]; -constexpr const __FlashStringHelper *timestamp::name; +constexpr char timestamp::name[]; constexpr ObisId equipment_id::id; -constexpr char equipment_id::name_progmem[]; -constexpr const __FlashStringHelper *equipment_id::name; +constexpr char equipment_id::name[]; -/* extra for Lux */ -constexpr ObisId energy_delivered_lux::id; -constexpr char energy_delivered_lux::name_progmem[]; -constexpr const __FlashStringHelper *energy_delivered_lux::name; +constexpr ObisId energy_delivered::id; +constexpr char energy_delivered::name[]; constexpr ObisId energy_delivered_tariff1::id; -constexpr char energy_delivered_tariff1::name_progmem[]; -constexpr const __FlashStringHelper *energy_delivered_tariff1::name; +constexpr char energy_delivered_tariff1::name[]; constexpr ObisId energy_delivered_tariff2::id; -constexpr char energy_delivered_tariff2::name_progmem[]; -constexpr const __FlashStringHelper *energy_delivered_tariff2::name; +constexpr char energy_delivered_tariff2::name[]; -/* extra for Lux */ -constexpr ObisId energy_returned_lux::id; -constexpr char energy_returned_lux::name_progmem[]; -constexpr const __FlashStringHelper *energy_returned_lux::name; +constexpr ObisId energy_delivered_tariff3::id; +constexpr char energy_delivered_tariff3::name[]; + +constexpr ObisId energy_delivered_tariff4::id; +constexpr char energy_delivered_tariff4::name[]; + +constexpr ObisId energy_returned::id; +constexpr char energy_returned::name[]; constexpr ObisId energy_returned_tariff1::id; -constexpr char energy_returned_tariff1::name_progmem[]; -constexpr const __FlashStringHelper *energy_returned_tariff1::name; +constexpr char energy_returned_tariff1::name[]; constexpr ObisId energy_returned_tariff2::id; -constexpr char energy_returned_tariff2::name_progmem[]; -constexpr const __FlashStringHelper *energy_returned_tariff2::name; +constexpr char energy_returned_tariff2::name[]; -/* extra for Lux */ -constexpr ObisId total_imported_energy::id; -constexpr char total_imported_energy::name_progmem[]; -constexpr const __FlashStringHelper *total_imported_energy::name; +constexpr ObisId energy_returned_tariff3::id; +constexpr char energy_returned_tariff3::name[]; -/* extra for Lux */ -constexpr ObisId total_exported_energy::id; -constexpr char total_exported_energy::name_progmem[]; -constexpr const __FlashStringHelper *total_exported_energy::name; +constexpr ObisId energy_returned_tariff4::id; +constexpr char energy_returned_tariff4::name[]; + +constexpr ObisId energy_absolute::id; +constexpr char energy_absolute::name[]; + +constexpr ObisId energy_absolute_tariff1::id; +constexpr char energy_absolute_tariff1::name[]; + +constexpr ObisId energy_absolute_tariff2::id; +constexpr char energy_absolute_tariff2::name[]; + +constexpr ObisId energy_absolute_tariff3::id; +constexpr char energy_absolute_tariff3::name[]; + +constexpr ObisId energy_absolute_tariff4::id; +constexpr char energy_absolute_tariff4::name[]; + +constexpr ObisId energy_sumwoblockade::id; +constexpr char energy_sumwoblockade::name[]; + +constexpr ObisId energy_sumwoblockade_tariff1::id; +constexpr char energy_sumwoblockade_tariff1::name[]; + +constexpr ObisId energy_sumwoblockade_tariff2::id; +constexpr char energy_sumwoblockade_tariff2::name[]; + +constexpr ObisId energy_sumwoblockade_tariff3::id; +constexpr char energy_sumwoblockade_tariff3::name[]; + +constexpr ObisId energy_sumwoblockade_tariff4::id; +constexpr char energy_sumwoblockade_tariff4::name[]; + +//constexpr ObisId energy_positive_reactive::id; +//constexpr char energy_positive_reactive::name[]; + +constexpr ObisId energy_positive_reactive_tariff1::id; +constexpr char energy_positive_reactive_tariff1::name[]; + +constexpr ObisId energy_positive_reactive_tariff2::id; +constexpr char energy_positive_reactive_tariff2::name[]; + +constexpr ObisId energy_positive_reactive_tariff3::id; +constexpr char energy_positive_reactive_tariff3::name[]; + +constexpr ObisId energy_positive_reactive_tariff4::id; +constexpr char energy_positive_reactive_tariff4::name[]; + +constexpr ObisId energy_negative_reactive::id; +constexpr char energy_negative_reactive::name[]; + +constexpr ObisId energy_negative_reactive_tariff1::id; +constexpr char energy_negative_reactive_tariff1::name[]; + +constexpr ObisId energy_negative_reactive_tariff2::id; +constexpr char energy_negative_reactive_tariff2::name[]; + +constexpr ObisId energy_negative_reactive_tariff3::id; +constexpr char energy_negative_reactive_tariff3::name[]; + +constexpr ObisId energy_negative_reactive_tariff4::id; +constexpr char energy_negative_reactive_tariff4::name[]; /* extra for Lux */ constexpr ObisId reactive_power_delivered::id; -constexpr char reactive_power_delivered::name_progmem[]; -constexpr const __FlashStringHelper *reactive_power_delivered::name; +constexpr char reactive_power_delivered::name[]; /* extra for Lux */ constexpr ObisId reactive_power_returned::id; -constexpr char reactive_power_returned::name_progmem[]; -constexpr const __FlashStringHelper *reactive_power_returned::name; +constexpr char reactive_power_returned::name[]; constexpr ObisId electricity_tariff::id; -constexpr char electricity_tariff::name_progmem[]; -constexpr const __FlashStringHelper *electricity_tariff::name; +constexpr char electricity_tariff::name[]; + +constexpr ObisId breaker_status::id; +constexpr char breaker_status::name[]; constexpr ObisId power_delivered::id; -constexpr char power_delivered::name_progmem[]; -constexpr const __FlashStringHelper *power_delivered::name; +constexpr char power_delivered::name[]; constexpr ObisId power_returned::id; -constexpr char power_returned::name_progmem[]; -constexpr const __FlashStringHelper *power_returned::name; +constexpr char power_returned::name[]; + +// constexpr ObisId absolute_active_energy::id; +// constexpr char absolute_active_energy::name[]; constexpr ObisId electricity_threshold::id; -constexpr char electricity_threshold::name_progmem[]; -constexpr const __FlashStringHelper *electricity_threshold::name; +constexpr char electricity_threshold::name[]; constexpr ObisId electricity_switch_position::id; -constexpr char electricity_switch_position::name_progmem[]; -constexpr const __FlashStringHelper *electricity_switch_position::name; +constexpr char electricity_switch_position::name[]; constexpr ObisId electricity_failures::id; -constexpr char electricity_failures::name_progmem[]; -constexpr const __FlashStringHelper *electricity_failures::name; +constexpr char electricity_failures::name[]; constexpr ObisId electricity_long_failures::id; -constexpr char electricity_long_failures::name_progmem[]; -constexpr const __FlashStringHelper *electricity_long_failures::name; +constexpr char electricity_long_failures::name[]; constexpr ObisId electricity_failure_log::id; -constexpr char electricity_failure_log::name_progmem[]; -constexpr const __FlashStringHelper *electricity_failure_log::name; +constexpr char electricity_failure_log::name[]; constexpr ObisId electricity_sags_l1::id; -constexpr char electricity_sags_l1::name_progmem[]; -constexpr const __FlashStringHelper *electricity_sags_l1::name; +constexpr char electricity_sags_l1::name[]; constexpr ObisId electricity_sags_l2::id; -constexpr char electricity_sags_l2::name_progmem[]; -constexpr const __FlashStringHelper *electricity_sags_l2::name; +constexpr char electricity_sags_l2::name[]; constexpr ObisId electricity_sags_l3::id; -constexpr char electricity_sags_l3::name_progmem[]; -constexpr const __FlashStringHelper *electricity_sags_l3::name; +constexpr char electricity_sags_l3::name[]; constexpr ObisId electricity_swells_l1::id; -constexpr char electricity_swells_l1::name_progmem[]; -constexpr const __FlashStringHelper *electricity_swells_l1::name; +constexpr char electricity_swells_l1::name[]; constexpr ObisId electricity_swells_l2::id; -constexpr char electricity_swells_l2::name_progmem[]; -constexpr const __FlashStringHelper *electricity_swells_l2::name; +constexpr char electricity_swells_l2::name[]; constexpr ObisId electricity_swells_l3::id; -constexpr char electricity_swells_l3::name_progmem[]; -constexpr const __FlashStringHelper *electricity_swells_l3::name; +constexpr char electricity_swells_l3::name[]; constexpr ObisId message_short::id; -constexpr char message_short::name_progmem[]; -constexpr const __FlashStringHelper *message_short::name; +constexpr char message_short::name[]; constexpr ObisId message_long::id; -constexpr char message_long::name_progmem[]; -constexpr const __FlashStringHelper *message_long::name; +constexpr char message_long::name[]; constexpr ObisId voltage_l1::id; -constexpr char voltage_l1::name_progmem[]; -constexpr const __FlashStringHelper *voltage_l1::name; +constexpr char voltage_l1::name[]; constexpr ObisId voltage_l2::id; -constexpr char voltage_l2::name_progmem[]; -constexpr const __FlashStringHelper *voltage_l2::name; +constexpr char voltage_l2::name[]; constexpr ObisId voltage_l3::id; -constexpr char voltage_l3::name_progmem[]; -constexpr const __FlashStringHelper *voltage_l3::name; +constexpr char voltage_l3::name[]; constexpr ObisId current_l1::id; -constexpr char current_l1::name_progmem[]; -constexpr const __FlashStringHelper *current_l1::name; +constexpr char current_l1::name[]; constexpr ObisId current_l2::id; -constexpr char current_l2::name_progmem[]; -constexpr const __FlashStringHelper *current_l2::name; +constexpr char current_l2::name[]; constexpr ObisId current_l3::id; -constexpr char current_l3::name_progmem[]; -constexpr const __FlashStringHelper *current_l3::name; +constexpr char current_l3::name[]; constexpr ObisId power_delivered_l1::id; -constexpr char power_delivered_l1::name_progmem[]; -constexpr const __FlashStringHelper *power_delivered_l1::name; +constexpr char power_delivered_l1::name[]; constexpr ObisId power_delivered_l2::id; -constexpr char power_delivered_l2::name_progmem[]; -constexpr const __FlashStringHelper *power_delivered_l2::name; +constexpr char power_delivered_l2::name[]; constexpr ObisId power_delivered_l3::id; -constexpr char power_delivered_l3::name_progmem[]; -constexpr const __FlashStringHelper *power_delivered_l3::name; +constexpr char power_delivered_l3::name[]; constexpr ObisId power_returned_l1::id; -constexpr char power_returned_l1::name_progmem[]; -constexpr const __FlashStringHelper *power_returned_l1::name; +constexpr char power_returned_l1::name[]; constexpr ObisId power_returned_l2::id; -constexpr char power_returned_l2::name_progmem[]; -constexpr const __FlashStringHelper *power_returned_l2::name; +constexpr char power_returned_l2::name[]; constexpr ObisId power_returned_l3::id; -constexpr char power_returned_l3::name_progmem[]; -constexpr const __FlashStringHelper *power_returned_l3::name; +constexpr char power_returned_l3::name[]; + +constexpr ObisId reactive_power_qi::id; +constexpr char reactive_power_qi::name[]; + +constexpr ObisId reactive_power_qii::id; +constexpr char reactive_power_qii::name[]; + +constexpr ObisId reactive_power_qiii::id; +constexpr char reactive_power_qiii::name[]; + +constexpr ObisId reactive_power_qiv::id; +constexpr char reactive_power_qiv::name[]; + +constexpr ObisId reactive_energy_qi::id; +constexpr char reactive_energy_qi::name[]; + +constexpr ObisId reactive_energy_qii::id; +constexpr char reactive_energy_qii::name[]; + +constexpr ObisId reactive_energy_qiii::id; +constexpr char reactive_energy_qiii::name[]; + +constexpr ObisId reactive_energy_qiv::id; +constexpr char reactive_energy_qiv::name[]; + +constexpr ObisId instantaneous_power_factor::id; +constexpr char instantaneous_power_factor::name[]; + +constexpr ObisId instantaneous_power_factor_l1::id; +constexpr char instantaneous_power_factor_l1::name[]; + +constexpr ObisId instantaneous_power_factor_l2::id; +constexpr char instantaneous_power_factor_l2::name[]; + +constexpr ObisId instantaneous_power_factor_l3::id; +constexpr char instantaneous_power_factor_l3::name[]; + +constexpr ObisId frequency::id; +constexpr char frequency::name[]; + /* LUX */ constexpr ObisId reactive_power_delivered_l1::id; -constexpr char reactive_power_delivered_l1::name_progmem[]; -constexpr const __FlashStringHelper *reactive_power_delivered_l1::name; +constexpr char reactive_power_delivered_l1::name[]; /* LUX */ constexpr ObisId reactive_power_delivered_l2::id; -constexpr char reactive_power_delivered_l2::name_progmem[]; -constexpr const __FlashStringHelper *reactive_power_delivered_l2::name; +constexpr char reactive_power_delivered_l2::name[]; /* LUX */ constexpr ObisId reactive_power_delivered_l3::id; -constexpr char reactive_power_delivered_l3::name_progmem[]; -constexpr const __FlashStringHelper *reactive_power_delivered_l3::name; +constexpr char reactive_power_delivered_l3::name[]; /* LUX */ constexpr ObisId reactive_power_returned_l1::id; -constexpr char reactive_power_returned_l1::name_progmem[]; -constexpr const __FlashStringHelper *reactive_power_returned_l1::name; +constexpr char reactive_power_returned_l1::name[]; /* LUX */ constexpr ObisId reactive_power_returned_l2::id; -constexpr char reactive_power_returned_l2::name_progmem[]; -constexpr const __FlashStringHelper *reactive_power_returned_l2::name; +constexpr char reactive_power_returned_l2::name[]; /* LUX */ constexpr ObisId reactive_power_returned_l3::id; -constexpr char reactive_power_returned_l3::name_progmem[]; -constexpr const __FlashStringHelper *reactive_power_returned_l3::name; +constexpr char reactive_power_returned_l3::name[]; constexpr ObisId gas_device_type::id; -constexpr char gas_device_type::name_progmem[]; -constexpr const __FlashStringHelper *gas_device_type::name; +constexpr char gas_device_type::name[]; constexpr ObisId gas_equipment_id::id; -constexpr char gas_equipment_id::name_progmem[]; -constexpr const __FlashStringHelper *gas_equipment_id::name; +constexpr char gas_equipment_id::name[]; constexpr ObisId gas_valve_position::id; -constexpr char gas_valve_position::name_progmem[]; -constexpr const __FlashStringHelper *gas_valve_position::name; +constexpr char gas_valve_position::name[]; /* _NL */ constexpr ObisId gas_delivered::id; -constexpr char gas_delivered::name_progmem[]; -constexpr const __FlashStringHelper *gas_delivered::name; +constexpr char gas_delivered::name[]; /* _BE */ constexpr ObisId gas_delivered_be::id; -constexpr char gas_delivered_be::name_progmem[]; -constexpr const __FlashStringHelper *gas_delivered_be::name; +constexpr char gas_delivered_be::name[]; + +constexpr ObisId gas_delivered_text::id; +constexpr char gas_delivered_text::name[]; constexpr ObisId thermal_device_type::id; -constexpr char thermal_device_type::name_progmem[]; -constexpr const __FlashStringHelper *thermal_device_type::name; +constexpr char thermal_device_type::name[]; constexpr ObisId thermal_equipment_id::id; -constexpr char thermal_equipment_id::name_progmem[]; -constexpr const __FlashStringHelper *thermal_equipment_id::name; +constexpr char thermal_equipment_id::name[]; constexpr ObisId thermal_valve_position::id; -constexpr char thermal_valve_position::name_progmem[]; -constexpr const __FlashStringHelper *thermal_valve_position::name; +constexpr char thermal_valve_position::name[]; constexpr ObisId thermal_delivered::id; -constexpr char thermal_delivered::name_progmem[]; -constexpr const __FlashStringHelper *thermal_delivered::name; +constexpr char thermal_delivered::name[]; constexpr ObisId water_device_type::id; -constexpr char water_device_type::name_progmem[]; -constexpr const __FlashStringHelper *water_device_type::name; +constexpr char water_device_type::name[]; constexpr ObisId water_equipment_id::id; -constexpr char water_equipment_id::name_progmem[]; -constexpr const __FlashStringHelper *water_equipment_id::name; +constexpr char water_equipment_id::name[]; constexpr ObisId water_valve_position::id; -constexpr char water_valve_position::name_progmem[]; -constexpr const __FlashStringHelper *water_valve_position::name; +constexpr char water_valve_position::name[]; constexpr ObisId water_delivered::id; -constexpr char water_delivered::name_progmem[]; -constexpr const __FlashStringHelper *water_delivered::name; - -constexpr ObisId slave_device_type::id; -constexpr char slave_device_type::name_progmem[]; -constexpr const __FlashStringHelper *slave_device_type::name; +constexpr char water_delivered::name[]; -constexpr ObisId slave_equipment_id::id; -constexpr char slave_equipment_id::name_progmem[]; -constexpr const __FlashStringHelper *slave_equipment_id::name; +constexpr ObisId sub_device_type::id; +constexpr char sub_device_type::name[]; -constexpr ObisId slave_valve_position::id; -constexpr char slave_valve_position::name_progmem[]; -constexpr const __FlashStringHelper *slave_valve_position::name; +constexpr ObisId sub_equipment_id::id; +constexpr char sub_equipment_id::name[]; -constexpr ObisId slave_delivered::id; -constexpr char slave_delivered::name_progmem[]; -constexpr const __FlashStringHelper *slave_delivered::name; +constexpr ObisId sub_valve_position::id; +constexpr char sub_valve_position::name[]; +constexpr ObisId sub_delivered::id; +constexpr char sub_delivered::name[]; diff --git a/components/dsmr/fields.h b/components/dsmr/fields.h index 027441f..205381d 100644 --- a/components/dsmr/fields.h +++ b/components/dsmr/fields.h @@ -28,370 +28,500 @@ * Field parsing functions */ -#ifndef DSMR_INCLUDE_FIELDS_H -#define DSMR_INCLUDE_FIELDS_H +#pragma once #include "util.h" #include "parser.h" -namespace dsmr { - -/** +#ifndef DSMR_GAS_MBUS_ID +#define DSMR_GAS_MBUS_ID 1 +#endif +#ifndef DSMR_WATER_MBUS_ID +#define DSMR_WATER_MBUS_ID 2 +#endif +#ifndef DSMR_THERMAL_MBUS_ID +#define DSMR_THERMAL_MBUS_ID 3 +#endif +#ifndef DSMR_SUB_MBUS_ID +#define DSMR_SUB_MBUS_ID 4 +#endif + +namespace dsmr +{ + + /** * Superclass for data items in a P1 message. */ -template -struct ParsedField { - template - void apply(F& f) { - f.apply(*static_cast(this)); - } - // By defaults, fields have no unit - static const char *unit() { return ""; } -}; - -template -struct StringField : ParsedField { - ParseResult parse(const char *str, const char *end) { - ParseResult res = StringParser::parse_string(minlen, maxlen, str, end); - if (!res.err) - static_cast(this)->val() = res.result; - return res; - } -}; - -// A timestamp is essentially a string using YYMMDDhhmmssX format (where -// X is W or S for wintertime or summertime). Parsing this into a proper -// (UNIX) timestamp is hard to do generically. Parsing it into a -// single integer needs > 4 bytes top fit and isn't very useful (you -// cannot really do any calculation with those values). So we just parse -// into a string for now. -template -struct TimestampField : StringField { }; - -// Value that is parsed as a three-decimal float, but stored as an -// integer (by multiplying by 1000). Supports val() (or implicit cast to -// float) to get the original value, and int_val() to get the more -// efficient integer value. The unit() and int_unit() methods on -// FixedField return the corresponding units for these values. -struct FixedValue { - operator float() { return val();} - float val() { return _value / 1000.0;} - uint32_t int_val() { return _value; } - - uint32_t _value; -}; - -// Floating point numbers in the message never have more than 3 decimal -// digits. To prevent inefficient floating point operations, we store -// them as a fixed-point number: an integer that stores the value in -// thousands. For example, a value of 1.234 kWh is stored as 1234. This -// effectively means that the integer value is het value in Wh. To allow -// automatic printing of these values, both the original unit and the -// integer unit is passed as a template argument. -template -struct FixedField : ParsedField { - ParseResult parse(const char *str, const char *end) { - ParseResult res = NumParser::parse(3, _unit, str, end); - if (!res.err) - static_cast(this)->val()._value = res.result; - return res; - } - - static const char *unit() { return _unit; } - static const char *int_unit() { return _int_unit; } -}; - -struct TimestampedFixedValue : public FixedValue { - String timestamp; -}; - -// Some numerical values are prefixed with a timestamp. This is simply -// both of them concatenated, e.g. 0-1:24.2.1(150117180000W)(00473.789*m3) -template -struct TimestampedFixedField : public FixedField { - ParseResult parse(const char *str, const char *end) { - // First, parse timestamp - ParseResult res = StringParser::parse_string(13, 13, str, end); - if (res.err) + template + struct ParsedField + { + template + void apply(F &f) { f.apply(*static_cast(this)); } + // By defaults, fields have no unit + static const char *unit() { return ""; } + }; + + template + struct StringField : ParsedField + { + ParseResult parse(const char *str, const char *end) + { + ParseResult res = StringParser::parse_string(minlen, maxlen, str, end); + if (!res.err) + static_cast(this)->val() = res.result; return res; - - static_cast(this)->val().timestamp = res.result; - - // Which is immediately followed by the numerical value - return FixedField::parse(res.next, end); - } -}; - -// A integer number is just represented as an integer. -template -struct IntField : ParsedField { - ParseResult parse(const char *str, const char *end) { - ParseResult res = NumParser::parse(0, _unit, str, end); - if (!res.err) - static_cast(this)->val() = res.result; - return res; - } - - static const char *unit() { return _unit; } -}; - -// A RawField is not parsed, the entire value (including any -// parenthesis around it) is returned as a string. -template -struct RawField : ParsedField { - ParseResult parse(const char *str, const char *end) { - // Just copy the string verbatim value without any parsing - concat_hack(static_cast(this)->val(), str, end - str); - return ParseResult().until(end); - } -}; - -namespace fields { - -struct units { - // These variables are inside a struct, since that allows us to make - // them constexpr and define their values here, but define the storage - // in a cpp file. Global const(expr) variables have implicitly - // internal linkage, meaning each cpp file that includes us will have - // its own copy of the variable. Since we take the address of these - // variables (passing it as a template argument), this would cause a - // compiler warning. By putting these in a struct, this is prevented. - static constexpr char none[] = ""; - static constexpr char kWh[] = "kWh"; - static constexpr char Wh[] = "Wh"; - static constexpr char kW[] = "kW"; - static constexpr char W[] = "W"; - static constexpr char V[] = "V"; - static constexpr char mV[] = "mV"; - static constexpr char A[] = "A"; - static constexpr char mA[] = "mA"; - static constexpr char m3[] = "m3"; - static constexpr char dm3[] = "dm3"; - static constexpr char GJ[] = "GJ"; - static constexpr char MJ[] = "MJ"; - static constexpr char kvar[] = "kvar"; - static constexpr char kvarh[] = "kvarh"; -}; - -const uint8_t GAS_MBUS_ID = 1; -const uint8_t WATER_MBUS_ID = 2; -const uint8_t THERMAL_MBUS_ID = 3; -const uint8_t SLAVE_MBUS_ID = 4; + } + }; + + // A timestamp is essentially a string using YYMMDDhhmmssX format (where + // X is W or S for wintertime or summertime). Parsing this into a proper + // (UNIX) timestamp is hard to do generically. Parsing it into a + // single integer needs > 4 bytes top fit and isn't very useful (you + // cannot really do any calculation with those values). So we just parse + // into a string for now. + template + struct TimestampField : StringField + { + }; + + // Value that is parsed as a three-decimal float, but stored as an + // integer (by multiplying by 1000). Supports val() (or implicit cast to + // float) to get the original value, and int_val() to get the more + // efficient integer value. The unit() and int_unit() methods on + // FixedField return the corresponding units for these values. + struct FixedValue + { + operator float() { return val(); } + float val() { return _value / 1000.0; } + uint32_t int_val() { return _value; } + + uint32_t _value; + }; + + // Floating point numbers in the message never have more than 3 decimal + // digits. To prevent inefficient floating point operations, we store + // them as a fixed-point number: an integer that stores the value in + // thousands. For example, a value of 1.234 kWh is stored as 1234. This + // effectively means that the integer value is the value in Wh. To allow + // automatic printing of these values, both the original unit and the + // integer unit is passed as a template argument. + template + struct FixedField : ParsedField + { + ParseResult parse(const char *str, const char *end) + { + // Check if the value is a float value, plus its expected unit type. + ParseResult res_float = NumParser::parse(3, _unit, str, end); + if (!res_float.err) { + static_cast(this)->val()._value = res_float.result; + return res_float; + } + // If not, then check for an int value, plus its expected unit type. + // This accomodates for some smart meters that publish int values instead + // of floats. E.g. most meters would publish "1-0:1.8.0(000441.879*kWh)", + // but some use "1-0:1.8.0(000441879*Wh)" instead. + ParseResult res_int = NumParser::parse(0, _int_unit, str, end); + if (!res_int.err) { + static_cast(this)->val()._value = res_int.result; + return res_int; + } + // If not, then return the initial error result for the float parsing step. + return res_float; + } + + static const char *unit() { return _unit; } + static const char *int_unit() { return _int_unit; } + }; + + struct TimestampedFixedValue : public FixedValue + { + String timestamp; + }; + + // Some numerical values are prefixed with a timestamp. This is simply + // both of them concatenated, e.g. 0-1:24.2.1(150117180000W)(00473.789*m3) + template + struct TimestampedFixedField : public FixedField + { + ParseResult parse(const char *str, const char *end) + { + // First, parse timestamp + ParseResult res = StringParser::parse_string(13, 13, str, end); + if (res.err) + return res; + + static_cast(this)->val().timestamp = res.result; + + // Which is immediately followed by the numerical value + return FixedField::parse(res.next, end); + } + }; + + // A integer number is just represented as an integer. + template + struct IntField : ParsedField + { + ParseResult parse(const char *str, const char *end) + { + ParseResult res = NumParser::parse(0, _unit, str, end); + if (!res.err) + static_cast(this)->val() = res.result; + return res; + } + + static const char *unit() { return _unit; } + }; + + // A RawField is not parsed, the entire value (including any + // parenthesis around it) is returned as a string. + template + struct RawField : ParsedField + { + ParseResult parse(const char *str, const char *end) + { + // Just copy the string verbatim value without any parsing + concat_hack(static_cast(this)->val(), str, end - str); + return ParseResult().until(end); + } + }; + + namespace fields + { + + struct units + { + // These variables are inside a struct, since that allows us to make + // them constexpr and define their values here, but define the storage + // in a cpp file. Global const(expr) variables have implicitly + // internal linkage, meaning each cpp file that includes us will have + // its own copy of the variable. Since we take the address of these + // variables (passing it as a template argument), this would cause a + // compiler warning. By putting these in a struct, this is prevented. + static constexpr char none[] = ""; + static constexpr char kWh[] = "kWh"; + static constexpr char Wh[] = "Wh"; + static constexpr char kW[] = "kW"; + static constexpr char W[] = "W"; + static constexpr char V[] = "V"; + static constexpr char mV[] = "mV"; + static constexpr char A[] = "A"; + static constexpr char mA[] = "mA"; + static constexpr char m3[] = "m3"; + static constexpr char dm3[] = "dm3"; + static constexpr char GJ[] = "GJ"; + static constexpr char MJ[] = "MJ"; + static constexpr char kvar[] = "kvar"; + static constexpr char kvarh[] = "kvarh"; + static constexpr char Hz[] = "Hz"; + }; + + const uint8_t GAS_MBUS_ID = DSMR_GAS_MBUS_ID; + const uint8_t WATER_MBUS_ID = DSMR_WATER_MBUS_ID; + const uint8_t THERMAL_MBUS_ID = DSMR_THERMAL_MBUS_ID; + const uint8_t SUB_MBUS_ID = DSMR_SUB_MBUS_ID; #define DEFINE_FIELD(fieldname, value_t, obis, field_t, field_args...) \ - struct fieldname : field_t { \ - value_t fieldname; \ - bool fieldname ## _present = false; \ - static constexpr ObisId id = obis; \ - static constexpr char name_progmem[] DSMR_PROGMEM = #fieldname; \ - static constexpr const __FlashStringHelper *name = reinterpret_cast(&name_progmem); \ - value_t& val() { return fieldname; } \ - bool& present() { return fieldname ## _present; } \ + struct fieldname : field_t \ + { \ + value_t fieldname; \ + bool fieldname##_present = false; \ + static constexpr ObisId id = obis; \ + static constexpr char name[] = #fieldname; \ + value_t &val() { return fieldname; } \ + bool &present() { return fieldname##_present; } \ } -/* Meter identification. This is not a normal field, but a + /* Meter identification. This is not a normal field, but a * specially-formatted first line of the message */ -DEFINE_FIELD(identification, String, ObisId(255, 255, 255, 255, 255, 255), RawField); - -/* Version information for P1 output */ -DEFINE_FIELD(p1_version, String, ObisId(1, 3, 0, 2, 8), StringField, 2, 2); -DEFINE_FIELD(p1_version_be, String, ObisId(0, 0, 96, 1, 4), StringField, 2, 5); - -/* Date-time stamp of the P1 message */ -DEFINE_FIELD(timestamp, String, ObisId(0, 0, 1, 0, 0), TimestampField); - -/* Equipment identifier */ -DEFINE_FIELD(equipment_id, String, ObisId(0, 0, 96, 1, 1), StringField, 0, 96); - -/* Meter Reading electricity delivered to client (Special for Lux) in 0,001 kWh */ -DEFINE_FIELD(energy_delivered_lux, FixedValue, ObisId(1, 0, 1, 8, 0), FixedField, units::kWh, units::Wh); -/* Meter Reading electricity delivered to client (Tariff 1) in 0,001 kWh */ -DEFINE_FIELD(energy_delivered_tariff1, FixedValue, ObisId(1, 0, 1, 8, 1), FixedField, units::kWh, units::Wh); -/* Meter Reading electricity delivered to client (Tariff 2) in 0,001 kWh */ -DEFINE_FIELD(energy_delivered_tariff2, FixedValue, ObisId(1, 0, 1, 8, 2), FixedField, units::kWh, units::Wh); -/* Meter Reading electricity delivered by client (Special for Lux) in 0,001 kWh */ -DEFINE_FIELD(energy_returned_lux, FixedValue, ObisId(1, 0, 2, 8, 0), FixedField, units::kWh, units::Wh); -/* Meter Reading electricity delivered by client (Tariff 1) in 0,001 kWh */ -DEFINE_FIELD(energy_returned_tariff1, FixedValue, ObisId(1, 0, 2, 8, 1), FixedField, units::kWh, units::Wh); -/* Meter Reading electricity delivered by client (Tariff 2) in 0,001 kWh */ -DEFINE_FIELD(energy_returned_tariff2, FixedValue, ObisId(1, 0, 2, 8, 2), FixedField, units::kWh, units::Wh); - -/* + DEFINE_FIELD(identification, String, ObisId(255, 255, 255, 255, 255, 255), RawField); + + /* Version information for P1 output */ + DEFINE_FIELD(p1_version, String, ObisId(1, 3, 0, 2, 8), StringField, 2, 2); + DEFINE_FIELD(p1_version_be, String, ObisId(0, 0, 96, 1, 4), StringField, 2, 5); + + /* Date-time stamp of the P1 message */ + DEFINE_FIELD(timestamp, String, ObisId(0, 0, 1, 0, 0), TimestampField); + + /* Equipment identifier equipment_id 96.1.0 */ + // DEFINE_FIELD(equipment_id, String, ObisId(0, 0, 96, 1, 1), StringField, 0, 96); + DEFINE_FIELD(equipment_id, String, ObisId(0, 0, 96, 1, 0), StringField, 0, 96); + + + /* Positive active energy (A+) total [kWh] */ + DEFINE_FIELD(energy_delivered, FixedValue, ObisId(1, 0, 1, 8, 0), FixedField, units::kWh, units::Wh); + /* Positive active energy (A+) in tariff T1 [kWh] */ + DEFINE_FIELD(energy_delivered_tariff1, FixedValue, ObisId(1, 0, 1, 8, 1), FixedField, units::kWh, units::Wh); + /* Positive active energy (A+) in tariff T2 [kWh] */ + DEFINE_FIELD(energy_delivered_tariff2, FixedValue, ObisId(1, 0, 1, 8, 2), FixedField, units::kWh, units::Wh); + /* Positive active energy (A+) in tariff T3 [kWh] */ + DEFINE_FIELD(energy_delivered_tariff3, FixedValue, ObisId(1, 0, 1, 8, 3), FixedField, units::kWh, units::Wh); + /* Positive active energy (A+) in tariff T4 [kWh] */ + DEFINE_FIELD(energy_delivered_tariff4, FixedValue, ObisId(1, 0, 1, 8, 4), FixedField, units::kWh, units::Wh); + + /* Negative active energy (A+) total [kWh] */ + DEFINE_FIELD(energy_returned, FixedValue, ObisId(1, 0, 2, 8, 0), FixedField, units::kWh, units::Wh); + /* Negative active energy (A+) in tariff T1 [kWh] */ + DEFINE_FIELD(energy_returned_tariff1, FixedValue, ObisId(1, 0, 2, 8, 1), FixedField, units::kWh, units::Wh); + /* Negative active energy (A+) in tariff T2 [kWh] */ + DEFINE_FIELD(energy_returned_tariff2, FixedValue, ObisId(1, 0, 2, 8, 2), FixedField, units::kWh, units::Wh); + /* Negative active energy (A+) in tariff T3 [kWh] */ + DEFINE_FIELD(energy_returned_tariff3, FixedValue, ObisId(1, 0, 2, 8, 3), FixedField, units::kWh, units::Wh); + /* Negative active energy (A+) in tariff T4 [kWh] */ + DEFINE_FIELD(energy_returned_tariff4, FixedValue, ObisId(1, 0, 2, 8, 4), FixedField, units::kWh, units::Wh); + + /* Absolute active energy (A+) total [kWh] */ + DEFINE_FIELD(energy_absolute, FixedValue, ObisId(1, 0, 15, 8, 0), FixedField, units::kWh, units::Wh); + /* Absolute active energy (A+) in tariff T1 [kWh] */ + DEFINE_FIELD(energy_absolute_tariff1, FixedValue, ObisId(1, 0, 15, 8, 1), FixedField, units::kWh, units::Wh); + /* Absolute active energy (A+) in tariff T2 [kWh] */ + DEFINE_FIELD(energy_absolute_tariff2, FixedValue, ObisId(1, 0, 15, 8, 2), FixedField, units::kWh, units::Wh); + /* Absolute active energy (A+) in tariff T3 [kWh] */ + DEFINE_FIELD(energy_absolute_tariff3, FixedValue, ObisId(1, 0, 15, 8, 3), FixedField, units::kWh, units::Wh); + /* Absolute active energy (A+) in tariff T4 [kWh] */ + DEFINE_FIELD(energy_absolute_tariff4, FixedValue, ObisId(1, 0, 15, 8, 4), FixedField, units::kWh, units::Wh); + + /* Sum active energy without reverse blockade (A+ - A-) total [kWh] */ + DEFINE_FIELD(energy_sumwoblockade, FixedValue, ObisId(1, 0, 16, 8, 0), FixedField, units::kWh, units::Wh); + /* Sum active energy without reverse blockade (A+ - A-) in tariff T1 [kWh] */ + DEFINE_FIELD(energy_sumwoblockade_tariff1, FixedValue, ObisId(1, 0, 16, 8, 1), FixedField, units::kWh, units::Wh); + /* Sum active energy without reverse blockade (A+ - A-) in tariff T2 [kWh] */ + DEFINE_FIELD(energy_sumwoblockade_tariff2, FixedValue, ObisId(1, 0, 16, 8, 2), FixedField, units::kWh, units::Wh); + /* Sum active energy without reverse blockade (A+ - A-) in tariff T3 [kWh] */ + DEFINE_FIELD(energy_sumwoblockade_tariff3, FixedValue, ObisId(1, 0, 16, 8, 3), FixedField, units::kWh, units::Wh); + /* Sum active energy without reverse blockade (A+ - A-) in tariff T4 [kWh] */ + DEFINE_FIELD(energy_sumwoblockade_tariff4, FixedValue, ObisId(1, 0, 16, 8, 4), FixedField, units::kWh, units::Wh); + + /* Positive reactive energy (Q+) total [kvarh] 3.8.0 */ + // DEFINE_FIELD(energy_positive_reactive, FixedValue, ObisId(1, 0, 3, 8, 0), FixedField, units::kvarh, units::kvarh); + /* Positive reactive energy (Q+) total in tariff T1 [kvarh] */ + DEFINE_FIELD(energy_positive_reactive_tariff1, FixedValue, ObisId(1, 0, 3, 8, 1), FixedField, units::kvarh, units::kvarh); + /* Positive reactive energy (Q+) total in tariff T2 [kvarh] */ + DEFINE_FIELD(energy_positive_reactive_tariff2, FixedValue, ObisId(1, 0, 3, 8, 2), FixedField, units::kvarh, units::kvarh); + /* Positive reactive energy (Q+) total in tariff T3 [kvarh] */ + DEFINE_FIELD(energy_positive_reactive_tariff3, FixedValue, ObisId(1, 0, 3, 8, 3), FixedField, units::kvarh, units::kvarh); + /* Positive reactive energy (Q+) total in tariff T4 [kvarh] */ + DEFINE_FIELD(energy_positive_reactive_tariff4, FixedValue, ObisId(1, 0, 3, 8, 4), FixedField, units::kvarh, units::kvarh); + + /* Negative reactive energy (Q+) total [kvarh] 4.8.0 */ + DEFINE_FIELD(energy_negative_reactive, FixedValue, ObisId(1, 0, 4, 8, 0), FixedField, units::kvarh, units::kvarh); + /* negative reactive energy (Q+) total in tariff T1 [kvarh] */ + DEFINE_FIELD(energy_negative_reactive_tariff1, FixedValue, ObisId(1, 0, 4, 8, 1), FixedField, units::kvarh, units::kvarh); + /* Negative reactive energy (Q+) total in tariff T2 [kvarh] */ + DEFINE_FIELD(energy_negative_reactive_tariff2, FixedValue, ObisId(1, 0, 4, 8, 2), FixedField, units::kvarh, units::kvarh); + /* Negative reactive energy (Q+) total in tariff T3 [kvarh] */ + DEFINE_FIELD(energy_negative_reactive_tariff3, FixedValue, ObisId(1, 0, 4, 8, 3), FixedField, units::kvarh, units::kvarh); + /* Negative reactive energy (Q+) total in tariff T4 [kvarh] */ + DEFINE_FIELD(energy_negative_reactive_tariff4, FixedValue, ObisId(1, 0, 4, 8, 4), FixedField, units::kvarh, units::kvarh); + + /* Tariff indicator electricity. 96.14.0 + * The tariff indicator can also be used to switch tariff dependent loads e.g boilers. + * This is the responsibility of the P1 user */ + DEFINE_FIELD(electricity_tariff, uint8_t, ObisId(0, 0, 96, 14, 0), IntField, units::none); + + /* current status fo the breaker ON/OFF */ + DEFINE_FIELD(breaker_status, String, ObisId(0, 0, 96, 50, 68), StringField, 2, 3); + + /* Actual electricity power delivered (+P) in 1 Watt resolution 1.7.0 */ + DEFINE_FIELD(power_delivered, FixedValue, ObisId(1, 0, 1, 7, 0), FixedField, units::kW, units::W); + /* Actual electricity power received (-P) in 1 Watt resolution 2.7.0 */ + DEFINE_FIELD(power_returned, FixedValue, ObisId(1, 0, 2, 7, 0), FixedField, units::kW, units::W); + + /* 5.7.0(@1,Reactive power QI,kvar,pwr_reac_q1,3 [kvarh] */ + DEFINE_FIELD(reactive_power_qi, FixedValue, ObisId(1, 0, 5, 7, 0), FixedField, units::kvar, units::kvar); + /* 6.7.0(@1,Reactive power QII,kvar,pwr_reac_q2,3 */ + DEFINE_FIELD(reactive_power_qii, FixedValue, ObisId(1, 0, 6, 7, 0), FixedField, units::kvar, units::kvar); + /* 7.7.0(@1,Reactive power QIII,kvar,pwr_reac_q3,3 */ + DEFINE_FIELD(reactive_power_qiii, FixedValue, ObisId(1, 0, 7, 7, 0), FixedField, units::kvar, units::kvar); + /* 8.7.0(@1,Reactive power QIV,kvar,pwr_reac_q4,3 */ + DEFINE_FIELD(reactive_power_qiv, FixedValue, ObisId(1, 0, 8, 7, 0), FixedField, units::kvar, units::kvar); + + /* 5.8.0(@1,Reactive energy QI,kvarh,nrg_reac_q1,3 [kvarh] */ + DEFINE_FIELD(reactive_energy_qi, FixedValue, ObisId(1, 0, 5, 8, 0), FixedField, units::kvarh, units::kvarh); + /* 6.8.0(@1,Reactive energy QII,kvarh,nrg_reac_q2,3 [kvarh] */ + DEFINE_FIELD(reactive_energy_qii, FixedValue, ObisId(1, 0, 6, 8, 0), FixedField, units::kvarh, units::kvarh); + /* 7.8.0(@1,Reactive energy QIII,kvarh,nrg_reac_q3,3 [kvarh] */ + DEFINE_FIELD(reactive_energy_qiii, FixedValue, ObisId(1, 0, 7, 8, 0), FixedField, units::kvarh, units::kvarh); + /* 8.8.0(@1,Reactive energy QIV,kvarh,nrg_reac_q4,3 [kvarh] */ + DEFINE_FIELD(reactive_energy_qiv, FixedValue, ObisId(1, 0, 8, 8, 0), FixedField, units::kvarh, units::kvarh); + + + /* * Extra fields used for Luxembourg */ -DEFINE_FIELD(total_imported_energy, FixedValue, ObisId(1, 0, 3, 8, 0), FixedField, units::kvarh, units::kvarh); -DEFINE_FIELD(total_exported_energy, FixedValue, ObisId(1, 0, 4, 8, 0), FixedField, units::kvarh, units::kvarh); - -/* Tariff indicator electricity. The tariff indicator can also be used - * to switch tariff dependent loads e.g boilers. This is the - * responsibility of the P1 user */ -DEFINE_FIELD(electricity_tariff, String, ObisId(0, 0, 96, 14, 0), StringField, 4, 4); - -/* Actual electricity power delivered (+P) in 1 Watt resolution */ -DEFINE_FIELD(power_delivered, FixedValue, ObisId(1, 0, 1, 7, 0), FixedField, units::kW, units::W); -/* Actual electricity power received (-P) in 1 Watt resolution */ -DEFINE_FIELD(power_returned, FixedValue, ObisId(1, 0, 2, 7, 0), FixedField, units::kW, units::W); - -/* - * Extra fields used for Luxembourg - */ -DEFINE_FIELD(reactive_power_delivered, FixedValue, ObisId(1, 0, 3, 7, 0), FixedField, units::kvar, units::kvar); -DEFINE_FIELD(reactive_power_returned, FixedValue, ObisId(1, 0, 4, 7, 0), FixedField, units::kvar, units::kvar); - -/* The actual threshold Electricity in kW. Removed in 4.0.7 / 4.2.2 / 5.0 */ -DEFINE_FIELD(electricity_threshold, FixedValue, ObisId(0, 0, 17, 0, 0), FixedField, units::kW, units::W); - -/* Switch position Electricity (in/out/enabled). Removed in 4.0.7 / 4.2.2 / 5.0 */ -DEFINE_FIELD(electricity_switch_position, uint8_t, ObisId(0, 0, 96, 3, 10), IntField, units::none); - -/* Number of power failures in any phase */ -DEFINE_FIELD(electricity_failures, uint32_t, ObisId(0, 0, 96, 7, 21), IntField, units::none); -/* Number of long power failures in any phase */ -DEFINE_FIELD(electricity_long_failures, uint32_t, ObisId(0, 0, 96, 7, 9), IntField, units::none); - -/* Power Failure Event Log (long power failures) */ -DEFINE_FIELD(electricity_failure_log, String, ObisId(1, 0, 99, 97, 0), RawField); - -/* Number of voltage sags in phase L1 */ -DEFINE_FIELD(electricity_sags_l1, uint32_t, ObisId(1, 0, 32, 32, 0), IntField, units::none); -/* Number of voltage sags in phase L2 (polyphase meters only) */ -DEFINE_FIELD(electricity_sags_l2, uint32_t, ObisId(1, 0, 52, 32, 0), IntField, units::none); -/* Number of voltage sags in phase L3 (polyphase meters only) */ -DEFINE_FIELD(electricity_sags_l3, uint32_t, ObisId(1, 0, 72, 32, 0), IntField, units::none); - -/* Number of voltage swells in phase L1 */ -DEFINE_FIELD(electricity_swells_l1, uint32_t, ObisId(1, 0, 32, 36, 0), IntField, units::none); -/* Number of voltage swells in phase L2 (polyphase meters only) */ -DEFINE_FIELD(electricity_swells_l2, uint32_t, ObisId(1, 0, 52, 36, 0), IntField, units::none); -/* Number of voltage swells in phase L3 (polyphase meters only) */ -DEFINE_FIELD(electricity_swells_l3, uint32_t, ObisId(1, 0, 72, 36, 0), IntField, units::none); - -/* Text message codes: numeric 8 digits (Note: Missing from 5.0 spec) + DEFINE_FIELD(reactive_power_delivered, FixedValue, ObisId(1, 0, 3, 8, 0), FixedField, units::kvarh, units::kvarh); + + DEFINE_FIELD(reactive_power_returned, FixedValue, ObisId(1, 0, 4, 7, 0), FixedField, units::kvar, units::kvar); + + /* 13.7.0 Instantaneous power factor */ + DEFINE_FIELD(instantaneous_power_factor, FixedValue, ObisId(1, 0, 13, 7, 0), FixedField, units::none, units::none); + /* 33.7.0 Instantaneous power factor L1 */ + DEFINE_FIELD(instantaneous_power_factor_l1, FixedValue, ObisId(1, 0, 33, 7, 0), FixedField, units::none, units::none); + /* 53.7.0 Instantaneous power factor L2 */ + DEFINE_FIELD(instantaneous_power_factor_l2, FixedValue, ObisId(1, 0, 53, 7, 0), FixedField, units::none, units::none); + /* 73.7.0 Instantaneous power factor L3 */ + DEFINE_FIELD(instantaneous_power_factor_l3, FixedValue, ObisId(1, 0, 73, 7, 0), FixedField, units::none, units::none); + + /* 14.7.0 Frequency [Hz] */ + DEFINE_FIELD(frequency, FixedValue, ObisId(1, 0, 14, 7, 0), FixedField, units::Hz, units::Hz); + + // /* 15.8.0 Absolute active energy (A+) total [kWh] */ + // DEFINE_FIELD(absolute_active_energy, FixedValue, ObisId(1, 0, 15, 8, 0), FixedField, units::kW, units::W); + + /* The actual threshold Electricity in kW. 17.0.0 - Removed in 4.0.7 / 4.2.2 / 5.0 */ + DEFINE_FIELD(electricity_threshold, FixedValue, ObisId(0, 0, 17, 0, 0), FixedField, units::kW, units::W); + + /* Switch position Electricity (in/out/enabled). Removed in 4.0.7 / 4.2.2 / 5.0 */ + DEFINE_FIELD(electricity_switch_position, uint8_t, ObisId(0, 0, 96, 3, 10), IntField, units::none); + + /* Number of power failures in any phase */ + DEFINE_FIELD(electricity_failures, uint32_t, ObisId(0, 0, 96, 7, 21), IntField, units::none); + /* Number of long power failures in any phase */ + DEFINE_FIELD(electricity_long_failures, uint32_t, ObisId(0, 0, 96, 7, 9), IntField, units::none); + + /* Power Failure Event Log (long power failures) */ + DEFINE_FIELD(electricity_failure_log, String, ObisId(1, 0, 99, 97, 0), RawField); + + /* Number of voltage sags in phase L1 */ + DEFINE_FIELD(electricity_sags_l1, uint32_t, ObisId(1, 0, 32, 32, 0), IntField, units::none); + /* Number of voltage sags in phase L2 (polyphase meters only) */ + DEFINE_FIELD(electricity_sags_l2, uint32_t, ObisId(1, 0, 52, 32, 0), IntField, units::none); + /* Number of voltage sags in phase L3 (polyphase meters only) */ + DEFINE_FIELD(electricity_sags_l3, uint32_t, ObisId(1, 0, 72, 32, 0), IntField, units::none); + + /* Number of voltage swells in phase L1 */ + DEFINE_FIELD(electricity_swells_l1, uint32_t, ObisId(1, 0, 32, 36, 0), IntField, units::none); + /* Number of voltage swells in phase L2 (polyphase meters only) */ + DEFINE_FIELD(electricity_swells_l2, uint32_t, ObisId(1, 0, 52, 36, 0), IntField, units::none); + /* Number of voltage swells in phase L3 (polyphase meters only) */ + DEFINE_FIELD(electricity_swells_l3, uint32_t, ObisId(1, 0, 72, 36, 0), IntField, units::none); + + /* Text message codes: numeric 8 digits (Note: Missing from 5.0 spec) * */ -DEFINE_FIELD(message_short, String, ObisId(0, 0, 96, 13, 1), StringField, 0, 16); -/* Text message max 2048 characters (Note: Spec says 1024 in comment and + DEFINE_FIELD(message_short, String, ObisId(0, 0, 96, 13, 1), StringField, 0, 16); + /* Text message max 2048 characters (Note: Spec says 1024 in comment and * 2048 in format spec, so we stick to 2048). */ -DEFINE_FIELD(message_long, String, ObisId(0, 0, 96, 13, 0), StringField, 0, 2048); + DEFINE_FIELD(message_long, String, ObisId(0, 0, 96, 13, 0), StringField, 0, 2048); -/* Instantaneous voltage L1 in 0.1V resolution (Note: Spec says V + /* Instantaneous voltage L1 in 0.1V resolution (Note: Spec says V * resolution in comment, but 0.1V resolution in format spec. Added in - * 5.0) */ -DEFINE_FIELD(voltage_l1, FixedValue, ObisId(1, 0, 32, 7, 0), FixedField, units::V, units::mV); -/* Instantaneous voltage L2 in 0.1V resolution (Note: Spec says V + * 5.0) */ /* 32.7.0 */ + DEFINE_FIELD(voltage_l1, FixedValue, ObisId(1, 0, 32, 7, 0), FixedField, units::V, units::mV); + /* Instantaneous voltage L2 in 0.1V resolution (Note: Spec says V * resolution in comment, but 0.1V resolution in format spec. Added in - * 5.0) */ -DEFINE_FIELD(voltage_l2, FixedValue, ObisId(1, 0, 52, 7, 0), FixedField, units::V, units::mV); -/* Instantaneous voltage L3 in 0.1V resolution (Note: Spec says V + * 5.0) */ /* 52.7.0 */ + DEFINE_FIELD(voltage_l2, FixedValue, ObisId(1, 0, 52, 7, 0), FixedField, units::V, units::mV); + /* Instantaneous voltage L3 in 0.1V resolution (Note: Spec says V * resolution in comment, but 0.1V resolution in format spec. Added in - * 5.0) */ -DEFINE_FIELD(voltage_l3, FixedValue, ObisId(1, 0, 72, 7, 0), FixedField, units::V, units::mV); - -/* Instantaneous current L1 in A resolution */ -//DEFINE_FIELD(current_l1, uint16_t, ObisId(1, 0, 31, 7, 0), IntField, units::A); -DEFINE_FIELD(current_l1, FixedValue, ObisId(1, 0, 31, 7, 0), FixedField, units::A, units::mA); -/* Instantaneous current L2 in A resolution */ -//DEFINE_FIELD(current_l2, uint16_t, ObisId(1, 0, 51, 7, 0), IntField, units::A); -DEFINE_FIELD(current_l2, FixedValue, ObisId(1, 0, 51, 7, 0), FixedField, units::A, units::mA); -/* Instantaneous current L3 in A resolution */ -//DEFINE_FIELD(current_l3, uint16_t, ObisId(1, 0, 71, 7, 0), IntField, units::A); -DEFINE_FIELD(current_l3, FixedValue, ObisId(1, 0, 71, 7, 0), FixedField, units::A, units::mA); - -/* Instantaneous active power L1 (+P) in W resolution */ -DEFINE_FIELD(power_delivered_l1, FixedValue, ObisId(1, 0, 21, 7, 0), FixedField, units::kW, units::W); -/* Instantaneous active power L2 (+P) in W resolution */ -DEFINE_FIELD(power_delivered_l2, FixedValue, ObisId(1, 0, 41, 7, 0), FixedField, units::kW, units::W); -/* Instantaneous active power L3 (+P) in W resolution */ -DEFINE_FIELD(power_delivered_l3, FixedValue, ObisId(1, 0, 61, 7, 0), FixedField, units::kW, units::W); - -/* Instantaneous active power L1 (-P) in W resolution */ -DEFINE_FIELD(power_returned_l1, FixedValue, ObisId(1, 0, 22, 7, 0), FixedField, units::kW, units::W); -/* Instantaneous active power L2 (-P) in W resolution */ -DEFINE_FIELD(power_returned_l2, FixedValue, ObisId(1, 0, 42, 7, 0), FixedField, units::kW, units::W); -/* Instantaneous active power L3 (-P) in W resolution */ -DEFINE_FIELD(power_returned_l3, FixedValue, ObisId(1, 0, 62, 7, 0), FixedField, units::kW, units::W); - -/* + * 5.0) */ /* 72.7.0 */ + DEFINE_FIELD(voltage_l3, FixedValue, ObisId(1, 0, 72, 7, 0), FixedField, units::V, units::mV); + + /* Instantaneous current L1 in A resolution */ + DEFINE_FIELD(current_l1, FixedValue, ObisId(1, 0, 31, 7, 0), FixedField, units::A, units::mA); + /* Instantaneous current L2 in A resolution */ + DEFINE_FIELD(current_l2, FixedValue, ObisId(1, 0, 51, 7, 0), FixedField, units::A, units::mA); + /* Instantaneous current L3 in A resolution */ + DEFINE_FIELD(current_l3, FixedValue, ObisId(1, 0, 71, 7, 0), FixedField, units::A, units::mA); + + /* Instantaneous active power L1 (+P) in W resolution */ + DEFINE_FIELD(power_delivered_l1, FixedValue, ObisId(1, 0, 21, 7, 0), FixedField, units::kW, units::W); + /* Instantaneous active power L2 (+P) in W resolution */ + DEFINE_FIELD(power_delivered_l2, FixedValue, ObisId(1, 0, 41, 7, 0), FixedField, units::kW, units::W); + /* Instantaneous active power L3 (+P) in W resolution */ + DEFINE_FIELD(power_delivered_l3, FixedValue, ObisId(1, 0, 61, 7, 0), FixedField, units::kW, units::W); + + /* Instantaneous active power L1 (-P) in W resolution */ + DEFINE_FIELD(power_returned_l1, FixedValue, ObisId(1, 0, 22, 7, 0), FixedField, units::kW, units::W); + /* Instantaneous active power L2 (-P) in W resolution */ + DEFINE_FIELD(power_returned_l2, FixedValue, ObisId(1, 0, 42, 7, 0), FixedField, units::kW, units::W); + /* Instantaneous active power L3 (-P) in W resolution */ + DEFINE_FIELD(power_returned_l3, FixedValue, ObisId(1, 0, 62, 7, 0), FixedField, units::kW, units::W); + + /* * LUX */ -/* Instantaneous reactive power L1 (+Q) in W resolution */ -DEFINE_FIELD(reactive_power_delivered_l1, FixedValue, ObisId(1, 0, 23, 7, 0), FixedField, units::none, units::none); -/* Instantaneous reactive power L2 (+Q) in W resolution */ -DEFINE_FIELD(reactive_power_delivered_l2, FixedValue, ObisId(1, 0, 43, 7, 0), FixedField, units::none, units::none); -/* Instantaneous reactive power L3 (+Q) in W resolution */ -DEFINE_FIELD(reactive_power_delivered_l3, FixedValue, ObisId(1, 0, 63, 7, 0), FixedField, units::none, units::none); - -/* + /* Instantaneous reactive power L1 (+Q) in W resolution */ + DEFINE_FIELD(reactive_power_delivered_l1, FixedValue, ObisId(1, 0, 23, 7, 0), FixedField, units::none, units::none); + /* Instantaneous reactive power L2 (+Q) in W resolution */ + DEFINE_FIELD(reactive_power_delivered_l2, FixedValue, ObisId(1, 0, 43, 7, 0), FixedField, units::none, units::none); + /* Instantaneous reactive power L3 (+Q) in W resolution */ + DEFINE_FIELD(reactive_power_delivered_l3, FixedValue, ObisId(1, 0, 63, 7, 0), FixedField, units::none, units::none); + + /* * LUX */ -/* Instantaneous reactive power L1 (-Q) in W resolution */ -DEFINE_FIELD(reactive_power_returned_l1, FixedValue, ObisId(1, 0, 24, 7, 0), FixedField, units::none, units::none); -/* Instantaneous reactive power L2 (-Q) in W resolution */ -DEFINE_FIELD(reactive_power_returned_l2, FixedValue, ObisId(1, 0, 44, 7, 0), FixedField, units::none, units::none); -/* Instantaneous reactive power L3 (-Q) in W resolution */ -DEFINE_FIELD(reactive_power_returned_l3, FixedValue, ObisId(1, 0, 64, 7, 0), FixedField, units::none, units::none); + /* Instantaneous reactive power L1 (-Q) in W resolution */ + DEFINE_FIELD(reactive_power_returned_l1, FixedValue, ObisId(1, 0, 24, 7, 0), FixedField, units::none, units::none); + /* Instantaneous reactive power L2 (-Q) in W resolution */ + DEFINE_FIELD(reactive_power_returned_l2, FixedValue, ObisId(1, 0, 44, 7, 0), FixedField, units::none, units::none); + /* Instantaneous reactive power L3 (-Q) in W resolution */ + DEFINE_FIELD(reactive_power_returned_l3, FixedValue, ObisId(1, 0, 64, 7, 0), FixedField, units::none, units::none); + -/* Device-Type */ -DEFINE_FIELD(gas_device_type, uint16_t, ObisId(0, GAS_MBUS_ID, 24, 1, 0), IntField, units::none); -/* Equipment identifier (Gas) */ -DEFINE_FIELD(gas_equipment_id, String, ObisId(0, GAS_MBUS_ID, 96, 1, 0), StringField, 0, 96); -/* Equipment identifier (Gas) BE */ -DEFINE_FIELD(gas_equipment_id_be, String, ObisId(0, GAS_MBUS_ID, 96, 1, 1), StringField, 0, 96); + /* Device-Type */ + DEFINE_FIELD(gas_device_type, uint16_t, ObisId(0, GAS_MBUS_ID, 24, 1, 0), IntField, units::none); -/* Valve position Gas (on/off/released) (Note: Removed in 4.0.7 / 4.2.2 / 5.0). */ -DEFINE_FIELD(gas_valve_position, uint8_t, ObisId(0, GAS_MBUS_ID, 24, 4, 0), IntField, units::none); + /* Equipment identifier (Gas) */ + DEFINE_FIELD(gas_equipment_id, String, ObisId(0, GAS_MBUS_ID, 96, 1, 0), StringField, 0, 96); + /* Equipment identifier (Gas) BE */ + DEFINE_FIELD(gas_equipment_id_be, String, ObisId(0, GAS_MBUS_ID, 96, 1, 1), StringField, 0, 96); -/* Last 5-minute value (temperature converted), gas delivered to client + /* Valve position Gas (on/off/released) (Note: Removed in 4.0.7 / 4.2.2 / 5.0). */ + DEFINE_FIELD(gas_valve_position, uint8_t, ObisId(0, GAS_MBUS_ID, 24, 4, 0), IntField, units::none); + + /* Last 5-minute value (temperature converted), gas delivered to client * in m3, including decimal values and capture time (Note: 4.x spec has * "hourly value") */ -DEFINE_FIELD(gas_delivered, TimestampedFixedValue, ObisId(0, GAS_MBUS_ID, 24, 2, 1), TimestampedFixedField, units::m3, units::dm3); -/* _BE */ -DEFINE_FIELD(gas_delivered_be, TimestampedFixedValue, ObisId(0, GAS_MBUS_ID, 24, 2, 3), TimestampedFixedField, units::m3, units::dm3); - + DEFINE_FIELD(gas_delivered, TimestampedFixedValue, ObisId(0, GAS_MBUS_ID, 24, 2, 1), TimestampedFixedField, units::m3, + units::dm3); + /* _BE */ + DEFINE_FIELD(gas_delivered_be, TimestampedFixedValue, ObisId(0, GAS_MBUS_ID, 24, 2, 3), TimestampedFixedField, + units::m3, units::dm3); + DEFINE_FIELD(gas_delivered_text, String, ObisId(0, GAS_MBUS_ID, 24, 3, 0), RawField); -/* Device-Type */ -DEFINE_FIELD(thermal_device_type, uint16_t, ObisId(0, THERMAL_MBUS_ID, 24, 1, 0), IntField, units::none); + /* Device-Type */ + DEFINE_FIELD(thermal_device_type, uint16_t, ObisId(0, THERMAL_MBUS_ID, 24, 1, 0), IntField, units::none); -/* Equipment identifier (Thermal: heat or cold) */ -DEFINE_FIELD(thermal_equipment_id, String, ObisId(0, THERMAL_MBUS_ID, 96, 1, 0), StringField, 0, 96); + /* Equipment identifier (Thermal: heat or cold) */ + DEFINE_FIELD(thermal_equipment_id, String, ObisId(0, THERMAL_MBUS_ID, 96, 1, 0), StringField, 0, 96); -/* Valve position (on/off/released) (Note: Removed in 4.0.7 / 4.2.2 / 5.0). */ -DEFINE_FIELD(thermal_valve_position, uint8_t, ObisId(0, THERMAL_MBUS_ID, 24, 4, 0), IntField, units::none); + /* Valve position (on/off/released) (Note: Removed in 4.0.7 / 4.2.2 / 5.0). */ + DEFINE_FIELD(thermal_valve_position, uint8_t, ObisId(0, THERMAL_MBUS_ID, 24, 4, 0), IntField, units::none); -/* Last 5-minute Meter reading Heat or Cold in 0,01 GJ and capture time + /* Last 5-minute Meter reading Heat or Cold in 0,01 GJ and capture time * (Note: 4.x spec has "hourly meter reading") */ -DEFINE_FIELD(thermal_delivered, TimestampedFixedValue, ObisId(0, THERMAL_MBUS_ID, 24, 2, 1), TimestampedFixedField, units::GJ, units::MJ); - + DEFINE_FIELD(thermal_delivered, TimestampedFixedValue, ObisId(0, THERMAL_MBUS_ID, 24, 2, 1), TimestampedFixedField, + units::GJ, units::MJ); -/* Device-Type */ -DEFINE_FIELD(water_device_type, uint16_t, ObisId(0, WATER_MBUS_ID, 24, 1, 0), IntField, units::none); + /* Device-Type */ + DEFINE_FIELD(water_device_type, uint16_t, ObisId(0, WATER_MBUS_ID, 24, 1, 0), IntField, units::none); -/* Equipment identifier (Thermal: heat or cold) */ -DEFINE_FIELD(water_equipment_id, String, ObisId(0, WATER_MBUS_ID, 96, 1, 0), StringField, 0, 96); + /* Equipment identifier (Thermal: heat or cold) */ + DEFINE_FIELD(water_equipment_id, String, ObisId(0, WATER_MBUS_ID, 96, 1, 0), StringField, 0, 96); -/* Valve position (on/off/released) (Note: Removed in 4.0.7 / 4.2.2 / 5.0). */ -DEFINE_FIELD(water_valve_position, uint8_t, ObisId(0, WATER_MBUS_ID, 24, 4, 0), IntField, units::none); + /* Valve position (on/off/released) (Note: Removed in 4.0.7 / 4.2.2 / 5.0). */ + DEFINE_FIELD(water_valve_position, uint8_t, ObisId(0, WATER_MBUS_ID, 24, 4, 0), IntField, units::none); -/* Last 5-minute Meter reading in 0,001 m3 and capture time + /* Last 5-minute Meter reading in 0,001 m3 and capture time * (Note: 4.x spec has "hourly meter reading") */ -DEFINE_FIELD(water_delivered, TimestampedFixedValue, ObisId(0, WATER_MBUS_ID, 24, 2, 1), TimestampedFixedField, units::m3, units::dm3); + DEFINE_FIELD(water_delivered, TimestampedFixedValue, ObisId(0, WATER_MBUS_ID, 24, 2, 1), TimestampedFixedField, + units::m3, units::dm3); + /* Device-Type */ + DEFINE_FIELD(sub_device_type, uint16_t, ObisId(0, SUB_MBUS_ID, 24, 1, 0), IntField, units::none); -/* Device-Type */ -DEFINE_FIELD(slave_device_type, uint16_t, ObisId(0, SLAVE_MBUS_ID, 24, 1, 0), IntField, units::none); + /* Equipment identifier (Thermal: heat or cold) */ + DEFINE_FIELD(sub_equipment_id, String, ObisId(0, SUB_MBUS_ID, 96, 1, 0), StringField, 0, 96); -/* Equipment identifier (Thermal: heat or cold) */ -DEFINE_FIELD(slave_equipment_id, String, ObisId(0, SLAVE_MBUS_ID, 96, 1, 0), StringField, 0, 96); + /* Valve position (on/off/released) (Note: Removed in 4.0.7 / 4.2.2 / 5.0). */ + DEFINE_FIELD(sub_valve_position, uint8_t, ObisId(0, SUB_MBUS_ID, 24, 4, 0), IntField, units::none); -/* Valve position (on/off/released) (Note: Removed in 4.0.7 / 4.2.2 / 5.0). */ -DEFINE_FIELD(slave_valve_position, uint8_t, ObisId(0, SLAVE_MBUS_ID, 24, 4, 0), IntField, units::none); - -/* Last 5-minute Meter reading Heat or Cold and capture time (e.g. slave + /* Last 5-minute Meter reading Heat or Cold and capture time (e.g. sub * E meter) (Note: 4.x spec has "hourly meter reading") */ -DEFINE_FIELD(slave_delivered, TimestampedFixedValue, ObisId(0, SLAVE_MBUS_ID, 24, 2, 1), TimestampedFixedField, units::m3, units::dm3); + DEFINE_FIELD(sub_delivered, TimestampedFixedValue, ObisId(0, SUB_MBUS_ID, 24, 2, 1), TimestampedFixedField, + units::m3, units::dm3); -} // namespace fields -} // namespace dsmr + } // namespace fields -#endif // DSMR_INCLUDE_FIELDS_H +} // namespace dsmr diff --git a/components/dsmr/sensor.py b/components/dsmr/sensor.py index 81cb207..7d02e28 100644 --- a/components/dsmr/sensor.py +++ b/components/dsmr/sensor.py @@ -2,201 +2,342 @@ import esphome.config_validation as cv from esphome.components import sensor from esphome.const import ( + CONF_ID, DEVICE_CLASS_CURRENT, - DEVICE_CLASS_EMPTY, DEVICE_CLASS_ENERGY, + DEVICE_CLASS_GAS, DEVICE_CLASS_POWER, DEVICE_CLASS_VOLTAGE, - ICON_EMPTY, - LAST_RESET_TYPE_NEVER, + ICON_CURRENT_AC, STATE_CLASS_MEASUREMENT, - STATE_CLASS_NONE, + STATE_CLASS_TOTAL_INCREASING, UNIT_AMPERE, - UNIT_EMPTY, + UNIT_CUBIC_METER, + UNIT_KILOWATT, + UNIT_KILOWATT_HOURS, + UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, + UNIT_KILOVOLT_AMPS_REACTIVE, UNIT_VOLT, - UNIT_WATT_HOURS, - UNIT_WATT, + UNIT_HERTZ, + UNIT_EMPTY, ) -from . import DSMR, CONF_DSMR_ID +from . import Dsmr, CONF_DSMR_ID AUTO_LOAD = ["dsmr"] CONFIG_SCHEMA = cv.Schema( { - cv.GenerateID(CONF_DSMR_ID): cv.use_id(DSMR), - cv.Optional("energy_delivered_lux"): sensor.sensor_schema( - "kWh", - ICON_EMPTY, - 3, - DEVICE_CLASS_ENERGY, - STATE_CLASS_MEASUREMENT, - LAST_RESET_TYPE_NEVER, + cv.GenerateID(CONF_DSMR_ID): cv.use_id(Dsmr), + cv.Optional("energy_delivered"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOWATT_HOURS, + accuracy_decimals=2, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_TOTAL_INCREASING, ), cv.Optional("energy_delivered_tariff1"): sensor.sensor_schema( - "kWh", - ICON_EMPTY, - 3, - DEVICE_CLASS_ENERGY, - STATE_CLASS_MEASUREMENT, - LAST_RESET_TYPE_NEVER + unit_of_measurement=UNIT_KILOWATT_HOURS, + accuracy_decimals=2, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_TOTAL_INCREASING, ), cv.Optional("energy_delivered_tariff2"): sensor.sensor_schema( - "kWh", - ICON_EMPTY, - 3, - DEVICE_CLASS_ENERGY, - STATE_CLASS_MEASUREMENT, - LAST_RESET_TYPE_NEVER, - ), - cv.Optional("energy_returned_lux"): sensor.sensor_schema( - "kWh", - ICON_EMPTY, - 3, - DEVICE_CLASS_ENERGY, - STATE_CLASS_MEASUREMENT, - LAST_RESET_TYPE_NEVER, + unit_of_measurement=UNIT_KILOWATT_HOURS, + accuracy_decimals=2, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_TOTAL_INCREASING, + ), + cv.Optional("energy_returned"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOWATT_HOURS, + accuracy_decimals=2, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_TOTAL_INCREASING, ), cv.Optional("energy_returned_tariff1"): sensor.sensor_schema( - "kWh", - ICON_EMPTY, - 3, - DEVICE_CLASS_ENERGY, - STATE_CLASS_MEASUREMENT, - LAST_RESET_TYPE_NEVER, + unit_of_measurement=UNIT_KILOWATT_HOURS, + accuracy_decimals=2, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_TOTAL_INCREASING, ), cv.Optional("energy_returned_tariff2"): sensor.sensor_schema( - "kWh", - ICON_EMPTY, - 3, - DEVICE_CLASS_ENERGY, - STATE_CLASS_MEASUREMENT, - LAST_RESET_TYPE_NEVER, + unit_of_measurement=UNIT_KILOWATT_HOURS, + accuracy_decimals=2, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_TOTAL_INCREASING, + ), + cv.Optional("energy_absolute"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOWATT_HOURS, + accuracy_decimals=2, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_TOTAL_INCREASING, ), cv.Optional("total_imported_energy"): sensor.sensor_schema( - "kvarh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_NONE + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, + accuracy_decimals=2, ), cv.Optional("total_exported_energy"): sensor.sensor_schema( - "kvarh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_NONE + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, + accuracy_decimals=2, + ), + cv.Optional("electricity_tariff"): sensor.sensor_schema( + accuracy_decimals=0, ), cv.Optional("power_delivered"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOWATT, + accuracy_decimals=3, + device_class=DEVICE_CLASS_POWER, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("power_returned"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOWATT, + accuracy_decimals=3, + device_class=DEVICE_CLASS_POWER, + state_class=STATE_CLASS_MEASUREMENT, + ), + + cv.Optional("reactive_power_qi"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + device_class=DEVICE_CLASS_POWER, + state_class=STATE_CLASS_MEASUREMENT, + ), + cv.Optional("reactive_power_qii"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + device_class=DEVICE_CLASS_POWER, + state_class=STATE_CLASS_MEASUREMENT, + ), + cv.Optional("reactive_power_qiii"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + device_class=DEVICE_CLASS_POWER, + state_class=STATE_CLASS_MEASUREMENT, + ), + cv.Optional("reactive_power_qiv"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + device_class=DEVICE_CLASS_POWER, + state_class=STATE_CLASS_MEASUREMENT, + ), + + cv.Optional("reactive_energy_qi"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, + accuracy_decimals=3, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_MEASUREMENT, + ), + cv.Optional("reactive_energy_qii"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, + accuracy_decimals=3, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_MEASUREMENT, + ), + cv.Optional("reactive_energy_qiii"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, + accuracy_decimals=3, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_MEASUREMENT, + ), + cv.Optional("reactive_energy_qiv"): sensor.sensor_schema( + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, + accuracy_decimals=3, + device_class=DEVICE_CLASS_ENERGY, + state_class=STATE_CLASS_MEASUREMENT, + ), + + cv.Optional("instantaneous_power_factor"): sensor.sensor_schema( + accuracy_decimals=2, + unit_of_measurement=UNIT_EMPTY, + + + ), + cv.Optional("instantaneous_power_factor_l1"): sensor.sensor_schema( + accuracy_decimals=2, + unit_of_measurement=UNIT_EMPTY, + ), + cv.Optional("instantaneous_power_factor_l2"): sensor.sensor_schema( + accuracy_decimals=2, + unit_of_measurement=UNIT_EMPTY, + ), + cv.Optional("instantaneous_power_factor_l3"): sensor.sensor_schema( + accuracy_decimals=2, + unit_of_measurement=UNIT_EMPTY, ), + + cv.Optional("frequency"): sensor.sensor_schema( + unit_of_measurement=UNIT_HERTZ, + icon=ICON_CURRENT_AC, + accuracy_decimals=2, + ), + + # cv.Optional("absolute_active_energy"): sensor.sensor_schema( + # UNIT_KILOWATT_HOURS, ICON_EMPTY, 1, DEVICE_CLASS_ENERGY, STATE_CLASS_MEASUREMENT + # ), + cv.Optional("reactive_power_delivered"): sensor.sensor_schema( - "kvar", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_NONE + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + device_class=DEVICE_CLASS_POWER, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("reactive_power_returned"): sensor.sensor_schema( - "kvar", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + device_class=DEVICE_CLASS_POWER, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("electricity_threshold"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 3, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE + unit_of_measurement=UNIT_KILOWATT, + accuracy_decimals=3, + device_class=DEVICE_CLASS_POWER, ), cv.Optional("electricity_switch_position"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 3, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE + accuracy_decimals=3, ), cv.Optional("electricity_failures"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE + accuracy_decimals=0, ), cv.Optional("electricity_long_failures"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE + accuracy_decimals=0, ), cv.Optional("electricity_sags_l1"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE + accuracy_decimals=0, ), cv.Optional("electricity_sags_l2"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_MEASUREMENT + accuracy_decimals=0, ), cv.Optional("electricity_sags_l3"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE + accuracy_decimals=0, ), cv.Optional("electricity_swells_l1"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_MEASUREMENT + accuracy_decimals=0, ), cv.Optional("electricity_swells_l2"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE + accuracy_decimals=0, ), cv.Optional("electricity_swells_l3"): sensor.sensor_schema( - UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE + accuracy_decimals=0, ), cv.Optional("current_l1"): sensor.sensor_schema( - UNIT_AMPERE, ICON_EMPTY, 1, DEVICE_CLASS_CURRENT, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_AMPERE, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("current_l2"): sensor.sensor_schema( - UNIT_AMPERE, ICON_EMPTY, 1, DEVICE_CLASS_CURRENT, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_AMPERE, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("current_l3"): sensor.sensor_schema( - UNIT_AMPERE, ICON_EMPTY, 1, DEVICE_CLASS_CURRENT, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_AMPERE, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("power_delivered_l1"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOWATT, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("power_delivered_l2"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOWATT, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("power_delivered_l3"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOWATT, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("power_returned_l1"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOWATT, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("power_returned_l2"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOWATT, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("power_returned_l3"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOWATT, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("reactive_power_delivered_l1"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("reactive_power_delivered_l2"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("reactive_power_delivered_l3"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("reactive_power_returned_l1"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("reactive_power_returned_l2"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("reactive_power_returned_l3"): sensor.sensor_schema( - UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT + unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE, + accuracy_decimals=3, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("voltage_l1"): sensor.sensor_schema( - UNIT_VOLT, ICON_EMPTY, 1, DEVICE_CLASS_VOLTAGE, STATE_CLASS_NONE + unit_of_measurement=UNIT_VOLT, + accuracy_decimals=1, + device_class=DEVICE_CLASS_VOLTAGE, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("voltage_l2"): sensor.sensor_schema( - UNIT_VOLT, ICON_EMPTY, 1, DEVICE_CLASS_VOLTAGE, STATE_CLASS_NONE + unit_of_measurement=UNIT_VOLT, + accuracy_decimals=1, + device_class=DEVICE_CLASS_VOLTAGE, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("voltage_l3"): sensor.sensor_schema( - UNIT_VOLT, ICON_EMPTY, 1, DEVICE_CLASS_VOLTAGE, STATE_CLASS_NONE + unit_of_measurement=UNIT_VOLT, + accuracy_decimals=1, + device_class=DEVICE_CLASS_VOLTAGE, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional("gas_delivered"): sensor.sensor_schema( - "m³", - ICON_EMPTY, - 3, - DEVICE_CLASS_EMPTY, - STATE_CLASS_MEASUREMENT, - LAST_RESET_TYPE_NEVER, + unit_of_measurement=UNIT_CUBIC_METER, + accuracy_decimals=3, + device_class=DEVICE_CLASS_GAS, + state_class=STATE_CLASS_TOTAL_INCREASING, ), cv.Optional("gas_delivered_be"): sensor.sensor_schema( - "m³", - ICON_EMPTY, - 3, - DEVICE_CLASS_EMPTY, - STATE_CLASS_MEASUREMENT, - LAST_RESET_TYPE_NEVER + unit_of_measurement=UNIT_CUBIC_METER, + accuracy_decimals=3, + device_class=DEVICE_CLASS_GAS, + state_class=STATE_CLASS_TOTAL_INCREASING, ), } ).extend(cv.COMPONENT_SCHEMA) -def to_code(config): - hub = yield cg.get_variable(config[CONF_DSMR_ID]) +async def to_code(config): + hub = await cg.get_variable(config[CONF_DSMR_ID]) sensors = [] for key, conf in config.items(): @@ -204,8 +345,11 @@ def to_code(config): continue id = conf.get("id") if id and id.type == sensor.Sensor: - s = yield sensor.new_sensor(conf) + s = await sensor.new_sensor(conf) cg.add(getattr(hub, f"set_{key}")(s)) sensors.append(f"F({key})") - cg.add_define("DSMR_SENSOR_LIST(F, sep)", cg.RawExpression(" sep ".join(sensors))) + if sensors: + cg.add_define( + "DSMR_SENSOR_LIST(F, sep)", cg.RawExpression(" sep ".join(sensors)) + ) diff --git a/config_reszlet-yaml b/config_reszlet-yaml new file mode 100644 index 0000000..6cb6ee3 --- /dev/null +++ b/config_reszlet-yaml @@ -0,0 +1,141 @@ +uart: + rx_pin: D7 + baud_rate: 115200 + rx_buffer_size: 3000 + # debug: + # direction: RX + # after: + # delimiter: "\r\n" + # sequence: + # - lambda: UARTDebug::log_string(direction, bytes); + +dsmr: + id: dsmr_instance + crc_check: false + max_telegram_length: 3000 + receive_timeout: 200ms + +captive_portal: + +sensor: + - platform: dsmr + energy_delivered: + name: "Hatásos import energia (+A)" + energy_delivered_tariff1: + name: "Hatásos import energia (+A) tarifa 1" + energy_delivered_tariff2: + name: "Hatásos import energia (+A) tarifa 2" + + power_delivered: + name: "Pillanatnyi import teljesítmény (+A)" + accuracy_decimals: 3 + + electricity_tariff: + name: "Aktuális tarifa" + frequency: + name: "Frekvencia" + energy_absolute: + name: "${device_friendly_name} Absolute active energy" + + voltage_l1: + name: "Pillanatnyi fázis feszültség L1" + voltage_l2: + name: "Pillanatnyi fázis feszültség L2" + voltage_l3: + name: "Pillanatnyi fázis feszültség L3" + current_l1: + name: "Pillanatnyi áram L1" + accuracy_decimals: 3 + current_l2: + name: "Pillanatnyi áram L2" + accuracy_decimals: 3 + current_l3: + name: "Pillanatnyi áram L3" + accuracy_decimals: 3 + + instantaneous_power_factor: + name: "Pillanatnyi teljesítmény tényező" + device_class: power_factor + instantaneous_power_factor_l1: + name: "Pillanatnyi teljesítmény tényező L1" + device_class: power_factor + instantaneous_power_factor_l2: + name: "Pillanatnyi teljesítmény tényező L2" + device_class: power_factor + instantaneous_power_factor_l3: + name: "Pillanatnyi teljesítmény tényező L3" + device_class: power_factor + + reactive_power_qi: + name: "Pillanatnyi meddő teljesítmény (QI)" + device_class: reactive_power + + # Napelemnél értelmezhető (vesz) + #reactive_power_qii: + # name: "Pillanatnyi meddő teljesítmény (QII)" + # device_class: reactive_power + + # Napelemnél értelmezhető (vesz) + #reactive_power_qiii: + # name: "Pillanatnyi meddő teljesítmény (QIII)" + # device_class: reactive_power + + + reactive_power_qiv: + name: "Pillanatnyi meddő teljesítmény (QIV)" + + + reactive_power_delivered: + name: "Import meddő energia (+R)" + + + reactive_energy_qi: + name: "Meddő energia (QI)" + + # Napelemnél értelmezhető (vesz) + #reactive_energy_qii: + # name: "Meddő energia (QII)" + + # Napelemnél értelmezhető (vesz) + #reactive_energy_qiii: + # name: "Meddő energia (QIII)" + + reactive_energy_qiv: + name: "Meddő energia (QIV)" + + #Előrefizetős óráknál értelmezhető csak, nincs értelme egyébként használni + #electricity_threshold: + # name: "Limiter határérték" + + + + - platform: uptime + name: "SlimmeLezer Üzemidő" + device_class: duration + - platform: wifi_signal + name: "SlimmeLezer Wi-Fi jel" + update_interval: 60s + +text_sensor: + - platform: wifi_info + ip_address: + name: "SlimmeLezer IP" + update_interval: 60s + ssid: + name: "SlimmeLezer Wi-Fi SSID" + update_interval: 60s + bssid: + name: "SlimmeLezer Wi-Fi BSSID" + update_interval: 60s + + - platform: dsmr + #identification: + # name: "COSEM logikai készüléknév" + #equipment_id: + # name: "Mérő gyáriszám" + breaker_status: + name: "Megszakító státusz" + + - platform: version + name: "ESPHome verzió és build" + hide_timestamp: false diff --git a/pre-compiled/slimmelezer-v2022.10.1.bin b/pre-compiled/slimmelezer-v2022.10.1.bin deleted file mode 100644 index 038c201..0000000 Binary files a/pre-compiled/slimmelezer-v2022.10.1.bin and /dev/null differ diff --git a/pre-compiled/slimmelezer-v2022.11.3.bin b/pre-compiled/slimmelezer-v2022.11.3.bin deleted file mode 100644 index 8a12548..0000000 Binary files a/pre-compiled/slimmelezer-v2022.11.3.bin and /dev/null differ diff --git a/pre-compiled/slimmelezer-v2022.11.4.bin b/pre-compiled/slimmelezer-v2022.11.4.bin deleted file mode 100644 index 33e55d8..0000000 Binary files a/pre-compiled/slimmelezer-v2022.11.4.bin and /dev/null differ diff --git a/pre-compiled/slimmelezer-v2022.11.5.bin b/pre-compiled/slimmelezer-v2022.11.5.bin deleted file mode 100644 index b75746e..0000000 Binary files a/pre-compiled/slimmelezer-v2022.11.5.bin and /dev/null differ diff --git a/pre-compiled/slimmelezer-v2022.12.1.bin b/pre-compiled/slimmelezer-v2022.12.1.bin deleted file mode 100644 index 2a7b0dd..0000000 Binary files a/pre-compiled/slimmelezer-v2022.12.1.bin and /dev/null differ diff --git a/pre-compiled/slimmelezer-v2022.12.3.bin b/pre-compiled/slimmelezer-v2022.12.3.bin deleted file mode 100644 index 7816356..0000000 Binary files a/pre-compiled/slimmelezer-v2022.12.3.bin and /dev/null differ diff --git a/pre-compiled/slimmelezer-v2022.12.8.bin b/pre-compiled/slimmelezer-v2022.12.8.bin deleted file mode 100644 index f0a1d4c..0000000 Binary files a/pre-compiled/slimmelezer-v2022.12.8.bin and /dev/null differ diff --git a/slimmelezer.yaml b/slimmelezer.yaml index 8077bd6..331ac7f 100644 --- a/slimmelezer.yaml +++ b/slimmelezer.yaml @@ -67,10 +67,6 @@ dashboard_import: web_server: port: 80 -uart: - baud_rate: 115200 - rx_pin: D7 - rx_buffer_size: 1700 globals: - id: has_key @@ -81,93 +77,144 @@ globals: type: char[32] restore_value: yes +uart: + rx_pin: D7 + baud_rate: 115200 + rx_buffer_size: 3000 + # debug: + # direction: RX + # after: + # delimiter: "\r\n" + # sequence: + # - lambda: UARTDebug::log_string(direction, bytes); + dsmr: id: dsmr_instance - max_telegram_length: 1700 - # For Luxembourg users set here your decryption key - #decryption_key: !secret decryption_key // enable this when using decryption for Luxembourg; key like '00112233445566778899AABBCCDDEEFF' + crc_check: false + max_telegram_length: 3000 + receive_timeout: 200ms + +captive_portal: sensor: - platform: dsmr - energy_delivered_lux: - name: "Energy Consumed Luxembourg" + energy_delivered: + name: "Hatásos import energia (+A)" energy_delivered_tariff1: - name: "Energy Consumed Tariff 1" + name: "Hatásos import energia (+A) tarifa 1" energy_delivered_tariff2: - name: "Energy Consumed Tariff 2" - energy_returned_lux: - name: "Energy Produced Luxembourg" - energy_returned_tariff1: - name: "Energy Produced Tariff 1" - energy_returned_tariff2: - name: "Energy Produced Tariff 2" + name: "Hatásos import energia (+A) tarifa 2" + power_delivered: - name: "Power Consumed" - accuracy_decimals: 3 - power_returned: - name: "Power Produced" + name: "Pillanatnyi import teljesítmény (+A)" accuracy_decimals: 3 - electricity_failures: - name: "Electricity Failures" - icon: mdi:alert - electricity_long_failures: - name: "Long Electricity Failures" - icon: mdi:alert + + electricity_tariff: + name: "Aktuális tarifa" + frequency: + name: "Frekvencia" + energy_absolute: + name: "${device_friendly_name} Absolute active energy" + voltage_l1: - name: "Voltage Phase 1" + name: "Pillanatnyi fázis feszültség L1" voltage_l2: - name: "Voltage Phase 2" + name: "Pillanatnyi fázis feszültség L2" voltage_l3: - name: "Voltage Phase 3" + name: "Pillanatnyi fázis feszültség L3" current_l1: - name: "Current Phase 1" - current_l2: - name: "Current Phase 2" - current_l3: - name: "Current Phase 3" - power_delivered_l1: - name: "Power Consumed Phase 1" - accuracy_decimals: 3 - power_delivered_l2: - name: "Power Consumed Phase 2" + name: "Pillanatnyi áram L1" accuracy_decimals: 3 - power_delivered_l3: - name: "Power Consumed Phase 3" - accuracy_decimals: 3 - power_returned_l1: - name: "Power Produced Phase 1" - accuracy_decimals: 3 - power_returned_l2: - name: "Power Produced Phase 2" + current_l2: + name: "Pillanatnyi áram L2" accuracy_decimals: 3 - power_returned_l3: - name: "Power Produced Phase 3" + current_l3: + name: "Pillanatnyi áram L3" accuracy_decimals: 3 - gas_delivered: - name: "Gas Consumed" - gas_delivered_be: - name: "Gas Consumed Belgium" + + instantaneous_power_factor: + name: "Pillanatnyi teljesítmény tényező" + device_class: power_factor + instantaneous_power_factor_l1: + name: "Pillanatnyi teljesítmény tényező L1" + device_class: power_factor + instantaneous_power_factor_l2: + name: "Pillanatnyi teljesítmény tényező L2" + device_class: power_factor + instantaneous_power_factor_l3: + name: "Pillanatnyi teljesítmény tényező L3" + device_class: power_factor + + reactive_power_qi: + name: "Pillanatnyi meddő teljesítmény (QI)" + device_class: reactive_power + + # Napelemnél értelmezhető (vesz) + #reactive_power_qii: + # name: "Pillanatnyi meddő teljesítmény (QII)" + # device_class: reactive_power + + # Napelemnél értelmezhető (vesz) + #reactive_power_qiii: + # name: "Pillanatnyi meddő teljesítmény (QIII)" + # device_class: reactive_power + + + reactive_power_qiv: + name: "Pillanatnyi meddő teljesítmény (QIV)" + + + reactive_power_delivered: + name: "Import meddő energia (+R)" + + + reactive_energy_qi: + name: "Meddő energia (QI)" + + # Napelemnél értelmezhető (vesz) + #reactive_energy_qii: + # name: "Meddő energia (QII)" + + # Napelemnél értelmezhető (vesz) + #reactive_energy_qiii: + # name: "Meddő energia (QIII)" + + reactive_energy_qiv: + name: "Meddő energia (QIV)" + + #Előrefizetős óráknál értelmezhető csak, nincs értelme egyébként használni + #electricity_threshold: + # name: "Limiter határérték" + + + - platform: uptime - name: "SlimmeLezer Uptime" + name: "SlimmeLezer Üzemidő" + device_class: duration - platform: wifi_signal - name: "SlimmeLezer Wi-Fi Signal" + name: "SlimmeLezer Wi-Fi jel" update_interval: 60s text_sensor: - - platform: dsmr - identification: - name: "DSMR Identification" - p1_version: - name: "DSMR Version" - p1_version_be: - name: "DSMR Version Belgium" - platform: wifi_info ip_address: - name: "SlimmeLezer IP Address" + name: "SlimmeLezer IP" + update_interval: 60s ssid: name: "SlimmeLezer Wi-Fi SSID" + update_interval: 60s bssid: name: "SlimmeLezer Wi-Fi BSSID" + update_interval: 60s + + - platform: dsmr + #identification: + # name: "COSEM logikai készüléknév" + #equipment_id: + # name: "Mérő gyáriszám" + breaker_status: + name: "Megszakító státusz" + - platform: version - name: "ESPHome Version" - hide_timestamp: true + name: "ESPHome verzió és build" + hide_timestamp: false