Support for button device in fibaro integration (com.fibaro.FGPB101)

Tags: #<Tag:0x00007f73952790b0>

The Button device (device type com.fibaro.FGPB101) is not recognized and hass entity is not mapped.

It would be nice to have support for this kind of device and be able to map automations when it’s pressed. Eg. it could be binary sensor with extra attribute of last number of presses.

Here is device object from Fibaro HCL API:

{
  "id": 47,
  "name": "Tlačítko",
  "roomID": 0,
  "type": "com.fibaro.FGPB101",
  "baseType": "com.fibaro.remoteSceneController",
  "enabled": true,
  "visible": true,
  "isPlugin": false,
  "parentId": 46,
  "remoteGatewayId": 0,
  "interfaces": [
    "battery",
    "fibaroFirmwareUpdate",
    "zwave",
    "zwaveAlarm",
    "zwaveCentralScene",
    "zwaveMultiChannelAssociation",
    "zwaveWakeup"
  ],
  "properties": {
    "parameters": [
      {
        "id": 1,
        "lastReportedValue": 127,
        "lastSetValue": 127,
        "size": 1,
        "value": 127
      },
      {
        "id": 3,
        "lastReportedValue": 7,
        "lastSetValue": 7,
        "size": 1,
        "value": 7
      },
      {
        "id": 10,
        "lastReportedValue": 3,
        "lastSetValue": 3,
        "size": 1,
        "value": 3
      },
      {
        "id": 11,
        "lastReportedValue": 255,
        "lastSetValue": 255,
        "size": 2,
        "value": 255
      },
      {
        "id": 12,
        "lastReportedValue": 1,
        "lastSetValue": 1,
        "size": 1,
        "value": 1
      },
      {
        "id": 13,
        "lastReportedValue": 99,
        "lastSetValue": 99,
        "size": 2,
        "value": 99
      },
      {
        "id": 14,
        "lastReportedValue": 0,
        "lastSetValue": 0,
        "size": 1,
        "value": 0
      },
      {
        "id": 15,
        "lastReportedValue": 255,
        "lastSetValue": 255,
        "size": 2,
        "value": 255
      },
      {
        "id": 20,
        "lastReportedValue": 3,
        "lastSetValue": 3,
        "size": 1,
        "value": 3
      },
      {
        "id": 21,
        "lastReportedValue": 255,
        "lastSetValue": 255,
        "size": 2,
        "value": 255
      },
      {
        "id": 22,
        "lastReportedValue": 1,
        "lastSetValue": 1,
        "size": 1,
        "value": 1
      },
      {
        "id": 23,
        "lastReportedValue": 99,
        "lastSetValue": 99,
        "size": 2,
        "value": 99
      },
      {
        "id": 24,
        "lastReportedValue": 0,
        "lastSetValue": 0,
        "size": 1,
        "value": 0
      },
      {
        "id": 25,
        "lastReportedValue": 255,
        "lastSetValue": 255,
        "size": 2,
        "value": 255
      },
      {
        "id": 29,
        "lastReportedValue": 3,
        "lastSetValue": 3,
        "size": 1,
        "value": 3
      },
      {
        "id": 30,
        "lastReportedValue": 127,
        "lastSetValue": 127,
        "size": 1,
        "value": 127
      }
    ],
    "pollingTimeSec": 0,
    "wakeUpTime": 0,
    "zwaveCompany": "Fibargroup",
    "zwaveInfo": "3,4,38",
    "zwaveVersion": "3.2",
    "alarmLevel": "0",
    "alarmType": "0",
    "batteryLevel": "100",
    "batteryLowNotification": "true",
    "categories": "[\"remotes\"]",
    "centralSceneSupport": "[{\"keyAttributes\":[\"Pressed\",\"Released\",\"HeldDown\",\"Pressed2\",\"Pressed3\",\"Pressed4\",\"Pressed5\"],\"keyId\":1}]",
    "configured": true,
    "dead": "false",
    "deadReason": "",
    "defInterval": "0",
    "deviceControlType": "0",
    "deviceIcon": "109",
    "emailNotificationID": "0",
    "emailNotificationType": "0",
    "endPointId": "0",
    "firmwareUpdate": "{\"info\":\"\",\"progress\":0,\"status\":\"UpToDate\",\"updateVersion\":\"3.2\"}",
    "icon": "{\"path\":\"fibaro/icons/com.fibaro.FGPB101/com.fibaro.FGPB101.png\",\"source\":\"HC\"}",
    "log": "",
    "logTemp": "",
    "manufacturer": "",
    "markAsDead": "true",
    "maxInterval": "0",
    "minInterval": "0",
    "model": "",
    "nodeId": "13",
    "panicMode": "false",
    "parametersTemplate": "772",
    "productInfo": "1,15,15,1,16,0,3,2",
    "pushNotificationID": "0",
    "pushNotificationType": "0",
    "remoteGatewayId": "0",
    "saveLogs": "true",
    "sequences": "[]",
    "serialNumber": "h'000000000001879b",
    "smsNotificationID": "0",
    "smsNotificationType": "0",
    "stepInterval": "0",
    "updateVersion": "",
    "useTemplate": "true",
    "userDescription": ""
  },
  "actions": {
    "abortUpdate": 1,
    "reconfigure": 0,
    "retryUpdate": 1,
    "setInterval": 1,
    "startUpdate": 1,
    "updateFirmware": 1
  },
  "created": 1573921569,
  "modified": 1573921569,
  "sortOrder": 38
}

This is payload from refreshStates API:

    {
      "type": "CentralSceneEvent",
      "data": {
        "deviceId": 47,
        "keyId": 1,
        "keyAttribute": "Pressed2",
        "icon": {
          "path": "fibaro/icons/com.fibaro.FGPB101/com.fibaro.FGPB101-1Pressed2.png",
          "source": "HC"
        }
      }
    },
    {
      "type": "DevicePropertyUpdatedEvent",
      "data": {
        "id": 47,
        "property": "icon",
        "oldValue": {
          "path": "fibaro/icons/com.fibaro.FGPB101/com.fibaro.FGPB101.png",
          "source": "HC"
        },
        "newValue": {
          "path": "fibaro/icons/com.fibaro.FGPB101/com.fibaro.FGPB101-1Pressed2.png",
          "source": "HC"
        }
      }
    },

I think that adding support for this button will be very easy :slight_smile:

Should I just map it to a binary sensor?

Yes, I think it’s best option. And save attribute with type of last press.
Also if it’s binary sensor, something should probably also set it back to off after some time?

I have one somewhere, but it broke shortly after buying it and was a pain in general. Unfortunately I could not find it, so I can’t test with. Is there any usable event system in HA that I could map it onto, or should I do some emulated states as a binary sensor, you think?

Hey, are you still up to it Peter? :slight_smile: