Control humidity and temperature in house

Hello Apilio Community,

With the help I got in another post, I cleared the last hurdle to my main home automation plan. So hopefully, by way of passing it forward, here is what I am doing in case it’s useful to someone else…

@DanT - Thanks for prompting that I should post up what I’m doing…

Here goes…

So I come from a software development background, albeit not really much on the tools myself (manager type) but I know enough to be dangerous…

We have an airbnb property in Australia, about 1000kms from our main residence. We haven’t been able to visit much due to covid. When we last managed to travel there I wasn’t happy with the smell of mould which ended up being mostly the rugs. Of course, the cause is consistently high humidity. So I set out to fix the issue. Secondly, in extreme weather conditions (hot and cold), if guests don’t put the (reverse cycle) aircon on soon enough the place takes a long, long time to heat up (when cold) or cool down (when hot). This is relatively common if guests go out for the day, or more recently turn off the heating overnight…

So the use case is this:

  1. When the house is occupied (either by ourselves or guests), the main criteria to control is temperature. The aim is to control the temperature to be within a comfortable range (say 21-25 degrees Celsius, but to be finalised),
  2. When the house is unoccupied, the main criteria is humidity. The aim is to control the humidity to be within a range that inhibits growth of mould (ideally < 50% relative humidity, but < 60% probably ok).

As an aside, I also have to comply with some fire safety legislation changes from 1st Jan 2022. I have chosen Nest Protect in its entirety to do this, principally because I will get alerted when smoke is detected. Handy when the property isn’t occupied.

Solution:

Inputs

  • Temperature and humidity
    Ubibot WS1 Pro - Full REST API available

Outputs

  • Daikin A/C units with Daikin Airbase BRP15B61
    Relatively easy to decode non-public API with internet sources

  • Dedicated Dehumidifier(s) plugged into TP-Link Kasa smart plug - (I believe there is a decoded non-public API available too but this has IFTTT integration so using that instead)

  • Flair Smart Vents (not yet tested)
    REST API
    Ability to open roof vents in high temp conditions and close them in low temp conditions (when humidity levels allow)

Integration and Control

  • Raspberry Pi Python 3.x custom code - All co-ordination of inputs/outputs

  • Apilio

    1. All IFTTT integration as needed
    1. Cloud based variable storage of both current/actual/output values, and target (input) variables. Particularly temperature and humidity. Principally so I don’t need to have ports open to my home infrastructure. The Raspberry Pi ‘polls’ Apilio for new input values periodically (every 1 min).
    1. Watchdog to see if network to house is down and alert if it is
  • IFTTT
    TP-Link Kasa smart plug integration

Still very much a work in progress. I’m going to order those Flair Smart vents and test those out next but reviews are good so hopeful that’ll work.

Hope someone finds this useful (or at least interesting).

BTW - A digression, with Apilio’s REST API it seems to me it is a REST API for IFTTT too. In as much as, since Apilio and IFTTT have good integration, it appears to me to be the case that Apilio provides a REST API to any IFTTT compatible device.

3 Likes

Thanks James, a fantastic level of detail. I think that will help a lot of folks. Thank you :bowing_man:

Grandios! Very nice article, thanks for sharing.
What device states do you store in Apilio? Can‘t you access the UbiBot data directly?

Yes you can see Apilio acting as a async REST interface to IFTTT data for some data :slightly_smiling_face:

2 Likes

Hi @pebneter

What device states do you store in Apilio?

The truth is I haven’t finished yet. The diagram above is a high level plan for development. What I currently have in Apilio is near real time temperature and humidity readings for each UbiBot (i.e. real inputs). Also, I have a number of configuration variables (non-real inputs), particularly thresholds (and recovery thresholds) which will drive behaviour.
Future plans for variables in Apilio include:
a) Bias to control temperature or humidity
b) Whether aircon action is global or not (i.e. all 6 rooms controlled together or individually)
c) Inputs for aircon status (on/off, target temp, airflow, mode), i.e. what to drive the aircon to (for manual control)
d) Outputs for aircon status (on/off, target temp, airflow, mode), i.e. what drive action has been achieved (for both manual or programmatic control)
e) Outputs for dehumidifier status (on/off) for programmatic control, i.e. what drive action has been achieved

The major advantage for me in using Apilio is so that I can create an outbound only https connection (Home to Apilio) . Thus I haven’t created a security weakness in my home infrastructure that could be exploitable. Sure I may have to wait a minute or two for Raspberry Pi to poll Apilio for new values but that’s fine for me.

BTW - It seems Flair are having problems with production. As an alternative I may opt to attach ducting to an extractor fan instead (some extractor fans have automatic vent shutting) and use the TP-Link Kasa Apilio/IFTTT integration for that too. Bit of experimentation required here.

Can‘t you access the UbiBot data directly?

Not in the way I’d like. Without using the UbiBot REST API the only other option (I can see) is to use a UbiBot IFTTT trigger (i.e. the IF) with Apilio as the “That” to load a variable. As the UbiBot IFTTT triggers can only be defined when crossing a threshold there’s no practical way to get a real time value into Apilio.

you can see Apilio acting as a async REST interface to IFTTT data for some data :slightly_smiling_face:

Yes. Very happy with it.

Thanks for all the hard work.

2 Likes

Thanks for your detailed explanation!

1 Like

Looks a great solution, but I have a solution that does not depend on the REST API.

Without using the UbiBot REST API the only other option (I can see) is to use a UbiBot IFTTT trigger (i.e. the IF) with Apilio as the “That” to load a variable. As the UbiBot IFTTT triggers can only be defined when crossing a threshold there’s no practical way to get a real time value into Apilio.

It is indeed possible to get the information from the Ubibot via IFTTT by adding a query to the Ubibot “History of Sensor Data Received”, though it does need a bit of filter code to extract the relevant values. The advantage seems to be that it is much easier to use the direct Ubibot IFTTT interface rather than the more obscure REST commands.

My Implementation

In the example below, an Apilio numeric variable is used to store the latest temperature value. For my purposes I’m interested in getting the external probe temperature (which is Field8), but the code below can be easily adjusted to get any of the other Ubibot readings.

I use Apilio to create a regular event (for my purposes every 4 min, as my Ubibot is set only to take readings every 5 min), but configure as required.

The Apilio event is then used as a trigger in IFTTT “If This” (Receive an event from Apilio)

Add a query to Ubibot for “History of Sensor Data Received”

Set the “Then That” to be “Update a numeric variable” in Apilio

Add Filter code:

let length = Ubibot.historyOfSensorDataReceived.length;
let i=0;
let extTemp = ‘’;

for (i=0; i<length; i++) {
if (Ubibot.historyOfSensorDataReceived[i].Field8 != ‘’) {
extTemp = Ubibot.historyOfSensorDataReceived[i].Field8;
break;
}
}

if (extTemp == ‘’) {
// we don’t have a value for the external temperature, so stop processing
Apilio.numericVariableSetValueUpdates.skip();
}
else {
var pointNum = parseFloat(extTemp);
Apilio.numericVariableSetValueUpdates.setVariableValue(pointNum);
}

3 Likes

That’s a really excellent addition, thanks!