A Clojure library to query and configure Honeywell EVO Home (aka TCC) installations.
The library interacts with the REST API of the cloud service. Those servers do the actual talking with your Honeywell devices. That is, you need an internet connection.
There are two main components of the library; the low-level namespace
fourteatoo.clj-evohome.api
which just wraps the REST API. And the
higher-level namespace fourteatoo.clj-evohome.core
which provides
a friendlier interface to the API.
Require the library in your source code:
(require '[fourteatoo.clj-evohome.api :as api])
Additionally you may want to require the higher-level interface
(require '[fourteatoo.clj-evohome.core :as capi])
api
namespace)In your code, first you need to authenticate yourself with the server
(def c (api/authenticate-client "username" "password"))
Get information about your account
(def acc-info (api/get-user-account c))
List all the installations belonging to a user
(def insts (api/get-installations c (:user-id acc-info)))
Get the installation at a specific location
(def inst1 (api/get-installation-at-location c (get-in (first insts) [:location-info :location-id])))
Get a system status and change its mode
(def system (-> inst1
:gateways
first
:temperature-control-systems
first))
(api/get-system-status c (:system-id system))
(api/set-system-mode c (:system-id system) :day-off)
Get a specific zone's schedule
(def zone (first (:zones system)))
(def sched (api/get-zone-schedule c (:zone-id zone)))
Set a zone schedule
(api/set-zone-schedule c (:zone-id zone) sched)
Override a zone temperature
(api/set-zone-temperature c (:zone-id zone) 17.5)
Cancel a zone override
(api/cancel-zone-override c (:zone-id zone))
Get a location status
(api/get-location-status c (get-in inst1 [:location-info :location-id]))
core
namespace)Although the fourteatoo.clj-evohome.api
namespace provides the
essential functionality of the REST API, beside the authentication
mechanism, not much is provided in terms of abstraction.
In the namespace fourteatoo.clj-evohome.core
there is a thin layer
atop the basic fourteatoo.clj-evohome.api
. It simplifies aspects
like addressing your objects by path, rather than ID. The names
asssigned by the user become identifiers. Locations can be identified
with strings like "Home" or "Shop" and zones can be addressed by their
path, like ["Home" "Bedroom"] or ["Shop" "Toilet"]. Internally a copy
of the installation is cached, to reduce the amount of queries. That
means, there will be a delay between, say, the installation of a new
thermostat and its appearence in you application. Unless that's
something you do frequently, it hardly matters.
or you can create your own local documentation with:
$ lein codox
and then read it with your favorite browser
$ firefox target/doc/index.html
The topology of the EVO Home system sees the user as the owner of an installation. The installation is a collection of locations. To a location belong one or more gateways. To a gateway belong one or more temperature control systems. Each temperature control system has a number of zones; the actuators and sensors. Physically, if you bought an EvoTouch panel, the temperature control system is also the gateway.
A single apartment installation has typically just one location, one gateway, one temperature control system (which is the gateway too) and several zones (one for each room).
All these components have a globally unique ID. That is, all the API primitives require just the zone, location, or system ID, to uniquely identify your device/area. The locations and the zones have a name, too, that can be assigned by the user. The locations will have names like "Home" or "Office", while zones will have names like "Kitchen", "Bedroom", "Kids", "Livingroom", etc.
The low-level API requires you to use the IDs, while there is an
higher-level layer that allows you to use name paths, to identify your
devices. That is ["Home" "Kitchen"]
rather than the zone ID
"162534"
.
Temperature control systems have user-defined modes. Those are always
referenced by name; names such as :day-off
, :away
, :auto
, etc.
The function api/set-system-mode
works on a specific control system,
not on the entire location it belongs to. The function
capi/set-location-mode
applies the mode to all the systems belonging
to the same location, provided the mode is supported by all the
systems within.
Copyright © 2022 Walter C. Pelissero
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close