# longer curly braces in Tikz

I am trying to draw curly braces that are slightly longer than the referring object.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,angles,quotes}

\begin{document}

\tikzstyle{sensor}=[draw,  text width=7em,
text centered, minimum height=2.5em]

\begin{tikzpicture}
\path (0,0) node (box1) [sensor] {Box 1};
\draw[decoration={brace,raise=15pt},decorate]
(box1.west) -- node[above=15pt] {$y$} (box1.east);
\end{tikzpicture}
\end{document}


In the example above I want the braces to be a few points wider than the edges of the box.

I have tried +(-.2,0) to each node, but only works on the left.

Like this?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,angles,quotes}

\begin{document}

\tikzstyle{sensor}=[draw,  text width=7em,
text centered, minimum height=2.5em]

\begin{tikzpicture}
\path (0,0) node (box1) [sensor] {Box 1};
\draw[decoration={brace,raise=15pt},decorate]
([xshift=-2pt]box1.west) -- node[above=15pt] {$y$} ([xshift=2pt]box1.east);
\end{tikzpicture}
\end{document}


Another version: a different approach with longer curly braces in Tikz.

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture} [baseline=1.2in]
\draw [thick] (0,0) -- (4,0) -- (4,2) -- (0,2) -- (0,0) ;
\draw [thick, decorate,decoration={brace,amplitude=10pt},yshift=2pt] (-.5,1.9) -- (4.5,1.9) node [black,midway,yshift=16pt] {$y$};
\node[draw=white] at (2,1) {Box 1};
\end{tikzpicture}
\end{document}