Input_select and set_state

I have a piece of test code which logs the user selection. however when i attempt to load the input_select with my own options it loads the options into the lsit but when the user chnages the selection this doesnt log.

code snippit:

import hassapi as hass
import asyncio
import bleak
from bleak import BleakScanner, BleakClient


class test(hass.Hass):

    async def initialize(self):
        await self.listen_state(self.scan_ble, "input_boolean.ble_scan_button", new="on")
        await self.listen_state(self.confirm_ble, "input_boolean.confirm_ble_device", new="on")
        self.listen_state(self.device_Selection, "input_select.test")

    def device_Selection(self, entity, attribute, old, new, kwargs):
        selected_option = self.get_state(entity)
        self.log(selected_option)

    async def scan_ble(self, entity, attribute, old, new, kwargs):
        self.options = ["a", "b", "c", "d"]
        self.set_state("input_select.test", options=self.options)
        self.log("here")

    async def confirm_ble(self, entity, attribute, old, new, kwargs):
        self.log("there")

log:

2023-03-04 06:02:50.013817 INFO AppDaemon: Reloading Module: /conf/apps/test.py
2023-03-04 06:02:50.022347 INFO AppDaemon: Initializing app test_script using class test from module test
2023-03-04 06:02:54.921163 INFO test_script: Option 2
2023-03-04 06:02:58.298493 INFO test_script: Option 1
2023-03-04 06:03:03.239741 INFO test_script: here

I’m presuming im loading the entity incorrectly but can’t see where i’m going wrong.

EDIT: I should add i can see the values back at the dev tools but it will not detect the change:

input_select.test
testing list
Option 1	options: a, b, c, d
editable: false
friendly_name: testing list

Might be of use to someone else. i personally spent a few days stuck on this. The issue was as expected i should have been using the call_service function :tired_face:

import hassapi as hass
import asyncio
import bleak
from bleak import BleakScanner, BleakClient


class test(hass.Hass):

    async def initialize(self):
        await self.listen_state(self.scan_ble, "input_boolean.ble_scan_button", new="on")
        await self.listen_state(self.confirm_ble, "input_boolean.confirm_ble_device", new="on")
        self.listen_event(self.device_Selection, "state_changed", entity_id="input_select.test")

    def device_Selection(self, event_name, data, kwargs):
        selected_option = self.get_state("input_select.test")
        self.log(selected_option)

    async def scan_ble(self, entity, attribute, old, new, kwargs):
        self.options = ["a", "b", "c", "d"]
        self.call_service("input_select/set_options", entity_id="input_select.test", options=self.options)
        selected_option = self.get_state("input_select.test")
        self.log(selected_option)
        self.log("here")

    async def confirm_ble(self, entity, attribute, old, new, kwargs):
        self.log("there")