Announcement

Collapse
No announcement yet.

room-assistant and mcsMQTT

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    room-assistant and mcsMQTT

    Hello All,

    I've recently decided to start experimenting with room-assistant (from the Home Assistant team) and mcsMQTT. I've been using the BLE integration of mcsMQTT for a few months runing BLEMQTT on a Raspberry Pi Zero, but am looking into room-assistant Introduction | room-assistant as a potential replacement for a couple of reasons:

    BLEMQTT has been unreliable on my Raspberry Pi Zero, requiring a restart about once a week.
    room-assistant supports not only BLE but also standard Bluetooth device discovery (what they refer to as Bluetooth Classic) as well as GPIO pins and shell commands, passing everything back to MQTT.

    Fortunately, Home Assistant isn't a requirement, MQTT integration is drectly supported as well. The intent of this software is to have multiple instances per room, and your presence will track from room to room using Bluetooth or BLE. There are some youtube videos showing tracking an Apple Watch.

    I've setup room-assistant on my Pi Zero, and setup the MQTT broker integration and am working through the many options and configurations. It seems pretty full featured.

    Not knocking the direct BLE integration, I'm sure the issues I'm having with it are probably something I did wrong, but I was really interested in the standard bluetooth discovery as well as the BLE. I also may try the shell integration to get some RPI stats.

    Thanks to Eman for pointing out this software on another thread.

    #2
    What specific suggestions do you have for integration of this with mcsMQTT or HS? What install option are you using on RPi?

    As an aside I did the room level position identification with the HS3 plugin and set of ESP32 or RPi To achieve trilateration. A rich UI was developed as well. Very little interest in this capability. Likely because of the need to install multiple ESP32/RPi to support the capability.

    Comment


      #3
      I used these instructions for my Pi Zero Raspberry Pi Zero W | room-assistant. Normal Raspberry Pi install is here Installation | room-assistant

      Since I'm not using Home Assistant, my local.yml looks like this:

      global:
      integrations:
      - mqtt
      - bluetoothLowEnergy
      mqtt:
      mqttUrl: mqtt://192.168.x.x:1883
      retain: false
      bluetoothLowEnergy:
      timeout: 60
      allowlist:
      - dc0d3003xxxx
      - dc0d3003xxxx
      - dc0d3004xxxx
      - dc0d3004xxxx
      maxDistance: 5

      All my BLE beacons are feasybeacons. Most of the data I copied directly from BLEMQTT.ini with a little massaging. The room-assistant documentation is very good.

      I haven't yet added the Bluetooth Classic integration, as they recommend separate devices or expect slower updates if you run both on the same Pi. Updates seem to be blazingly fast, I'm getting new MQTT topics about once a second. Right now I'm just working on getting the beacon home/away status working the same as your BLEMQTT binary.

      Here's an example of the 2 topics generated per BLE beacon, I've formatted them with JSFormat for clarity. Replaced the mac last 4 and name. This is my first JSON formatted MQTT data and I'm on HS3 so I'm not sure exactly how to get most of this into related devices. I need to review your documentation on ingesting this format. For the moment I've only created devices for some key data. The second sub is repeated every second or so, but you can throttle this rate. I'll probably do that.

      At the moment just comparing the functionality, but it seems to be pretty fully featured. While testing room-assistant I have BLEMQTT service disabled with systemctl command.


      2021-06-05 16:53:28 room-assistant/entity/ble-monitor/device-tracker/ble-dc0d3003xxxx-tracker
      {
      "entity": {
      "attributes": {},
      "id": "ble-dc0d3003xxxx-tracker",
      "name": "Mumble Tracker",
      "distributed": true,
      "stateLocked": true,
      "state": "home"
      },
      "diff": [{
      "path": "/state",
      "newValue": "home"
      }
      ],
      "hasAuthority": true
      }

      2021-06-05 18:01:34 room-assistant/entity/ble-monitor/bluetooth-low-energy-presence-sensor/ble-dc0d3003xxxx
      {
      "entity": {
      "attributes": {
      "distance": 2.5,
      "lastUpdatedAt": "2021-06-05T23:01:35.003Z"
      },
      "id": "ble-dc0d3003xxxx",
      "name": "Mumble Room Presence",
      "distributed": true,
      "stateLocked": true,
      "distances": {
      "ble-monitor": {
      "lastUpdatedAt": "2021-06-05T23:01:35.003Z",
      "distance": 2.5,
      "outOfRange": false
      }
      },
      "timeout": 60,
      "measuredValues": {
      "ble-monitor": {
      "rssi": -66.982729939176,
      "measuredPower": -59
      }
      },
      "state": "ble-monitor"
      },
      "diff": [{
      "path": "/measuredValues/ble-monitor",
      "oldValue": {
      "rssi": -67.30206790490342,
      "measuredPower": -59
      },
      "newValue": {
      "rssi": -66.982729939176,
      "measuredPower": -59
      }
      }, {
      "path": "/distances/ble-monitor",
      "oldValue": {
      "lastUpdatedAt": "2021-06-05T23:01:28.580Z",
      "distance": 2.6,
      "outOfRange": false
      },
      "newValue": {
      "lastUpdatedAt": "2021-06-05T23:01:35.003Z",
      "distance": 2.5,
      "outOfRange": false
      }
      }, {
      "path": "/attributes/distance",
      "oldValue": 2.6,
      "newValue": 2.5
      }, {
      "path": "/attributes/lastUpdatedAt",
      "oldValue": "2021-06-05T23:01:28.580Z",
      "newValue": "2021-06-05T23:01:35.003Z"
      }
      ],
      "hasAuthority": true
      }



      Comment


        #4
        What I see at its core is functionality very similar to BLEMQTT where it reports at a potentially high rate the RSSI of specific beacons. It provides other information which is just noise for the purpose of in-range vs. out-of-range. It has the threshold in the RPi rather than in the plugin which makes sense when the objective is distance to room vs. distance to site.

        it has a RSSI to distance calculation, but I did not see in the setup where the beacon transmitter characteristics are specified.

        The HS3 mcsMQTT implementation used trilateration and Kalman filter to locate a beacon in a 100 ft x100 ft grid. In essence it tries to provide real time motion tracking. Room assistant does what the HS4 mcsMQTT BLE does with a threshold of in-range vs. out-of-range. It has multiple instances while HS4 mcsMQTT objective is single instance for site detection.

        You can easily integrate it with mcsMQTT by associating the outOfRange key of the second message to a HS device or use one of the quantitative measures rather than outOfRange. Suggest using Express mode and limiting the publish rate as is done in BLEMQTT. There many things being published that likely will not be of interest. Best to eliminate those if configurable to eliminate the resource consumption.

        When I was running HS3 I did a did a shutdown/reboot around midnight to deal with gremlins. I have not done this with HS4. I would attribute it more to general software maturity of several years ago vs. today. The same can be done to restart specific processes on a periodic basis.

        Comment

        Working...
        X