from datetime import timedelta

from data_gateway_sdk.protocols.smpm.smpm_ul_device_energy_16b_daily import SmpmUlDeviceEnergy16BDailyData
from data_gateway_sdk.utils.buf_ref import BufRef


def test_smpm_ul_device_energy_16b_daily() -> None:
    case_serialized = bytes.fromhex("bbaaaaae545f55aaaa2abbaa6a80160b")
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=1430869, energy_consumed_reactive=1398741, energy_generated_active=1398101, energy_generated_reactive=6990523, days_ago=timedelta(seconds=0.0), valid=False, error_measurement=True, error_low_voltage=False, error_internal_clock=True, error_flash=True, error_eeprom=False, error_radio=True, error_display=False, error_plc=False, error_reset=False, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=False, impact_body_tamper=True, impact_radio=False) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=1430869, energy_consumed_reactive=1398741, energy_generated_active=1398101, energy_generated_reactive=6990523, days_ago=timedelta(seconds=0.0), valid=False, error_measurement=True, error_low_voltage=False, error_internal_clock=True, error_flash=True, error_eeprom=False, error_radio=True, error_display=False, error_plc=False, error_reset=False, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=False, impact_body_tamper=True, impact_radio=False))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=16777216, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=16777216, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=0, energy_consumed_reactive=16777216, energy_generated_active=0, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=0, energy_consumed_reactive=16777216, energy_generated_active=0, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=0, energy_consumed_reactive=16777216, energy_generated_active=16777216, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=0, energy_consumed_reactive=16777216, energy_generated_active=16777216, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=16777216, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=16777216, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=16777216, energy_consumed_reactive=0, energy_generated_active=16777216, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=16777216, energy_consumed_reactive=0, energy_generated_active=16777216, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=16777216, energy_consumed_reactive=16777216, energy_generated_active=0, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=16777216, energy_consumed_reactive=16777216, energy_generated_active=0, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=16777216, energy_consumed_reactive=16777216, energy_generated_active=16777216, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000000c0ff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=0.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=0.0), energy_consumed_active=16777216, energy_consumed_reactive=16777216, energy_generated_active=16777216, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=16777216, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=16777216, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=0, energy_consumed_reactive=16777216, energy_generated_active=0, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=0, energy_consumed_reactive=16777216, energy_generated_active=0, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=0, energy_consumed_reactive=16777216, energy_generated_active=16777216, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=0, energy_consumed_reactive=16777216, energy_generated_active=16777216, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=16777216, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=16777216, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=16777216, energy_consumed_reactive=0, energy_generated_active=16777216, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=16777216, energy_consumed_reactive=0, energy_generated_active=16777216, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=16777216, energy_consumed_reactive=16777216, energy_generated_active=0, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=16777216, energy_consumed_reactive=16777216, energy_generated_active=0, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=16777216, energy_consumed_reactive=16777216, energy_generated_active=16777216, energy_generated_reactive=0, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
    case_serialized = bytes.fromhex("bb020000000000000000000080ffff1f")  # overflow
    assert SmpmUlDeviceEnergy16BDailyData(energy_consumed_active=0, energy_consumed_reactive=0, energy_generated_active=0, energy_generated_reactive=0, days_ago=timedelta(seconds=10972800.0), valid=True, error_measurement=True, error_low_voltage=True, error_internal_clock=True, error_flash=True, error_eeprom=True, error_radio=True, error_display=True, error_plc=True, error_reset=True, impact_power_lost=True, impact_magnet=True, impact_cleat_tamper=True, impact_body_tamper=True, impact_radio=True) == SmpmUlDeviceEnergy16BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceEnergy16BDailyData.serialize(SmpmUlDeviceEnergy16BDailyData(days_ago=timedelta(seconds=10972800.0), energy_consumed_active=16777216, energy_consumed_reactive=16777216, energy_generated_active=16777216, energy_generated_reactive=16777216, error_display=True, error_eeprom=True, error_flash=True, error_internal_clock=True, error_low_voltage=True, error_measurement=True, error_plc=True, error_radio=True, error_reset=True, impact_body_tamper=True, impact_cleat_tamper=True, impact_magnet=True, impact_power_lost=True, impact_radio=True, valid=True))  # noqa: E501
