A simple button widget that sends ON or OFF commands to an item. The labels on the button can be configured, as well as the TITLE and FOOTER.
The widget is based on the OH-documentation from
Screenshots
I use this to control the roller shutter automation in my house:
Changelog
Version 0.1
- initial release
Version 0.2
- added quotation marks for the actionCommands
Resources
uid: ButtonSwitch
tags: []
props:
parameters:
- context: item
description: Item to use with this button.
label: Item
name: item
required: true
type: TEXT
groupName: general
- description: Text to show as title.
label: Title
name: Title
required: false
type: TEXT
- description: Text to show as footer.
label: Footer
name: Footer
required: false
type: TEXT
- description: Text to show on the 'ON' button.
label: OnButton
name: OnButton
required: false
type: TEXT
- description: Text to show on the 'OFF' button.
label: OffButton
name: OffButton
required: false
type: TEXT
parameterGroups:
- name: general
label: Display options
timestamp: Jul 4, 2021, 10:03:36 AM
component: f7-card
config:
title: '=(props.Title) ? props.Title : ""'
footer: '=(props.Footer) ? props.Footer : ""'
style:
min-width: 250px
slots:
default:
- component: f7-block
config:
class: bog
style:
display: flex
flex-wrap: wrap
justify-content: space-between
align-content: space-between
padding: 20px
slots:
default:
- component: f7-segmented
slots:
default:
- component: oh-button
config:
text: '=(props.OnButton) ? props.OnButton : "ON"'
outline: true
action: command
actionItem: =props.item
actionCommand: "ON"
active: "=(items[props.item].state === 'ON') ? true : false"
style:
width: 100px
- component: oh-button
config:
text: '=(props.OffButton) ? props.OffButton : "OFF"'
outline: true
action: command
actionItem: =props.item
actionCommand: "OFF"
active: "=(items[props.item].state === 'OFF') ? true : false"
style:
width: 100px