Closed dimov-cz closed 1 year ago
Please use the latest code from the active branch (development)
the commands are send to either
szCommandTopic = pSensor->mode_command_topic;
or
szCommandTopic = pSensor->preset_mode_command_topic;
As far as I know all is working correctly. Do you experience any issues? If yes, in this case, please post the complete config topic name and contents, as well as the state topic(s) and payload
Hi, thanks for fast reply.
I don't have a specific configuration, as I am creating a new one and experimenting with different possibilities to make it work with Domoticz. Therefore, I am looking for the simplest solution that will maximize compatibility with different autodiscovery servers and leverage the full potential of Domoticz implementation, ideally without relying on JSON and templates.
Overall, things are going well, but I am struggling with the "mode_state_template" feature. I would prefer not to use templates in my setup, but without "mode_state_template," the select options are not populated with values (only the first value appears). On the other hand, if I use "mode_state_template," the select options are populated correctly, and the input state value is correctly applied. However, I encounter an error when sending commands because the system tries to use "mode_state_template" in the context of sending commands. This surprises me because, according to the documentation, "mode_command_topic" should use "mode_command_template" and not "mode_state_template."
Yes, you could be right here! But... I have been working on a MQTT issue and here was no mode_command_template in the config And to het this working, we had to use the state_template, see below issue:
https://github.com/domoticz/domoticz/issues/5521
I made some changes, could you test beta 15212?
Could you post your config topic + payload?
@dimov-cz Some changes were made in beta, Could you post your config topic + payload? Else issue will be closed due to no response....
I have another climate related problem:
config template: homeassistant/climate/thermostat1/config
{"unique_id":"TRV-1","name": "TRV1-setpoint",
"~":"shellies/trv-xxx/",
"temperature_command_topic": "~thermostat/0/command/target_t",
"temperature_state_template": "{{ value_json.thermostats[0].target_t.value }}",
"temperature_state_topic": "~info",
"temperature_unit": "C",
"precision": 0.1,
"temp_step": 0.5,
"max_temp": 31,
"min_temp": 4
}
Test data:
shellies/trv-xxx/info
{
"thermostats": [
{
"pos": -1,
"target_t": {
"enabled": true,
"value": 24.0,
"units": "C"
},
"tmp": {
"value": 17.4,
"units": "C",
"is_valid": true
},
"schedule": false,
"schedule_profile": 2,
"boost_minutes": 0
}
]
}
2023-08-23 18:39:57.714 [7f39adffb640] Error: mqttad: Climate device unhandled temperature_state_template (TRV-1)
I think that temperature_state_template is implemented in Domoticz, but value_json.thermostats[0].target_t.value is too deep structure or array type is not supported?
@enesbcs , Thanks for the template. It was not to deep, there is no limitation for this, but we did not support arrays yet. Actually, why this is an array puzzles me, there seems to be no reason for this. Anyway, happy to tell you I just made a patch and it should work now in beta 15515
Thank you, it works perfectly in new beta Domoticz! ( I have no clue why Allterco programmers choose an array for holding thermostat data in the Shelly TRV. :) )
Closing this issue, no feedback from @dimov-cz
After struggling to correctly set up the climate unit MQTT, I am wondering if we are sure about this: https://github.com/domoticz/domoticz/blob/f9b9ac7748d3133f68ff3d16b5aaa4d981cda93c/hardware/MQTTAutoDiscover.cpp#L3609
According to the documentation at https://www.home-assistant.io/integrations/climate.mqtt/, it seems to me that we should be using the mode_command_template (and preset_mode_command_template) to create commands. Or..?