More detail: This is an attempt to use the ESP8266 as a dimmer for a light on HA, not on the ESP. In the code above, the ha_study_brightness sensor pulls the brightness of a light from HA - this is working as it shows in the logs. The line brightness: '{{sensor.ha_study_brightness - 0.5}}' is intended to subtract 5 from that value for it to be sent back to HA to set the light brightness.
Unfortunately it does not change the light brightness. Being a beginner with this, I miss being able to debug and see values of variables etc. so use a trial and error approach that leads to lots of questions!
I’m certainly no expert either. I haven’t tried this sort of complexity. I just noted this from the esphome docs:
data_template ( Optional , mapping): Optional template data to pass along with the service call. This is evaluated on the Home Assistant side with Home Assistant’s templating engine.
Thanks again, @tom_l - every little helps, so they say, and you have got me closer to solving this and helped me understand that aspect so I really do appreciate your help!
Good question , @123! Actually I hadn’t given the value much thought - at this stage I am simply trying to get the logic sorted - I’ll amend the values to suit if / when I get it working properly.