History DB table read

<< Click to Display Table of Contents >>

Navigation:  MQTT API >

History DB table read

Previous pageReturn to chapter overview

To read history data from History DB table through TeslaCloud you have to use key word - teslascadahistorydbtable in the topic. Value contains in JSON format:

{

 historydbname: {tablename},

 begindate: {begin},

 enddate: {end},

 decimalpos: {decimalpos},

 orderby: {orderby},

 type: {type},

 timeformat: {timeformat}

}

Where:

{tablename} - Name of History DB.

{tagname} - Name of the tag you want to read history information.

{begin} - Begin time period in milliseconds since 1970 year.

{end} - End time period in milliseconds since 1970 year.

{decimalpos} - Decimal position for the values displayed in History table.

{orderby} - Order by of the table's values.

{type} - Display date and time in the same column or not.

{timeformat} - Format of the date and time column encoded by Base64 without padding.

 

History values will be returned in JSON format:

{

 id: {id},

 date: {date},

 time: {time},

 ingredients: {

         {ingredientname}:{value},

         {ingredientname}:{value}

         ...............................................

 }

}

Where:

{id} - ID of the row

{date} - Date of the table's row

{time} - Time of the table's row

{ingredients} - Ingredients of the History DB table, that contains name of the ingredient and value.

 

Example:

Topic: teslascadahistorydbtable

Value: {"historydbname":"HistoryDB0", "begindate":1, "enddate":1688373780250, "decimalpos":1, "orderby":1, "type":0, "timeformat":"SEg6bW0="}

 

RESPONSE:

Value: {"id":0, "date":"2023-07-03", "time":"12:42:46", "ingredients":{"temperature":"24.5", "humidity":"45"}}