basically you’re on the right way…
just think of it as if the PIR sensor isn’t there as this is the main task of the rule: make sure, there’s enough
water in the bowl, so basically
- Trigger: distance from the sensor
- rule: if > 45 pump until 36
- exception: dog is around
- make sure, your item names never have Special characters like blanks and stuff (Ultrasonic Sensor)
- make sure, your item names never have names like internal commands or names (Switch)
step 1: make sure, the bowl is not empty:
rule "Waterlevel"
when
Item UltrasonicSensor changed
then
if (UltrasonicSensor.state > 45) { // turn pump on, if state is > 45cm
SwitchPump.sendCommand(ON)
}
if (UltrasonicSensor.state < 36) {
SwitchPump.sendCommand(Off)
}
end
(you noticed, the UltrasonicSensor
has no blanks and SwitchPump
doesn’t resemble the item Switch
anymore)
so, problem is, the pump will stop immediately after reaching 45cm again as the trigger is the ultrasonic sensor’s state - it won’t reach 36cm at all in that rule. so, there are many ways to overcome this, the simplest one would be to count how long the pump needs to fill the bowl with 10cm of water. The rule would then trigger the pump and you’ll need a way to stop the pump after xx seconds. Let’s just say, the pump needs 30secs.
so, the improved rule is:
rule "Waterlevel"
when
Item UltrasonicSensor changed
then
var Timer timer = null // define a timer variable
if (UltrasonicSensor.state > 45) { // turn pump on, if state is > 45cm
timer = Timer.createTimer(now.plusSeconds(30) [| // start the timer with 30secs
SwitchPump.sendCommand(ON)
timer = null // reset the timer
])
}
end
To make it more elegant and to save some codelines, you could
- use expire-binding
- automatically set the switch-item for the pump to OFF after 30secs.
So, for that you have to install the expire-binding.
Now, you define the time until the SwitchPump is set to OFF again in the items-definition
Switch SwitchPump { <<YOURSWITCHBINDING>>, expire="30s,command=OFF" }
(just add , expire="30s,command=OFF"
at your existing item.
So, the rule can be simple as that:
rule "Waterlevel"
when
Item UltrasonicSensor changed
then
if (UltrasonicSensor.state > 45) { // turn pump on, if state is > 45cm
SwitchPump.sendCommand(ON)
}
end
the SwitchPump will turn ON if the bowl is empty and the expire-binding will turn it OFF after 30secs.
Step 2: add the dog
so, now you only have to overrule the dog.
could be simple:
rule "Waterlevel"
when
Item UltrasonicSensor changed
then
if (UltrasonicSensor.state > 45 && PIRdogSensor.state == OFF) { //turn pump on, if state is > 45cm and if dog isn`t around
SwitchPump.sendCommand(ON)
}
end
so, problem could be, that the water isn’t condensing fast enough and is only at 45cm if dog IS around. 
So, in that case, I would just add another trigger, if dog isn’t around anymore (and has the bowl left empty):
rule "Waterlevel"
when
Item UltrasonicSensor changed or
Item PIRdogSensor changed
then
if (UltrasonicSensor.state > 45 && PIRdogSensor.state == OFF) { //turn pump on, if state is > 45cm and if dog isn`t around
SwitchPump.sendCommand(ON)
}
end
So, I basically made your homework, but I hope, you learned something from it and you can continue learning OH2! 
cheers,
Thomas.