Skip to content

Add Support for Temperature and Humidity Sensors + New Config File Format

Bendodroid requested to merge Bendodroid-envSensors into main

This MR adds support for the sensors/temperature and sensors/humidity fields. Also changes the config file format to include the sensor configuration and a new 3-part structure:

{
  // Configure credentials
  "credentials": {
    "home-assistant": {
      "username": "home-assistant",
      "password": "hamiau"
    },
    "dooris-hauptraum": {
      "username": "dooris-hauptraum",
      "password": "doorimiau"
    }
  },
  // Dynamic inputs
  "dynamic": {
    "sensors": {
      "temperature": [
        {
          "sensor_data": {
            "unit": "C",
            "location": "Hauptraum",
            "name": "Kueche",
            "description": "Sensor im Ofen"
          },
          "allowed_credentials": [
            "home-assistant"
          ]
        }
      ],
      "humidity": [
        // Same here
      ]
    },
    "state": {
      "open": {
        "allowed_credentials": [
          "dooris-hauptraum"
        ]
      }
    }
  },
  // Static parts
  "response": {
     "api_compatibility": [
      "14"
    ],
    // ...
  }
}

Fixes #6 (closed)

TODOs:

  • Handle Temperature and Humidity sensors
    • Parse dynamic config
    • Generate HTTP endpoints
    • Write to response
    • Save to persistent state
    • Merge old state
Edited by Bendodroid

Merge request reports