Hi all, I’m trying to achieve something that seemed to be simple, but turns out to be very hard for me to do…
I’ve got an RFID card reader, which sends the code to HA when a badge is scanned.
I got this value in sensor.card_id_3.
Then I wanted to have a list of users, which can be mapped to a specific code.
Also I wanted to be able to configure if they are allowed access or not.
Or even only during specific times…
So… I started making a bunch of variables with the idea of creating the automation later on.
But now I really don’t know how to make the automations… Let alone flexible…
So this is what I got so far:
A bunch of hardcoded variables for each user:
input_text:
wieganduser1name:
name: Naam
wieganduser1code:
name: Code
input_select:
wieganduser1accesstype:
name: Access Type
options:
- Nooit
- Altijd
- Soms
input_boolean:
wieganduser1accessday1:
name: Maandag
wieganduser1accessday2:
name: Dinsdag
input_datetime:
wieganduser1day1from:
name: Maandag vanaf
has_date: false
has_time: true
wieganduser1day1to:
name: Maandag tot
has_date: false
has_time: true
But this list of variables becomes HUGE (5 days for each user, 10 times for each user, …)
I think I am doing something wrong here already… But I’m not sure how to go about this?
Then the automations, I thought to trigger when sensor.card_id_3 changes.
Then I would need to find if the code is configured. Right now I’d need to check for every variable. But isn’t there a way to make a list to loop through or something?
And then I still need to check what’s the access type… Nooit=Never, Altijd=Always, Soms=Sometimes and then I need to go start checking and comparing the days and hours.
First thing to get right is setting up the variables in the right way I think.
Any tips on that?