Sections/Rows Functions
ESP.updateRow
Updates the contents of a row in app.
Syntax:
ESP.updateRow(page_id, row_id, property, value)
- page_id is the id of the page that you defined in esphome.app website. First page ID is always “default”.
- row_id is the id of the row that you defined in esphome.app website.
- property is the property of the row that you need to update.
- value is the value that will be set for that property.
This function does not return any value.
Example:
Assume you have a row with my_status_row as ID and type of “Key Value”, first line changes the key part and second line updates the value.
ESP.updateRow("default", "my_status_row", "key", "Device Status")
ESP.updateRow("default", "my_status_row", "value", "ALL OK")
ESP.getRowValue
Get property values of a row.
Syntax:
ESP.getRowValue(page_id, row_id, property)
- page_id is the id of the page that you defined in esphome.app website. First page ID is always “default”.
- row_id is the id of the row that you defined in esphome.app website.
- property is the property of the row that you need the value of.
This function returns the value of the requested property.
ESP.onValueChanged
Get notified if value of the row changed by user. Basically this is used for rows with editable controls like “Key Value Picker”.
Syntax:
ESP.onValueChanged(page_id, row_id, callback)
- page_id is the id of the page that you defined in esphome.app website. First page ID is always “default”.
- row_id is the id of the row that you defined in esphome.app website.
- callback is the function that will be called when value of a row changed. General form of the callback function is
function(newValue, page_id, row_id){}
where newValue is the new value of the row.
Example:
ESP.onValueChanged('my_picker_row', function(newValue){
changeOperationMode(newValue);
});
ESP.onRowClicked
Get notified when a row clicked.
Syntax:
ESP.onRowClicked(page_id, row_id, callback)
- page_id is the id of the page that you defined in esphome.app website. First page ID is always “default”.
- row_id is the id of the row that you defined in esphome.app website.
- callback is the function that will be called when user tapped on the row. General form of the callback function is
function(page_id, row_id){}
.
Example:
ESP.onRowClicked('my_clickable_row', function(){
doSomething();
});
ESP.saveDataToRow
Saves string based custom data to a row.
Syntax:
ESP.saveDataToRow(page_id, row_id, key, data)
- page_id is the id of the page that you defined in esphome.app website. First page ID is always “default”.
- row_id is the id of the row that you defined in esphome.app website.
- key is the key of the data that you would like to save. You can use this key to retrieve the data later.
- data is the string that you are going to save.
This function does not return any value.
ESP.loadDataFromRow
Loads a previously saved custom string data from a row.
Syntax:
ESP.loadDataFromRow(page_id, row_id, key)
- page_id is the id of the page that you defined in esphome.app website. First page ID is always “default”.
- row_id is the id of the row that you defined in esphome.app website.
- key is the key of the data that you would like to save. You can use this key to retrieve the data later.
This function returns the saved data under key or null if no data saved.