thecowan / wallpanel-android

WallPanel is an Android application for Web Based Dashboards and Home Automation Platforms
https://wallpanel.app
Apache License 2.0
745 stars 103 forks source link

Home Assistant MQTT discovery #118

Open escoand opened 4 years ago

escoand commented 4 years ago

I would like to request MQTT discovery feature so that you don't need to add all these sensors by hand. https://www.home-assistant.io/docs/mqtt/discovery/

Don't know if other home automation systems understand this as well or if they have similar interfaces...

escoand commented 4 years ago

@thanksmister This should be the correct payload for all the sensors.

homeassistant/sensor/<UNIQUEID>/battery/config
{
  "name": "Battery Level",
  "state_topic": "<PREFIX>sensor/battery",
  "unit_of_measurement": "%",
  "value_template": "{{value_json.value}}",
  "unique_id": "wallpanel.<UNIQUEID>.battery",
  "device_class": "battery",
  "device": {
    "name": "WallPanel",
    "identifiers": "wallpanel.<UNIQUEID>",
    "manufacturer": "ThanksMister LLC",
    "model": "WallPanel",
    "sw_version": "<VERSION>"
  }
}

homeassistant/sensor/<UNIQUEID>/temperature/config
{
  "name": "Temperature",
  "state_topic": "<PREFIX>sensor/temperature",
  "unit_of_measurement": "°C",
  "value_template": "{{value_json.value}}",
  "unique_id": "wallpanel.<UNIQUEID>.temperature",
  "device_class": "temperature",
  "device": {
    "name": "WallPanel",
    "identifiers": "wallpanel.<UNIQUEID>",
    "manufacturer": "ThanksMister LLC",
    "model": "WallPanel",
    "sw_version": "<VERSION>"
  }
}

homeassistant/sensor/<UNIQUEID>/light/config
{
  "name": "Light",
  "state_topic": "<PREFIX>sensor/light",
  "unit_of_measurement": "lx",
  "value_template": "{{value_json.value}}",
  "unique_id": "wallpanel.<UNIQUEID>.light",
  "device_class": "illuminance",
  "device": {
    "name": "WallPanel",
    "identifiers": "wallpanel.<UNIQUEID>",
    "manufacturer": "ThanksMister LLC",
    "model": "WallPanel",
    "sw_version": "<VERSION>"
  }
}

homeassistant/sensor/<UNIQUEID>/magneticField/config
{
  "name": "Magnetic Field",
  "state_topic": "<PREFIX>sensor/magneticField",
  "unit_of_measurement": "uT",
  "value_template": "{{value_json.value}}",
  "unique_id": "wallpanel.<UNIQUEID>.magneticField",
  "device": {
    "name": "WallPanel",
    "identifiers": "wallpanel.<UNIQUEID>",
    "manufacturer": "ThanksMister LLC",
    "model": "WallPanel",
    "sw_version": "<VERSION>"
  }
}

homeassistant/sensor/<UNIQUEID>/pressure/config
{
  "name": "Pressure",
  "state_topic": "<PREFIX>sensor/pressure",
  "unit_of_measurement": "hPa",
  "value_template": "{{value_json.value}}",
  "unique_id": "wallpanel.<UNIQUEID>.pressure",
  "device_class": "pressure",
  "device": {
    "name": "WallPanel",
    "identifiers": "wallpanel.<UNIQUEID>",
    "manufacturer": "ThanksMister LLC",
    "model": "WallPanel",
    "sw_version": "<VERSION>"
  }
}

homeassistant/binary_sensor/<UNIQUEID>/motion/config
{
  "name": "Motion",
  "state_topic": "<PREFIX>sensor/motion",
  "payload_on": "{\"value\":true}",
  "payload_off": "{\"value\":false}",
  "unique_id": "wallpanel.<UNIQUEID>.motion",
  "device_class": "motion",
  "device": {
    "name": "WallPanel",
    "identifiers": "wallpanel.<UNIQUEID>",
    "manufacturer": "ThanksMister LLC",
    "model": "WallPanel",
    "sw_version": "<VERSION>"
  }
}

homeassistant/binary_sensor/<UNIQUEID>/face/config
{
  "name": "Face Detected",
  "state_topic": "<PREFIX>sensor/face",
  "payload_on": "{\"value\":true}",
  "payload_off": "{\"value\":false}",
  "unique_id": "wallpanel.<UNIQUEID>.face",
  "device": {
    "name": "WallPanel",
    "identifiers": "wallpanel.<UNIQUEID>",
    "manufacturer": "ThanksMister LLC",
    "model": "WallPanel",
    "sw_version": "<VERSION>"
  }
}

homeassistant/binary_sensor/<UNIQUEID>/qrcode/config
{
  "name": "QR Code",
  "state_topic": "<PREFIX>sensor/qrcode",
  "payload_on": "{\"value\":true}",
  "payload_off": "{\"value\":false}",
  "unique_id": "wallpanel.<UNIQUEID>.qrcode",
  "device": {
    "name": "WallPanel",
    "identifiers": "wallpanel.<UNIQUEID>",
    "manufacturer": "ThanksMister LLC",
    "model": "WallPanel",
    "sw_version": "<VERSION>"
  }
}
Christian-Me commented 4 years ago

Hello, perhaps I have to say "Thank you!" for the whole Team, The App was exactly what I was looking for.

Regarding this issue: Instead (or together) with the Home Assistant auto discovery I would suggest you take a look at the open "Homie Convention" It is doing the same thing but is device, sensor and control system independent. It is used by openHAB, Node-RED (via contrib node), Home assistant (via a module) and many others.

I maintain the ESPEasy plugins and the Node-RED contrib node and can say this is an elaborate, complete, flexible and cool standard for communication via MQTT - and I love it. Personally I have NO experience in java so I think I`m not able to contribute in this case, sorry.

Chris

BoneheadFraggle commented 4 years ago

+1 for this. Wallpanel is an amazing app already, and MQTT discovery would save a lot of Home Assistant restarts while testing new devices.

zombiehoffa commented 3 years ago

+1 for implementing this for home assistant.