Virtual sensors in Hass

Hi
Been running an old version of Hassbian with home assistant but after getting a Pi4 I also upgraded the Home Assistant and is now running Hass.io v 0.103.0.
I’ve moved around my tradfri lights from tradfri bridge to hue, and all buttons, remotes etc to deconz.
So far all is ok, but when I tried to integrate my virtual sensors I used Before I can’t get them to work.
I have a bunch of input_select: boxes set for different light scenes and states for presence detections and corresponding virtual sensors checking the status of the input select boxes. By checking these sensors I could trigger automations depending on the the Choice of the input_selection box.
Now these sensors never show up.

examplke of the input_select, that actually works:

input_select:
  farstun_scene_status_dropdown:
    name: 'Farstuns Scener'
    options:
      - 'Dag'
      - 'Natt'
      - 'Av'
    initial: 'Av'

The status of the selection was detected by this:

sensor:
  - platform: template
    sensors:
       farstun_scene_status:
        value_template: '{{ states.input_select.farstun_scene_status_dropdown.state }}'
        friendly_name: 'Scener i farstun'

Reading up on this I know it is better to format the template as states(…) but the problem is that I can’t get the system to add this sensor at all. Any Idea to how to solve this?

Why not use the input_select directly in the automation? That doesn’t make sense to create a sensor that reflects the state of an input select, just use the input_select directly. Or you have a specific reason to have a sensor?

However your template not working is strange, I tested it and it works without a problem.

I know, but there are several reasons.
Basically it is a way to get around limitations in the triggers setting the scenes as well as making it possible to let different units trigger next step in a sequence.
I used it initially for presence detections where I needed 4 states for a persons presence while NMAP only could give 2. This was to eliminate false triggers.
Since I had this working I thought it was irrtating that I couldn’t get it to work after the upgrade.
But You mean You got a sensor that detected the input selection with the code given?

peculiar, now it works…
Aint that typical, just need to cry help and the problem solved itself…
Thanks anyway :wink:

I don’t use a sensor for that, I use the input_select. None of your reasons justifies creating a sensor that reads the input_select in my opinion. Can you show me one of these automations or scripts or whatever?

I have a couple that do that. I didn’t want the option selectable on the frontend, so I use them just to display the state of that input

This sounds reasonable. But it didn’t sound to me like he set it up for this reason.

That were just some of the reasons, and there are probably better ways as well. However, the main problem, getting a binary trigger to trig multiple states and securing no mistriggers was the main reason and since rhis should work without the front-end that’s where I landed. The original idea came from someone else. Don’t think I have kept who that was.