get_write_frame
Tobias Müller, M. Eng edited this page 5 years ago

📜 Table of Contents


get_write_frame

Definition
def get_write_frame(self, object_id, property_data):
Description

The "get_write_frame" method is used to encode a byte-frame for a 'write'-instruction. It can only be used with a known Object_ID, otherwise it will raise a Value_Error. It returns a bytearray of the frame.

Arguments

The "self" argument is pointing to the object, which calls the method.

The "object_id" is a parameter number, whose value you want to change.

Parameter-Object_ID:

_para_maximum_current_of_ac_source    = 1107
_para_battery_charge_current          = 1138
_para_smart_boost_allowed             = 1126
_para_inverter_allowed                = 1124
_para_type_of_detection_of_grid_loss  = 1552
_para_charger_allowed                 = 1125
_para_charger_uses_only_power_from_ac = 1646
_para_ac_output_voltage               = 1286
_para_inverter_frequency              = 1112
_para_transfer_relay_allowed          = 1128
_para_limitation_of_the_power_boost   = 1607
_para_remote_entry_active             = 1545

The "property_data" is the value, you want to send.

Return Value

Type -> bytearray

Example Code
>>> # create an object of the Xcom-API-Class
>>> Object = Xcom_API()
>>> 
>>> # create a variable with a value for the Property_Data
>>> Data_in_Ampere = 32.0
>>> 
>>> # call the Method 'get_write_frame'
>>> Byte_Frame = Object.get_write_frame(Xcom_API._para_maximum_current_of_ac_source, Data_in_Ampere)
>>> 
>>> # print Byte_Frame
>>> print(Byte_Frame)
    bytearray(b'\\xAA\\x00\\x01\\x00\\x00\\x00\\x65\\x00\\x00\\x00\\x0E\\x00\\x73\\x79\\x00\\x02\\x02\\x00\\x53\\x04\\x00\\x00\\x05\\x00\\x00\\x00\\x00\\x42\\xA1\\xE6')

Hochschule Anhalt | Anhalt University of Applied Sciences | Special Field 6 EMW
Xcom-API

Tobias Müller, M. Eng.
📧 Tobias.Mueller@HS-Anhalt.de

© es-lab.de, 31.10.2017