Configure lights controlled by Siemens logo PLC using node-red

Hi,

I tried to search for an answer here and on youtube but without success. I hope the community will point me at the correct way.

My setup:

  • Using Siemens LOGO 8.3 PLC to control all lights in my house
  • Homeassistant running on RPi4
  • Node-red successfuly installed and running on the same RPi4 as HA
  • Node-red communicates with LOGO using S7 protocol and with HA it is integrated with HACS node-red compaion.

In Node red I have flows for all lights. Practicaly it means I have button entity that allows me to turn on/off the light. This button is propagated to Home assistant and works like a charm. With one button I am able to turn on or off my light (any). I have also configured sensor output that reports current state of the light, so I am gettin from sensor values True (ligh is on), False (light is off).

What I want to do, is to be able to control my lights not as buttons but as Lights.
To be able to set automations to turn on some light when something happens. Currently I am only able to say, hit the button when something happens (triggers the state).

I tried to use template light, but I probably dont fully understand how it works. Would somebody be willing to help me with my usecase?

I just updated the original question. I was able to configure node-red to get the satus, so now I have only True/Flase for lights (without any unknown). But still I am not sure how to configure light out of it.

So, if somebody will be in the same position here is the result.
Template light is the answer.

here is just an example how I solved it (I know it is super simple, I am just new to this)

#### Bodovky pracovna ####
- platform: template
  lights:
    bodovky_pracovna:
      unique_id: "bodovky_pracovna"
      friendly_name: "Bodovky pracovna"
      value_template: "{{ states('sensor.bodovky_pracovna_stav')}}"
      turn_on:
        service: button.press
        target:
          entity_id: button.bodovky_pracovna
      turn_off:
        service: button.press
        target:
          entity_id: button.bodovky_pracovna