wutu / pimatic-mqtt

MQTT plugin for Pimatic
https://pimatic.org/plugins/pimatic-mqtt/
GNU Affero General Public License v3.0
9 stars 13 forks source link

accessing attributes yields entire JSON #16

Closed quantenschaum closed 7 years ago

quantenschaum commented 7 years ago

I configured a device like

{
   "class": "MqttSensor",
      "id": "location",
      "name": "location",
      "attributes": [
        {
          "name": "lat",
          "topic": "owntracks/xy/device",
          "type": "number",
          "unit": "°",
          "acronym": "latitude"
        },
        {
          "name": "lon",
          "topic": "owntracks/xy/device",
          "type": "number",
          "unit": "°",
          "acronym": "longitude"
        }
      ]
}

In the UI the device shows up correctly and lat and lon are shown as separate values. The graphs are displayed correctly and the devices' attributes show up in the variables view, too.

But when I want to access the attributes of the device like $location.lat in a rule or variable expression, it does not yield the expected value, but the entire mqtt message payload, the raw JSON.

wutu commented 7 years ago

Hey, thanks for your report. Looking at it as soon as possible.

wutu commented 7 years ago

https://github.com/wutu/pimatic-mqtt/commit/9d4103da79675ec032999280005b23602915b84b