dfrommi / openhab-tado

No longer maintained. This binding is now part of the official openHAB distribution
https://github.com/openhab/openhab2-addons/tree/master/addons/binding/org.openhab.binding.tado
MIT License
6 stars 1 forks source link

Fix `tadoHvacChange` action #4

Open dfrommi opened 6 years ago

dfrommi commented 6 years ago

The binding ships with a static method to create overrides from rules. But rules can't access the static method and they also don't know the return type HvacChange.

Some help from OpenHAB pros will be required to fix it.

dfrommi commented 6 years ago

Description for README file. Removed until issue is fixed to avoid confusion:

tado° Actions

CURRENTLY NOT WORKING! RULES CANNOT FIND ACTION CLASS

hvacChange

The binding ships with an action to define overrides.

It's ok to not provide all properties. The action then fills the missing pieces with reasonable defaults.

Entry point: org.openhab.binding.tado.TadoActions.hvacChange(thingRegistry, zoneThingName)

Methods:

Name Description Operation
followSchedule() Back to smart schedule OperationMode := SCHEDULE
activeForever() Active until cancelled manually OperationMode := MANUAL
activeUntilChange() Active until next schedule block is reached or home switches to AWAY mode. OperationMode := UNTIL_CHANGE
activeFor(minutes) Active for specified duration OperationMode := TIMER and timerDuration := minutes
withTemperature(degrees) Set target temperature targetTemperature := degrees
withHvacMode(mode) Sets HVAC mode to one of OFF, HEAT, COOL, DRY, FAN, AUTO HvacMode := mode
withSwing(swingOn) Sets swing. true is swing ON, false is OFF swing := swingOn
withFanSpeed(speed) Sets fan speed to one of AUTO, LOW, MIDDLE, HIGH fanspeed := speed
apply() Applies the override. Has to be called last. Without it, nothing will be send to the tado° cloud.

Example: Boot scene rule (full heat for 30 minutes), triggered by a switch item

import org.openhab.binding.tado.TadoActions

rule "Activate Heating Boost"
  when
    Item HeatingBoost received command ON
  then
    TadoActions.hvacChange(things, "tado:zone:demo:heating")
      .activeFor(30)
      .withHvacMode("HEAT")
      .withTemperature(25)
      .apply()

    HeatingBoost.postUpdate(OFF)
end
dfrommi commented 6 years ago

Question raised in OpenHAB forum here

kaikreuzer commented 6 years ago

Just a short info: We have a story in the ESH backlog, which will deal with introducing the possibility of declaring rule actions within a binding: https://github.com/eclipse/smarthome/projects/3#card-8298857

I guess this is just what you would want here - you will need a little more patience, though...

dfrommi commented 6 years ago

@kaikreuzer Thanks. Looking forward to it.