We present the scaling relation between Sunyaev-Zeldovich (SZ) signal and stellar mass for almost 260,000 locally brightest galaxies (LBGs) selected from the Sloan Digital Sky Survey (SDSS). These are predominantly the central galaxies of their dark matter halos. We calibrate the stellar-to-halo mass conversion using realistic mock catalogues based on the Millennium Simulation. Applying a multi-frequency matched filter to the Planck data for each LBG, and averaging the results in bins of stellar mass, we measure the mean SZ signal down to $M_astsim 2times 10^{11} Msolar$, with a clear indication of signal at even lower stellar mass. We derive the scaling relation between SZ signal and halo mass by assigning halo properties from our mock catalogues to the real LBGs and simulating the Planck observation process. This relation shows no evidence for deviation from a power law over a halo mass range extending from rich clusters down to $M_{500}sim 2times 10^{13} Msolar$, and there is a clear indication of signal down to $M_{500}sim 4times 10^{12} Msolar$. Plancks SZ detections in such low-mass halos imply that about a quarter of all baryons have now been seen in the form of hot halo gas, and that this gas must be less concentrated than the dark matter in such halos in order to remain consistent with X-ray observations. At the high-mass end, the measured SZ signal is 20% lower than found from observations of X-ray clusters, a difference consistent with Malmquist bias effects in the X-ray sample.