Files
aqhomecontrol/aqhome/data
Martin Preuss 2c584bbff9 vars: use const in most api functions
The idea of not using const was to reduce copy operations.
However, it is not very intuitive to know when and which arguments are const
so to simplify working with this new module and make it as close as possible
to GWEN_DB we use const now as in GWEN_DB.
At least AQH_Vars_SetStringData() still doesn't use const so if the need
arises to avoid copying we can.
2024-05-09 14:56:46 +02:00
..
2023-08-14 02:00:37 +02:00
2024-05-09 14:56:46 +02:00
2024-05-09 14:56:46 +02:00

room:
- id
- name
- description
- colour


device
- id
- name
- room
- location
- description

mqtt-topic:
- id
- deviceId
- mqttTopic
- mqttDataType (num, json)


value:
- id
- topicId
- value type (temp, humidity, speed, door, length, width, counter, gauge)
- units
- dataPath (for JSON)




datapoint:
- value id
- timestamp
- value


lastDatapoint: (DB: no rollback, otherwise db would double in size)
- module id
- timestamp
- value



Processing MQTT publish messages:
- create data point
- set timestamp in data point
- find MQTT_TOPIC for topic string
  - mqttType:
    - num:
      - lookup first value
      - store data in data point
    - json: parse data
      - for every VALUE assigned to that topic:
        - store data in data point
- write data point to long term db
- write data point to lastValues db


Storage API:
- handleMqttPublish(AQH_STORAGE *st, const char *topic, const char *value)

- addDevice(AQH_STORAGE *st, AQH_DEVICE *dev)
- getDeviceList(const AQH_STORAGE *st)
- getDeviceById(const AQH_STORAGE *st, uint32_t id)

- addMqttTopic(AQH_STORAGE *st, AQH_MQTT_TOPIC *t);
- getMqttTopicList(const AQH_STORAGE *st)
- getMqttTopicById(const AQH_STORAGE *st, uint32_t id)
- getMqttTopicByTopic(const AQH_STORAGE *st, const char *topic)

- addValue(AQH_STORAGE *st, AQH_VALUE *value)
- getValueList(const AQH_STORAGE *st)
- getValueById(const AQH_STORAGE *st, uint32_t id)




datafile:
- valueId
- filename
- number of entries
- fd
- getNumOfEntries()
- readRecord(id, &record)
- addRecord(record)

datarecord in file:
- 8 bytes timestamp
- 8 bytes value