PyMonitorMQTT
FileRead Sensor
This sensor reports the content of a specified file
Compatibility
- macOS
- Linux
- Windows
Data and Topics
.../file/file
basic
Content of the file
Configuration
custom_topics
optional
List of String
List of topics to which the sensor will send the data.
If the sensor sends to a single topic, you will have to put one topic in the list.
If the sensor sends to more than one topic, you can register more topics; each topic in the list will be assigned in the same order as topics are added from the single sensor (order that you can check in the each individual sensor file).
If the sensor sends to a single topic, you will have to put one topic in the list.
If the sensor sends to more than one topic, you can register more topics; each topic in the list will be assigned in the same order as topics are added from the single sensor (order that you can check in the each individual sensor file).
contents
required
Dictionary
Dictionary where you should put the data you want to pass to the sensor.
filename
required
String
Filename of the file you want the script to read. The script must have read access to the file to work.
Examples
Content of a file with specified topic
This configuration sends to the default topic (that you can find upper in the page) the content of the plex.txt file in the ‘C:/Users/PC’ folder
- FileRead:
contents:
filename: "C:\Users\PC\plex.txt"
Content of a file with specified topic
This configuration sends to the specified custom topic the content of the plex.txt file in the ‘C:/Users/PC’ folder
- FileRead:
custom_topics:
- myfile/content
contents:
filename: "C:\Users\PC\plex.txt"