I have an RFID system to open my front door. So I have write a python script to retrieve the last person who opened the door (from a CSV URL). Now I would like to save it in HA to display it in Lovelace and have an history but I don’t now exactly how to do that.
I guess I have to create a sensor type entity to store a string ? How can I create one without using a specific platform ? Can I create it directly from python ?
When I will have my entity, I will probably do an automation script to trigger the python script on each door opening. But how can I store the value in my entity (probably with hass.states.set) ?
I’m trying to do some progress but I think I have a new problem. I just see that python_scripts run in a sandbox env so I can’t import urllib2 in my python code. I need this to retrieve CSV data from my RFID door system.
Is there a way to force it or should I use another way to do this (but which way) ?
I’m not sure to understand MQTT but I can’t see how it will work in my case. My RFID system can’t send anyhing so I’m pretty sure I need a Python script (or other script) somewhere to retrieve the value from the CSV file. I also don’t want to run a script externally. I really would like to have everything in HA.
If I’m wrong, can you please explain a bit further what I should do with MQTT ?
I’m not sure the file sensor will work because my CSV file is available by HTTPS only and need authentication. I also need to post process the line to have exactly what I need.
command_line seems to be interesting … I just need to be able to send value back … I will try this.
command_line call the script every 60 sec by default. I will now search if I can start an update manually so I can use a longer interval and ask for update directly after the door has opened (I have a binary_sensor for this).
Note : on Hassio we also need to install python3 :