Widget - Sensor custom buttons


  • ADMIN

    With the request https://github.com/mycontroller-org/mycontroller/issues/47 we have introduced an option to add custom buttons with custom payload on dashboard.

    We can use this widget for multiple purpose. Here I have showed how to use it as a TV remote control. For this you should have IR send sensor board in front of tv.

    Edit dashboard and select add widgets. Select Sensor custom buttons
    Now select your IR send type sensor variable.
    You have to give 3 types of input

    • Minimum height - each button minimum height in px
    • Minimum weight - each button minimum weight in px
    • JSON - is the buttons/payloads configuration

    To create json configuration error free way use http://www.jsoneditoronline.org/

    In configuration we can give name, payload, btnType.

    • name - (Mandatory) Name of the button. can be in the form of HTML also. HTML or icons(recommended: font awesome icons)
      are mandatory fields.
    • payload - (Mandatory) When we click the button what is the payload we have to send
    • btnType - (Optional) can be any one of value in the list [default, primary, success, info, warning, danger] when we leave this field field as blank, default will be selected. Each value gives different color

    Example json configuration as follows,

    [
      {
        "name": "<i class='fa fa-power-off'></i>",
        "payload": "P",
        "btnType": "danger"
      },
      {
        "name": "1",
        "payload": "1"
      },
      {
        "name": "2",
        "payload": "2"
      },
      {
        "name": "3",
        "payload": "3"
      },
      {
        "name": "4",
        "payload": "4"
      },
      {
        "name": "5",
        "payload": "5"
      },
      {
        "name": "6",
        "payload": "6"
      },
      {
        "name": "7",
        "payload": "7"
      },
      {
        "name": "8",
        "payload": "8"
      },
      {
        "name": "9",
        "payload": "9"
      },
      {
        "name": "0",
        "payload": "0"
      },
      {
        "name": "<i class='fa fa-play'></i>",
        "payload": "PL",
        "btnType":"success"
      },
      {
        "name": "<i class='fa fa-pause'></i>",
        "payload": "PA",
        "btnType":"warning"
      }
    ]
    

    Note: In this example I have added dummy payloads. Real payload of TV remote will be different(TV to TV payload will be different).

    Final result:

    image





  • It is posible to send multiple Payloads with one Button?
    I need a Button for Power On/Off all Lamps, all connected to one 433MHz Node!


  • ADMIN

    @Takero1978 I do not know how 433MHz works. Multiple payload is not possible with custom button.

    It is possible by creating group. Resources >> Groups >> Add Group after created new group select View details of the group from table. Now add any number of resources you want. You have to specify ON payload and OFF payload.

    I think we have to introduce new widget to add groups in dashboard.



  • Thanks! Woks :-)

    Now we need a Group Button for dashboards :dancer:


  • ADMIN

    @Takero1978 said:

    Group Button for dashboard

    Please create a request on Github. I will add group button for dashboard.


Log in to reply