I just installed TriggerCMD a week or so ago and its pretty cool. The only issue i have is that the devices all show up as switches, when i want them to be buttons. The app works with my PC, so whenever the switch is toggled it runs the script. Im using it for spotify control right now, so it looks like 4 playlists and 2 speakers are on, when its just 1 playlist going. if i turn the switch off, though, it sends the command again, which starts that playlist.
Ive got the raw code, but i cant figure out how to change the device type from a switch to a button. Ive looked at some of the docs on the developer pages, i see information about the buttons but ive edited the code and i cant figure out how to change it to a functional button.
Link to the raw code on github:
https://raw.githubusercontent.com/rvmey/SmartThingsPublic/MSA-2199-2/devicetypes/vandermeyconsulting/triggercmd-switch.src/triggercmd-switch.groovy
Ive tried changing parts of the code, but i dont really know what im doing, so it doesnt work.
Ive changed the metadata:
metadata {
definition (name: “TRIGGERcmd -modified button”, namespace: “vandermeyconsulting”, author: “Russell VanderMey”) {
capability “Button”
command "pushed"
command "held"
}
and the tiles:
tiles {
standardTile("button", "device.button", width: 2, height: 2, canChangeIcon: true) {
state "on", label:'${name}', action:"button.pushed", icon:"st.buttons.button.pressed", backgroundColor:"#79b821", nextState:"off"
state "off", label:'${name}', action:"button.off", icon:"st.buttons.button.off", backgroundColor:"#ffffff", nextState:"on"
}
standardTile("refresh", "device.button", inactiveLabel: false, decoration: "flat") {
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
}
main(["button"])
details(["button", "refresh" ])
when i changed the device type of one of the devices, it changes the icon in the ST app on the left side from a plug to a button, but the indicator icon on the right still shows ON/OFF.
i have no idea where to go from here. I feel like im probably on the right track but i might be completely in the wrong place. Can anyone help me with this?