Efficient training of deep learning models from time series data for Internet of Things (IoT) systems requires a good understanding of the domain, particularly if the training is automated for large scale applications. Heterogeneous Graph Neural Networks (HGNNs) are a promising approach for incorporating domain knowledge into the modeling framework and consequently improving model performance. However, encoding domain knowledge into HGNNs is non-trivial for IoT systems and requires substantial manual effort. This complicates the adoption of HGNNs in practical settings. To overcome this drawback, we propose a framework for the automatic derivation of HGNN features by semantically parsing equations present in scientific and dedicated publications. We encode the derived features considering physical causation from these equations into an HGNN using an underlying Transformer for prediction and anomaly detection. We validate our approach using two IoT use cases, namely, the prediction of the remaining energy in the battery of an electric race car and the anomaly detection during pick and place operations in a robot workcell. We demonstrate that our approach significantly outperforms other competitive techniques.