Message parsing from MQTT server
That's not how you compare C strings.
When you write
if (topic == &quot;/home/bedroom/light1&quot;)

you're comparing whether the character pointer topic is the same value as the address of the string &quot;/home/bedroom/light1&quot;, which of course it is not in this case.
To compare C strings, use the strcmp() function, which returns 0 if they're identical.
if (strcmp(topic, &quot;/home/bedroom/light1&quot;) == 0 &amp;&amp; p == '0')