Measurements of $\mathrm{B}^*_\mathrm{s2}(5840)^0$ and $\mathrm{B}_\mathrm{s1}(5830)^0$ mesons are performed using a data sample of proton-proton collisions corresponding to an integrated luminosity of 19.6 fb$^{-1}$, collected with the CMS detector at the LHC at a centre-of-mass energy of 8 TeV. The analysis studies $P$-wave $\mathrm{B}^0_\mathrm{S}$ meson decays into $\mathrm{B}^{(*)+}\mathrm{K}^-$ and $\mathrm{B}^{(*)0}\mathrm{K}^0_\mathrm{S}$, where the $\mathrm{B}^+$ and $\mathrm{B}^0$ mesons are identified using the decays $\mathrm{B}^+\to\mathrm{J}/\psi\,\mathrm{K}^+$ and $\mathrm{B}^0\to\mathrm{J}/\psi\,\mathrm{K}^*(892)^0$. The masses of the $P$-wave $\mathrm{B}^0_\mathrm{S}$ meson states are measured and the natural width of the $\mathrm{B}^*_\mathrm{s2}(5840)^0$ state is determined. The first measurement of the mass difference between the charged and neutral $\mathrm{B}^*$ mesons is also presented. The $\mathrm{B}^*_\mathrm{s2}(5840)^0$ decay to $\mathrm{B}^0\mathrm{K}^0_\mathrm{S}$ is observed, together with a measurement of its branching fraction relative to the $\mathrm{B}^*_\mathrm{s2}(5840)^0\to\mathrm{B}^+\mathrm{K}^-$ decay.