Linking switches on the NxPanel to OH items without rules
This works great!
Create a new channel on your NSPanel like this;
- id: nxpanel_movie_light
channelTypeUID: mqtt:switch
label: Movie Light - 10:1
description: ""
configuration:
postCommand: true
formatBeforePublish: '{"sync":{"pid":10,"bid":1,"state":%s}}'
commandTopic: cmnd/nspanel/nxpanel
transformationPattern: 'REGEX:(.*\"pid\": 10.*\"bid\": 1.*)∩JSONPATH:$.button.state'
stateTopic: tele/nspanel/RESULT
off: "0"
on: "1"
Then, instead of creating a new item for it, just link it to the existing item used for the switch. They are now both in sync and work perfectly. Thanks to @jonny211 for pointing me in right direction for the nice solution! ![]()
UPDATE 1: The above meoth does not work 100% for me yet. Still needs some investigating. I works great from a UI perspective, both OH item and NSPanel button control the the light perfecty, changing either keeps the other in sync. The issue is using the phyical switch, it does not push the state back right, see here for more details! ![]()
UPDATE 2: Sorted! With some excellent support from @rossko57. Create your NxPanel channel as described above. Add this channel to your existing switch item, ensuring you use the follow profile. The key points in making this work are; 1 - Using follow on NxPanel channel and, 2 - Setting Is Command on the channel too!