I was wondering the best table structure to store the JSON data and how to UPDATE the table.
Proposed Table Structure:
CREATE TABLE `tn_001` (
`id` int(8) NOT NULL,
`battery` int(8) NOT NULL,
`device_id` varchar(12) NOT NULL,
`humidity` int(4) NOT NULL,
`raw` varchar(12) NOT NULL,
`temperature` decimal(10,0) NOT NULL,
`time` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
The JSON data is then transmitted to a designated server.
The time will be unique and also used as a SVG Chart coordinate.
@m_hutley
As far as efficiency of table… are we talking about table size? speed? information value?
The JSON parameters are strings and need to be converted at some stage to integers or floats for the SVG Chart. I was hoping to make the resultant SVG Chart render as soon as possible by minimising conversion bottlenecks.
@m_hutley
is there some place that stores the device data? Is that being joined to this table to make queries?
As far as I understand the LoraWan IOT Device only measures and transmits data to a LoraWan Gateway… where it is passed to a designated client server. I am in the process of gathering the data into a database table where it will be queried to produce SVG Charts. Also later to detect temperatures, etc outside a specified range and notify clients by email or SMS.