This is something I've always wanted to get control of. In the past, I've had to constantly "tweak" my humidifier's "humidistat" during the winter. Down when its colder, up when it's warmer. Not anymore! Here's how I did it, including the note I typed in the rule for my future reference. I'm sure there are other (probably simpler and cleaner) ways to build a rule like this, but this one seems to be working for me.
-----Begin Rule Notes Here-----
Controls condensation on windows by using forecast data to adjust indoor humidity. Uses mathematical relationship between outdoor temperature and indoor humidity as developed by @jmaxxz in his app "Ideal Indoor (Winter) Humidity Calculator." Only runs if outdoor temperatures are expected to be below 50 degrees. Requires a humidity sensor, weather forecast data (OpenWeatherMap), and a humidifier controlled by a smart plug.
Step 0: Create and assign variables as necessary.
Step 1: Pull forecast data from OpenWeatherMap and determine lowest temperature in the next 48-72 hours.
Step 2: Do the math. The form of the relationship is Ax^2 + Bx + C, where A, B, and C are constants as determined by @jmaxxz. Since variable math is limited to a single operation per line, variables X, Y, Z, and U are established as intermediate steps in calculating V, the target indoor humidity.
Step 3: Target humidity is compared to the established minimum and maximum allowable values and the global variable Humidity-SP is set accordingly.
Step 4: The humidity setpoint is compared to the actual humidity. If the value is outside of the setpoint +/- the set deadband, the humidifer device is turned on or off as needed. If within the deadband, no action is taken.
Notes: The hum-offset has a direct effect on the target humidity calculated (variable V). Example, setting a the value of hum-offset to a value of 5 will increase (V) by an equivalent amount. Negative values will decrease (V). This can be used to raise or lower the humidity based on comfort, observed condensation, etc. Note that Humidity-SP will still be limited to values between hum-min and hum-max.