Upgrade ExternalTaskSensor using SmartSensors

I’m trying to upgrade the ExternalTaskSensor using SmartSensors, I’ve seen videos about how to do it for the FileSensor and found it helpful. I found that, since the ExternalTaskSensor uses the execution_date to check for the other DAG, it needs to be passed to the newly created SmartSensor, otherwise I get a KeyError for the execution date, I tried overriding the get_poke_context method, from BaseSensorOperator, within the SmartExternalSensor to pass the execution date; but I get a ERROR - Object of type DateTime is not JSON serializable message while Airflow tries to register the sensor as a SmartSensor while calling the get_poke_context using json.dumps within the sensorinstance.py file.

I also tried passing the execution date (within the overriden get_poke_context method) as a string but get an error saying 'str' object has no attribute 'isoformat' from the ExternalTaskSensor file, so I know that I must pass a datetime object for the execution_date but I get cut off by the JSON error.

I thought of adding a piece of code similar to the one in:

to the sensorinstance.py file for it to accept datetime objects but it didn’t seem like the right approach.

How can I approach this implementation?

Which version of Airflow are you running?

Can you provide an example of the Sensor so I can try to replicate the issue?