Hi,
I have a perl script that runs on my Pi (where FHEM is running) and updates a file with a 0 or 1.
I would like FHEM to read that file at certain times (AT command) and depending on the file contents (0 or 1) do an action (or not).
I am stuck: how to get FHEM to read the file ?
Thanks !
How about using a custom reading?
https://fhem.de/commandref.html#CustomReadings (https://fhem.de/commandref.html#CustomReadings)
Hi,
Thanks, it works OK. For those interested:
I have a Perl script that checks the weather forecast for my town and writes 0 or 1 in the status.txt file, depending if there will be sunshine or not.
Then FHEM reads the file and puts off the heater if sunshine is expected.
In fhem.cfg:
define myMeteo CustomReadings
attr myMeteo interval 3600
attr myMeteo readingDefinitions chauff:qx(cat /mnt/PiBackup/Chauffage/status.txt)
define Chauffage_6 at *06:01:00 IF ([myMeteo:chauff] eq "0") (set 0_Chaudiere off)
Hi,
for your Info, there is also a perl function inside FHEM -> https://wiki.fhem.de/wiki/DevelopmentModuleAPI#FileRead
Unfortunately this doku is in german.
Otto