-
-
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
MQTT settings for Boolean Format are changing API V3 Output #76
Comments
MQTT boolean format should not affect the API, I agree, and should be fixed. But we should define how to handle booleans in the API. It was in my original proposal for the V3 API but not implemented yet. It should be true/false I think, not 1 or 0 ? |
also related, the API should not return the enumm or min/max if it's a boolean type // http://ems-esp/api/boiler/heatingactivated
{
"name": "heatingactivated",
"fullname": "heating activated",
"value": true,
"type": "boolean",
"min": 0,
"max": 1,
"enum": [
false,
true
],
"unit": " ",
"writeable": true
} |
I would recommend 1/0 for booleans. Graphs are easier with numeric values. Enums are more important to be numeric ! |
I use numeric values for booleans within the ioBroker adapter to easyly integrate them into flot graphs. Important for me is while changing the State-Value in ioBroker the http post to ems-esp should accept numeric and/or boolean values. |
Googling it the OpenAPI standard for booleans is true/false. Also in the JSON spec so I'll implement that way. If you want 1/0 then we'll need to build in a formatter setting as we did with MQTT |
Not necessary. I already built this transformation (boolean -> number) into the ioBroker Adapter for http get. |
By the way: km200 gateway returns numeric values (0/1) for boolean states. I think to be consistant with IP-gateways from Bosch-Group might be a strong argument as well. |
I think the KM200 is just old tech. Bosch also use the OpenAPI standard for all their modern devices. The spec is on https://developer.bosch.com/web/bosch-thermotechnology-device-api/devices |
Will be interesting im IP-Gateways will be open with documented API. Until now Bosch was refusing to open specs. Hopefully they will do soon. I can live the booleans but just tell me if you will accept 1/0 for posts. Since I integrate km200 and ems-esp with today's status I will transform in the ioBroker adapter to numerical values to be consistant unless changed by Bosch in the future. |
I know Bosch are working on hard on this. I met their Chief Expert (Georg Grütter) this week who's driving their Innersource/Opensource initiative. https://www.bosch.com/research/know-how/open-and-inner-source/ For POSTs EMS-ESP will continue to accept all formats (1/0, true/false, yes/no, "1","0") so you're ok there. |
As far as I understood this Bosch API will be a (priced) cloud service. I hope that local LAN request to devices like km200 will not be blocked in the future.
Have you got any feedback if Bosch plans to open documentation on ems telegrams? Or what would this initiative mean for the ems-esp project?
Good to hear, so I do not need to adjust. |
I tested b8 version. There are some changes on boolean but they are inconsistant. Enum still unchanged. In a single field with API the values true/false changed as discussed. (thermostat.hc1.summermode = true) On enum values there are no changes. So numeric values only with mqtt settings 0/1 |
I missed the single values, I'll change that. enum is how I designed and wrote it. It represents a list of valid options. In the code it's actually called This is how it looks now: http://ems-esp/api/boiler/maintenance
{
"name": "maintenance",
"fullname": "maintenance scheduled",
"value": "off",
"type": "enum",
"enum": [
"off",
"time",
"date"
],
"writeable": true
} |
I can't reproduce for single values. I get for example: http://ems-esp/api/boiler/wwcirc
{
"name": "wwcirc",
"fullname": "ww circulation active",
"circuit": "ww",
"value": false,
"type": "boolean",
"writeable": true
} can you provide a screenshot or browser capture for summermode? I don't have an RC300 so can't test |
What ever the name is enum, lsit, options or range. I just recognized that in ems-esp some of the "allowedValues" / "enums" start with 1 rather then 0. The ioBroker Adapter has 2 loops: The field values I need as numeric values. Actually I get them by setting in mqqt 1/0 for boolean values. |
http://ems-esp/api/boiler/wwcirc I get the same result. |
just to add: |
The enums (or whatever we end up calling it) always return strings. This is how the data is interpreted and displayed to the end-user in the console, web and MQTT payloads. For most people using the KM200's internal numerical mapping will make no sense at all. Remember the EMS-ESP is not a replacement for the KM200. And it's not just for Bosch either. For example, The thermostat's heating type outputs You can see all the enums at Line 299 in e99c920
What I could do is include the index (starting at 0) in the API output along side the string value? |
The IMO it is the best to move the option back to global settings and rename it to
|
@MichaelDvP This is a good proposal to use global option settings for output format. At the end enum values should correspond to km200 allowedValues numbers. I would just recommend that the global settings then should be valid for mqtt, api and webui. For enums webui should show value and text e.g. 1 (light), 2 (medium) .... for building. There is no empty option btw... And try to define if post commands are independent of the settings and accept all formats or just the one set in global settings. In the moment the ioBroker adapter sends numeric values in post commands. This is working fine and for enums this is actually defined by min / max values. e.g. the thermostat.building has a min of 1 and max of 3. |
remember the reason why I added the Boolean Format in the first place was because stupid Domoticz only accepted "ON" and "OFF" in MQTT. That could be a reason to keep API and MQTT boolean formats separate. Also the webUI is supposed to be user-friendly. Show "Heating" as "on" is a lot more intuitive than showing it as "true". The rendering happens in the web code (and translated) and is not affected by any of the EMS-ESP's boolean settings. |
Oh, i remembered the capital |
ok, so changes are
|
yes for single fields but min/max needs to be specified. |
@proddy You have closed this issue. But as far as I can see the global settings for API formats are not yet implemented in v3.1.2b0. I have to admit that I lost the overview what is already implemented and what not in respect to API V3. |
this issue fixed the "MQTT settings for Boolean Format are changing API V3 Output". For your changes either create a new issue or add to #65 I don't plan to implement anything new in the API for a while since we're all arguing on what it should be. I'll eventually implement #65 and document it, when I decide how it should be. |
I opened an ioBroker Forum Thread for asking other users to test the ems-esp adapter.
I got replies and recognized the following issue:
The MQTT Boolean Format settings are changing the rest api output. This is independent if MQTT is active or not.
When format 1/0 is chosen the API returns numeric values for boolean and enum fields.
All other formats return the respective text strings.
MQTT settings should not have an impact on API format and return values for enum / boolean should be always numbers.
The same for settings (changing values) !
The text was updated successfully, but these errors were encountered: