mKeRix/hassio-repo

Getting error "Command Disallowed"

Closed this issue · 6 comments

Hi!
Since I made a good experience with room assistant on my pi zero I thought I could run it on my Home Assistant Pi 4 too to use it for presence detection via BLE. For this I installed it in Home Assistant using this repo.
But I don't see any devices show up, even though the logs tell me that they found some and in the logs the BluetoothServices gives error messages that a command is "disallowed".
Here is the some part of the log messages:

3/15/2021, 4:03:06 PM - info - ConfigService: Loading configuration from /usr/lib/node_modules/room-assistant/dist/config/definitions/default.js, config/default.json, config/local.yml (Current: /room-assistant)
3/15/2021, 4:03:06 PM - error - ClusterService: Failed to start mdns discovery (dns service error: unknown)
3/15/2021, 4:03:06 PM - info - NestApplication: Nest application successfully started
3/15/2021, 4:03:07 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:03:07 PM - info - BluetoothLowEnergyService: Discovered new BLE peripheral ATC_F2F8A6 with ID a4c138f2f8a6 and RSSI -60
3/15/2021, 4:03:07 PM - info - BluetoothLowEnergyService: Discovered new BLE peripheral 4a5f47ae733144f297c49330884b11d9-0-0 with ID 4a5f47ae733144f297c49330884b11d9-0-0 and RSSI -74
3/15/2021, 4:03:07 PM - info - BluetoothLowEnergyService: Discovered new BLE peripheral 5e99ec2f2804 with ID 5e99ec2f2804 and RSSI -77
3/15/2021, 4:03:07 PM - info - ClusterService: 6e66619d-room-assistant has been elected as leader
3/15/2021, 4:03:07 PM - info - EntitiesService: Refreshing entity states
3/15/2021, 4:03:25 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:04:25 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:05:26 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:06:27 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:07:27 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:08:26 PM - info - BluetoothLowEnergyService: Discovered new BLE peripheral 5e0dff8b0d54 with ID 5e0dff8b0d54 and RSSI -82
3/15/2021, 4:08:27 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:09:28 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:10:28 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:11:28 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed
3/15/2021, 4:12:12 PM - info - BluetoothLowEnergyService: Discovered new BLE peripheral 6c3c02d4b43c with ID 6c3c02d4b43c and RSSI -88
3/15/2021, 4:12:29 PM - error - BluetoothService: Failed to start advertising instance via BLE: Command Disallowed

The device with the ID 4a5f47ae733144f297c49330884b11d9-0-0 is my android phone which is sending beacons using the beacon simulator.

The failed to start advertising can likely be suppressed by setting the instanceBeaconEnabled setting of the bluetoothLowEnergy integration to false. For now that's only used in the iOS companion app (and that feature isn't even live yet on TestFlight). Can you see if that changes anything? Maybe your adapter doesn't support scanning & advertising at the same time.

The error messages are gone now, but I still can't see any entity or device inside Home Assistant. This is what my local.yml looks like:

# You don't need to add the MQTT details for Home Assistant with the add-on installation, it will be auto-discovered!
global:
  integrations:
    - bluetoothLowEnergy
bluetoothLowEnergy:
  instanceBeaconEnabled: false
  allowlist:
    - <Mac Adress of the BT Device>
    - 4a5f47ae733144f297c4-9330884b11d9-0-0
  tagOverrides:
    <Mac Adress of the BT Device>:
      name: Anroid_BLE

Since the comment says that the MQTT is automatically configured, I did not add any mqtt related values.

Could you try enabling the homeAssistant integration and then check if you see something? Similar to this:

global:
  integrations:
    - bluetoothLowEnergy
    - homeAssistant

The MQTT URL, username and password will be auto-discovered, but they won't be used if the integration isn't enabled (which is quite confusing, now that I think about it).

I added the integration and it seems that the mqtt connection is working now. The logfile states:

HomeAssistantService: Successfully connected to MQTT broker at mqtt://192.168.x.x:1883

Also a device called "cluster_leader" appeared in the devices section:
6e66619d_room_assistant_cluster_leader
But other than that I can not find any devices or entities. Is there a way to get a more verbose log that shows what room assistant is detecting/sending?

Btw thanks for the super quick reply and support, I highly appreciate it 💪

There is, but unfortunately it's not easily accessible in the Home Assistant add-on (for other installations it's the -v CLI option). We could/should probably make that possible more easily in the add-on in the future.

You can at least check the API of the add-on though, you just need to activate the API port in the add-on configuration. The entities endpoint will tell you the state of the room-assistant internal registry.

Three more questions that might help pinpoint the problem:

  • Do you have a type in your config by any chance? The logs state that beacon 4a5f47ae733144f297c49330884b11d9-0-0 was found, but your config lists 4a5f47ae733144f297c4-9330884b11d9-0-0 (note the extra - in the middle, that probably shouldn't be there)
  • Do you use anything else that might also need Bluetooth on the Home Assistant OS machine? For example, a Home Assistant integration that uses Bluetooth, or another add-on.
  • Are your two instances connecting to each other correctly? On Home Assistant OS often times the auto-discovery doesn't work as intended, which you can counteract by specifying the IP of the Pi Zero in the cluster configuration.

OMG, I checked almost everything but not the obvious part 🤦‍♂️

Do you have a type in your config by any chance? The logs state that beacon 4a5f47ae733144f297c49330884b11d9-0-0 was found, but your config lists 4a5f47ae733144f297c4-9330884b11d9-0-0 (note the extra - in the middle, that probably shouldn't be there)

yes exactly this was the issue.
So thanks again so much!