-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API v3 changes #65
Comments
Thanks for reviewing. I haven't started any programming yet - still thinking about it and I want to get to 100% correct
Good catch. So
Yes I prefer so. It keeps it clean as we may add other endpoints, like
What do you suggest for the subscriptions? Apart from the special case of MQTT should we allow device values to be set via MQTT publishes? If so how since there almost 200 device values? |
So I prefer to have similar syntax in telnet, mqtt and api.
What we have now is the optional subscription of all commands, with all hcs it's a lot, as discussed in #31:
Do you also want to change the mqtt to subpath /devices/ What i additional suggest (as feature-branch to test) is, if subscribing to direct topics, also publish the direct values, that's a lot more. But timing comes from ems-bus, on receiving ( |
I'm pretty sure
There is no
Again, call is only for commands.
This all needs to change yes. I described in the specification one solution using a
That is my number 1 goal. It's hard though. I'd rather have the API lead, then MQTT follow and the Console is really for power users and for debugging, so doesn't need to be fancy. How often are people going to change the thermostat temperature from a Telnet console?
yes, but still not 100% sure what you mean and how to get around having many subscriptions. I'll wait for the PR/feature branch and try it out. Also worth asking do we really need that level of control via MQTT now we have a more robust API? MQTT is great for capturing data and a REST API is better at calling commands. The same as with Home Assistant. |
Sure it is, there was discussion #43. Exactly it is only value without command for cascaded heatingsources:
and value and command for the main heating source.
At this point i can't follow. Why is it wrong? How to change the flowtemp without a command? [mqtt]
The command subscriptions are in the code since #31, in dev and main branche, setting My enhancement is publishing all data as individual values, each with it's own topic and a single value. These are no additional subscriptions, it's only publishing, but a lot of values.
I prefer the mqtt, api has to be polled, mqtt can publish on change. |
ok. I'll leave it. Too much of a headache and I have other things I need to work on |
most of this was added to #173. A few things didnt make it or were not necessary. Such as the HTTP timeout is something that the client needs to add to the request (not EMS-ESP) and the size of the JWT passcode is according to the spec on https://jwt.io/ and needs to be large since EMS-ESP is not a valid Auth server. |
From the discussion at https://github.com/emsesp/EMS-ESP32/discussions/61 and the previous work done in #50 here's the new specification. Coding will be done in the ft_apiv3 feature branch. This issue will be updated to reflect any changes.
Commands
send
,publish
,fetch
, andreset
. And these are top-level, so there is no need for a System context anymore.seltemp
,selflowtemp
) are not commands as they were in v2.via console:
call
command.$ call <context> <command> <data>
where<context>
is eithersystem
ordallasensor
or an EMS device likeboiler
. e.g.$
call system publish`` or$ call system send "12 13 14"
.su
in the Console.show set log help watch
are specific only to the telnet console.via REST API:
/api/send
and take an optional JSON body. They only use HTTP POST and authentication is required, either as a Bearer HTTP header or as aaccess_token
query parameter in the URL.api/pin
will take a JSON body{gpio: <number>, value: <boolean>}
.show
and note exposed as regular commands. Theshow
command will display all EMS and Dallas Sensor data in short-name format (see below).HTTP/1.1 401 Unauthorized {"message": "OK"}
HTTP/1.1 400 Bad Request {"message":"Problems parsing JSON"}
HTTP/1.1 401 Unauthorized {"message": "Bad credentials"}
Device & Device Values
seltemp
) and a full-name ("Selected Temperature"). The full-name is what is shown in the Web UI.temp
orhatemp
orhamode
which is required for Home Assistant.via console:
$ call {device} {name} <value>
e.g.call thermostat seltemp 20
. The value is transposed in the code to a JSON object{"value":<value>}
to keep to the same API standard.via REST API:
/api/devices/{device}/:name
.name
is the short-name.hc
orwwc
path can be added in the URL, e.g./api/devices/thermostat/hc2
GET /api/devices/thermostat/hc1/seltemp
. If thename
is omitted then all the "name:value" pairs will be listed (e.g.GET /api/devices/thermostat
)./api/devices
lists all devices"Authorization: Bearer {ACCESS_TOKEN}"
or using theaccess_token
query parameter in the URL. e.g.POST /api/devices/thermostat/hc1/seltemp
with a body{"value":20}
will set the room temperature to 20 degrees."hc":<number>"
and a mixing unit a warm water circuit number"wwc":<number>
.cmd
,data
andid
as query parameters ([http://ems-esp/api?device](http://ems-esp/api?device=)=<device>&cmd=<command>&data=<data>&id=<id>
) is no longer supported. Note, this will be a breaking change.HTTP/1.1 400 Bad Request {"message":"Problems parsing JSON"}
HTTP/1.1 200 Bad Request {"message":"OK"}
Dallas Sensors
dallassensor
tosensor
.via console:
show
command the sensor data will be listed. For exampleshow
orshow sensors
.via REST API:
/api/sensors
and returns all the sensor valuesSummary of API endpoints
GET to fetch data, POST with authentication token/header and a JSON body to set data.
/api/devices
(GET only)/api/devices/thermostat[/hc<n>]/:name
/api/devices/boiler/:name
/api/devices/mixer/:name
/api/devices/solar/:name
/api/sensor:sensorid
(GET only)/api/{command}
(POST only)over MQTT
/api/
. For example clients can subscribe toems-esp/devices/thermostat
and send a payload with a JSON{name:"seltemp", "hc":2,"value":22}
and alsoems-esp/devices/boiler/selflowtemp
with a payload{"value":60}
.ems-esp/devices/thermostat/hc2
.To change
info_short
,info
andcommands
api/devices
that lists all the devices and their characteristics (not values)api/devices/{device}
to return all values and properties of a deviceapi/sensors
to list all the sensors are their values/api/system/send
becomes/api/send
ems-esp/system
but justems-esp
show sensor
and the/api/sensor
endpoint for the Dallas SensorsThe text was updated successfully, but these errors were encountered: