Drayton Wiser Thermostat Binding

Can anybody point me in the right direction for setting schedules from OpenHAB.

I’ve set everything up and all is working with my sitemaps etc but I’m struggling with anyway to implement schedule setting. My reason for wanting this is that I work shifts so find myself constantly having to alter schedules, it’s bad enough for one room but for 4 or 5. My old Netatmo used to have the facility to set numerous schedule plans for the week which you could set from a drop down menu i.e. Mornings, Afternoon or Nights.

I’ve read about setting triggers from Google calendar but haven’t gone down that route yet, I don’t know what the “trigger” would look like?

I only installed OpenHAB a couple of weeks ago and have not really done much with it yet.

I may be totally wrong about how to go about this but I was thinking of trying the following as a simple way to add something to the Basic UI which would use the Wiser Heat app to create schdules and the OpenHAB Basic UI to switch between them:

  1. Add a couple of Selection or Switch elements to the sitemap to “Load Heating Schedule” or “Save Heating Schedule” with the choices corresponding to the different schedules (eg “Mornings”, “Afternoons”, “Nights”). Save current choice using the mapdb Persistence Service.

  2. Add rules which would trigger when the user changes the state of these items and loops through all the rooms (and hot water) and sets or gets the schedule string using the mapdb Persistence Service to save the schedule string. (See https://community.openhab.org/t/drayton-wiser-thermostat-binding/35640/184).

Can somebody please help me configuring my persistence file for grafana and influx.

I’ve set up both grafana and influx and all seem working OK but I can’t get my head around how to get any data to come through.

Thanks in advance

This is my influxdb.persist file. Saves data from everything in the group ‘gHeating’ every time it changes or once an hour.

Strategies {
    everyMinute : "0 * * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
}

Items {
    gHeating*   : strategy = everyChange, everyHour
}

@andrew-schofield - love your work getting Wiser enabled on OpenHAB. I know that there were calls for more openness of the API…

Can I suggest you try using the suffix “?schema” on some of your RESTful GET calls? You may just see a JSON Schema of the expected result.

Drayton will probably turn that feature off in next firmware update when they see this post… @Drayton - please let guys tinker with this API - its got so much potential if you just let people be curious and explore their own hardware that they have bought.

Hope you can get this working - its been a while since I worked there…

After many frustrations I seem to have managed to get the Basic UI switching between schedules created on the Wiser Heat app. The Heating Boilerplate Tutorial was very helpful but with a Drayton Wiser system I think it is better to use openHAB to change schedules rather than having every room in manual mode and using openHAB to change set point temperatures.

This is a simplified version of how I setup my system to switch between a schedule for when I am at work during the day and a shedule for when I am at home.

I created a heating.items file containing:

String Heating_Schedule            "Heating Schedule [%s]"
String Save_Heating_Schedule       "Save Heating Mode [%s]"

Group HS
String FF_LivingRoom_Schedule      "Living Room Heating Schedule [%s]" (HS) {channel="draytonwiser:room:deadbeef:livingroom:masterSchedule"}
String FF_Kitchen_Schedule         "Kitchen Heating Schedule [%s]"     (HS) {channel="draytonwiser:room:deadbeef:kitchen:masterSchedule"}

Group HS_Home
String FF_LivingRoom_Schedule_Home "Living Room Heating Schedule [%s]" (HS_Home) 
String FF_Kitchen_Schedule_Home    "Kitchen Heating Schedule [%s]"     (HS_Home) 

Group HS_Work
String FF_LivingRoom_Schedule_Work "Living Room Heating Schedule [%s]" (HS_Work) 
String FF_Kitchen_Schedule_Work    "Kitchen Heating Schedule [%s]"     (HS_Work) 

a heating.rules file containing:

val String prep_schedule_re = "s/\\{\"id\":\\d*,(.*),\"Type\":\"Heating\"\\}/\\{$1\\}/"
val String strip_home_re = "s/^(.*)_Home$/$1/"
val String strip_work_re = "s/^(.*)_Work$/$1/"

rule "Apply Heating Schedule"
when
    Item Heating_Schedule received command
then
    switch receivedCommand {
        case "HOME": {
		    HS_Home.members.forEach[ i | sendCommand(transform("REGEX", strip_home_re, i.name), i.state.toString) ]
			Save_Heating_Schedule.postUpdate("HOME")
			logInfo("heating.rules", "Applied Home heating schedule")
        }
        case "WORK": {
		    HS_Work.members.forEach[ i | sendCommand(transform("REGEX", strip_work_re, i.name), i.state.toString) ]
			Save_Heating_Schedule.postUpdate("WORK")
			logInfo("heating.rules", "Applied Work heating schedule")
        }
    }
end

rule "Save Heating Schedule"
when
    Item Save_Heating_Schedule received command
then
    switch receivedCommand {
        case "HOME": {
		    HS.members.forEach[ i | postUpdate(i.name+"_Home", transform("REGEX", prep_schedule_re, i.state.toString)) ]
			Heating_Schedule.postUpdate("HOME")
			logInfo("heating.rules", "Saved Home heating schedule")
        }
        case "WORK": {
		    HS.members.forEach[ i | postUpdate(i.name+"_Work", transform("REGEX", prep_schedule_re, i.state.toString)) ]
			Heating_Schedule.postUpdate("WORK")
			logInfo("heating.rules", "Saved Work heating schedule")
        }
    }
end

a mapdb.persist file containing:

Strategies {
    default = everyChange
}
Items {
    Heating_Schedule        : strategy = everyChange, restoreOnStartup
    HS*, HS_Home*, HS_Work* : strategy = everyChange, restoreOnStartup
}

and a home.sitemap file which included:

sitemap home label="Home" {
    Frame label="Choose Heating Schedule" icon="radiator" {
        Selection item=Heating_Schedule label="Heating Schedule []"
     		mappings=[
                HOME="Home",
                WORK="Work"
            ]
     }

// ...

    Frame label="Program Heating Schedule" icon="radiator" {
        Selection item=Save_Heating_Schedule label="Copy from Wiser Heat to []"
     		mappings=[
                HOME="Home",
                WORK="Work"
            ]
    }
}

Getting the rules working was the most frustrating thing. I tried to use a javascript transform to strip out the extra “id” and “Type” JSON items but could not get it to work and I had to resort to a regex transform.

Looks interesting.

I’m having issues trying to get the rules to work as you said.

The error states Rule ‘Apply Heating Schedule’ : The name ‘strip_work_re’ cannot be resolved to an item or type; line 27, column 67, length 13

and

Rule ‘Save Heating Schedule’ : The name ‘prep_schedule_re’ cannot be resolved to an item or type; line 45, column 77, length 16

Thanks

Do you have the RegEx Transformation installed?

There a few things I should have mentioned:

  1. You need to have the RegEx Transformation and Map Transformation installed (PaperUI -> Add-ons -> Transformations)

  2. You need to have MapDB Persistence installed (PaperUI -> Add-ons -> Persistence)

  3. You need to use the working version of the DraytonWiser Binding from https://community.openhab.org/t/drayton-wiser-thermostat-binding/35640/310

  4. I am using openHAB 2.5.0 Build #1557 (openHAB 2.5.0-SNAPSHOT version).

Hi,

Thanks for you prompt reply.

Right something is happening!

It confused me at first because the wiser app doesn’t refresh the schedules unless I close and reopen the app however in Paper UI and the logs the schedule had changed!

Where are the schedules kept in openhab?

Thanks

Hi

It is good that it is working for you.

I think openHAB polls the Wiser Heat controller periodically and updates a cache of the state in memory.

I always waited 5 minutes between changes and restarted the Wiser Heat app when testing.
With more testing it looks like the apps view of the schedule is updated when you ask to display it but is probably not being updated while it is being displayed.

Makes sense.

Do you know where OpenHAB stores the schedules it pulls from the controller?

I configured openHAB to save the schedules to the mapdb database from it in memory copy.

NB I came accross a bug #5206 in mapdb persistence service where the database will keep growing and fill the disk up. To avoid the bug use a mapdb.persist file like this:

Strategies {
    default = everyChange
}
Items {
    Heating_Schedule        : strategy = everyChange, restoreOnStartup
    HS*, HS_Home*, HS_Work* : strategy = everyChange, restoreOnStartup
}

Restarting openHAB will compact the database.

Hi,

Was this causing OpenHAB to crash?

I noticed after getting everything working after about a day OpenHAB would completely crash and not restart!

Luckily I’d made a backup disk image for my RaspPi. I’ve made the changes so let’s see what happens :crossed_fingers:

Hi,

Has anyone actually monitored how many times their hub goes offline?

Since installing OpenHAB I’m shocked, maybe my hub is faulty, I’ve tried different routers etc but am still getting up to 20 disconnections a day.

Drayton have advised me to swap the unit to rule out it being faulty.

Just curious if anyone else has noticed so many disconnections.

If you’ve installed the latest version of the binding from the marketplace then this seems to have a bug that means the bridge looks to constantly lose connection.

I uninstalled the binding through PaperUI and manually installed the previous version from Andrew’s Google drive.

Let me start by saying ‘awesome work’. I went with the wiser system as it works without internet, is from a ‘proper’ heating company and has individual room control.

I’ve had the system running (system 1, 1 thermostat, 5 trv’s) for a few months now using your binding.

I was getting constant disconnects since having it. So today I’ve done some testing and I’ve got to the root of the problem and now no disconnects.

The problem is as follows:
Drayton is set up for all rooms in my house.
I currently have 1 room left to add a trv into but this was added as a thing in the binding and the items setup ready.
This was the cause.
Although the Drayton app functions fine with the room, the binding errors out if there are NO devices present in that room.
Since removing the room from my thing file no more dropouts.

So don’t add rooms (things) for empty rooms. (Drayton app still has the room present)

Maybe this was the cause for some other users of the binding.

Been solid for 2 hours now. (Using the above, not the latest)

I spoke too soon. Was solid for about 6 hours, now back to disconnects every 15/20 mins.
Is this the binding or the hub??
I haven’t had a chance to check in detail (all my effort going into lightwave integration atm).

Does this binding work with the smart plugs?

I have to agree, this is an awesome piece of work.

I have just installed the Wiser controls and so far they seem to be working OK but I thought I would check out the signal strength to see if I might have range trouble when I try to add some new valves/stats further away. It appears that Drayton have removed the signal strength display from both the thermostat screen and the app in an “upgrade” about a year ago. I have tried to connect to the various signal strength channels in the hub and room stat things but the items stay at NULL. Could this be for the same reason?

Hub firmware version 2.36.3
Thermostat firmware version 0.32.0
(App version 3.9.0 b24)

OK solved it. I had the rooms configured as things but not the actual stats, therefore I could get temperature and humidity. I have now added the stats, which do have signal channels.