Since i lost access to my old account, I must use an answer (although it works for Bedrock Editions at this time).
Stone and Wooden pressure plates have data value 0 to represent unpressed, and I forgot what to represent pressed. Weighted pressure plates (Iron / Gold) have 0 to represent nothing on it, yet I forgot if it increases as more entities get on it.
Levers as well as both buttons use the data value to represent both the facing and its powered / unpowered state (0-5 for unpowered, 8-13 for powered). To figure out which is which, just add or subtract 8 depending on its value to get its respective value for the opposite powered state.
For doors, check the lower block's data value as the upper block does not really help, except tell you it has something below it. (It also applies the "facing and powered" idea as levers and buttons, but in a different way.
Once again: Bedrock Edition only and subject to change with updates to the game.
EDIT:
To make it work: /execute <target-specifier> <command-position> detect <block-id> <block-data> <detect-position> <command>
Where:
<target-specifier>
would probably be something like @a[x=~,y=~2,z=~,dx=1,dy=1,dz=1]
(if the layout is "pressure-plate > solid block > this command block".
<command-position>
where the command would execute (using relative coordinates at any of the x/y/z means relative to that entity this command is being executed upon.
<block-id>
is the named id of the block to detect.
<block-data>
is the numeric data value of the block to detect.
<detect-position>
where to detect the block (relative positions are relatice to what was specified as the command's executing location (see <command-position>
).
<command>
is the command to run, without leading /
, and is to be like the entity being acted upon is executing it whils having all the permissions that a command block has (meaning no /ban
, /op
, /deop
, etc.).
-- I might have accidentally swapped the <detect-position>
accidentally (it might be actually immediately after detect
).