michbeck100/pimatic-hap

pimatic-log-reader integration

hg-smart opened this issue · 5 comments

hello i am using pimatic-logreader to read the temperature from an external sensor (logfile)

pimatic-log-reader

 {
      "plugin": "log-reader"
 },
{
      "id": "temperature-from-logfile-bad-h1",
      "name": "Bad Temperatur",
      "class": "LogWatcher",
      "file": "/home/pi/log/aa_t.log",
      "attributes": [
        {
          "name": "temperature",
          "type": "number",
          "unit": "°C"
        }
      ],
      "lines": [
        {
          "match": "temperature: (.+)",
          "temperature": "$1"
        }
      ]
    },

Is it possible to integrate this into pimatic-hap ?
Could you give me any hints where to pay attention, please.

Thx in advance
hans

I'll have a look. Generally just 'real' temperature sensors are currently supported.

cool, for testing you could simple create a file with the follwing contents, thx a lot
hans

pi@raspberrypi:~ $ cat /home/pi/log/aa_t.log
temperature: 20.9

I'm sorry but the log-reader plugin is too "flexible" to integrate it into pimatic-hap. pimatic-hap relies on well-defined interfaces (although well-defined is an elastic term in the JavaScript world).

I'm reopening this, since the implementation will be the same as for #51

da2c11e implements a new generic sensor that currently supports temperature and humidity. Note that these attributes are case sensitive. I did test with the same device example you provided. The new sensor will be included in the next release.