Replies: 21 comments 33 replies
-
I'm also interested if it is possible to use Aqara Thermostat E1 in Zigbee2Mqtt with other temperature sensor (similar to Aqara home app; Maybe something with "bind" ? .... ). |
Beta Was this translation helpful? Give feedback.
-
Looks like this is in progress here: #13993 but I'm not educated enough to help. |
Beta Was this translation helpful? Give feedback.
-
I can switch from internal to external. But how do i tell it which one is used for temperatur? |
Beta Was this translation helpful? Give feedback.
-
I also got this update but ... the same question: How do I make use of the new "external" option ? |
Beta Was this translation helpful? Give feedback.
-
I'm a newbie to HA, but I got this to work (using zigbee2mqtt_edge, but with the current update of zigbee2mqtt this should work without using edge. Otherwise you don't see Sensor Internal/External). This is all info from here. What we are going to do : every change in temperature in the external sensor will be a trigger to update the temperature in the valve. To begin with add your external sensor and give it a name. In this example I will refer to a temperature-sensor in the kitchen and also a valve in the kitchen. Now to get it to work :First in Settings/Addons/zigbee2mqtt under Device/Exposes - set Sensor to External (and this got reset for me a few times so check regularly if it's still External). Then in Settings/Automations and Scenes : Here you need to switch to YAML editor. Press three dots top right and pick "Edit in YAML". Otherwise you get errors and nothing gets saved.Action :
#Radiator_Kitchen is my name for the valve in the kitchen It takes sometimes a few minutes to update the current temperature in the SRTS-A01. But it works. |
Beta Was this translation helpful? Give feedback.
-
As an example to be shure that your TRV is in External Sensor mode and of course to ation over more than one of them: `alias: TH_Kitchen set temp
tips: |
Beta Was this translation helpful? Give feedback.
-
Without HA, it can't be done now? |
Beta Was this translation helpful? Give feedback.
-
Did Not work for me :( Can Anyone Post a Full yaml with external Sensor when the State is Update? Thx id: '1668962927938'
|
Beta Was this translation helpful? Give feedback.
-
Hi, Does anybody else get regular timeout errors when setting the temp through Home Assistant? I setup an automation in Home Assistant to update the local temperature with an external temperature when they get outside a certain range from each other. It triggers about once every 5+ minutes when the a radiator is in heat mode and once every 30+ minutes when they are off. Overall it works but it gets timeout errors in Zigbee2mqtt a bit too often to my liking. Is there something I can change to improve reliability? Debug Data: Device Status: Automation Action: |
Beta Was this translation helpful? Give feedback.
-
Worked pretty well for me! Thanks for sharing. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi, a little bit offtopic but not entierely: |
Beta Was this translation helpful? Give feedback.
-
If anybody is interested in an openHAB rule, here is mine:
Of course you have to change the mqtt broker id and item names to match with your system (and the mqtt topic). |
Beta Was this translation helpful? Give feedback.
-
If anyone is interested, I connected the external sensor to the thermostat using Extension directly in zigbee2mqtt. Change "TermostatBedroom" and "0x00158d0008ce74e7" to your name of thermostat and ID of temperature senzor. Save this code to .js file and place it into extension directory in data directory \data\extension\MyCustomExtesion.js.
|
Beta Was this translation helpful? Give feedback.
-
@mufsupermuf iT LOOKS GREAT! Even if I do not understand all... Do you think if is feasible to set an external Thermometer refrencing it in a NR msg od an mqtt message? Any advice about it? |
Beta Was this translation helpful? Give feedback.
-
i improved the idea of @mufsupermuf to have a generic plugin: class ExternalSensorThermostatExtension {
mapping = {
// Temperature Sensor Id : Thermostat Name
"0x00158d00091e7441" : "Thermostat Küche"
// just drop in your pairs here
}
constructor(zigbee, mqtt, state, publishEntityState, eventBus, settings, logger) {
this.mqtt = mqtt;
this.logger = logger;
this.baseTopic = settings.get().mqtt.base_topic;
this.eventBus = eventBus;
// recalibrate the thermostats
Object.keys(this.mapping).forEach(sensorId => mqtt.onMessage(`${this.baseTopic}/${this.mapping[sensorId]}/set`, JSON.stringify({ calibrate: "calibrate" })))
eventBus.on('stateChange', this.onStateChange.bind(this), this.constructor.name);
logger.info(`Loaded ${this.constructor.name}`);
}
async onStateChange(data) {
const { entity, update } = data;
if (!Object.keys(this.mapping).includes(entity.ID)) { // check if Temperature Sensor
return
}
const { temperature } = update;
if (temperature === undefined) { // no temperature update
return
}
// set new temperature value to thermostat
this.mqtt.onMessage(`${this.baseTopic}/${this.mapping[entity.ID]}/set`, JSON.stringify({ sensor_temp: temperature }));
this.logger.info(`The sensor_temp of ${this.mapping[entity.ID]} was set to ${temperature}`);
}
async onMQTTMessage(topic, message) {
}
async stop() {
this.eventBus.removeListeners(this.constructor.name);
}
}
module.exports = ExternalSensorThermostatExtension; i dont know if this mapping can be stored somewhere in the zigbeemq settings stuff somehow @Koenkk ? You could build a simple UI on top of that (to somehow build and store this mapping between sensors and thermostats). |
Beta Was this translation helpful? Give feedback.
-
Speaking of converters... |
Beta Was this translation helpful? Give feedback.
-
@digitalkaoz Thank you for your Zigbee2MQTT extension. I've slightly updated it to link a sensor to multiple thermostats: class ExternalSensorThermostatExtension {
mapping = {
// Temperature Sensor Id : Thermostat Names
"0x00158d0009cbf894" : [
"Woonkamer radiator links",
"Woonkamer radiator rechts",
],
}
constructor(zigbee, mqtt, state, publishEntityState, eventBus, settings, logger) {
this.mqtt = mqtt;
this.logger = logger;
this.baseTopic = settings.get().mqtt.base_topic;
this.eventBus = eventBus;
// recalibrate the thermostats
Object.keys(this.mapping).forEach(
sensorId => this.mapping[sensorId].forEach(
thermostatName => {
mqtt.onMessage(`${this.baseTopic}/${thermostatName}/set`, JSON.stringify({calibrate: "calibrate"}));
logger.info(`Calibrated ${thermostatName}`);
}
)
)
eventBus.on('stateChange', this.onStateChange.bind(this), this.constructor.name);
logger.info(`Loaded ${this.constructor.name}`);
}
async onStateChange(data) {
const { entity, update } = data;
if (!Object.keys(this.mapping).includes(entity.ID)) { // check if Temperature Sensor
return
}
const { temperature } = update;
if (temperature === undefined) { // no temperature update
return
}
// set new temperature value to thermostats
this.mapping[entity.ID].forEach(
thermostatName => {
this.mqtt.onMessage(`${this.baseTopic}/${thermostatName}/set`, JSON.stringify({ sensor_temp: temperature }));
this.logger.info(`The sensor_temp of ${thermostatName} was set to ${temperature}`);
}
)
}
async onMQTTMessage(topic, message) {
}
async stop() {
this.eventBus.removeListeners(this.constructor.name);
}
}
module.exports = ExternalSensorThermostatExtension; I'm new to JavaScript, so feel free to point out errors. For those using Home Assistant OS with Studio Code Serve: the |
Beta Was this translation helpful? Give feedback.
-
Something changed in one of the updates and TRVs don't have Full script: class ExternalSensorThermostatExtension {
mapping = {
// Temperature Sensor Id : Thermostat Names
"0x00158d00044f0829" : [
"Thermostat_Bathroom",
],
"0x00158d00049fb9c6" : [
"Thermostat_Office",
"Thermostat_Living-Room",
],
"0x00158d0004ab6053" : [
"Thermostat_Bedroom",
],
}
constructor(zigbee, mqtt, state, publishEntityState, eventBus, settings, logger) {
this.mqtt = mqtt;
this.logger = logger;
this.baseTopic = settings.get().mqtt.base_topic;
this.eventBus = eventBus;
// recalibrate the thermostats
Object.keys(this.mapping).forEach(
sensorId => this.mapping[sensorId].forEach(
thermostatName => {
mqtt.onMessage(`${this.baseTopic}/${thermostatName}/set`, JSON.stringify({calibrate: "calibrate"}));
logger.info(`Calibrated ${thermostatName}`);
}
)
)
eventBus.on('stateChange', this.onStateChange.bind(this), this.constructor.name);
logger.info(`Loaded ${this.constructor.name}`);
}
async onStateChange(data) {
const { entity, update } = data;
if (!Object.keys(this.mapping).includes(entity.ID)) { // check if Temperature Sensor
return
}
const { temperature } = update;
if (temperature === undefined) { // no temperature update
return
}
// set new temperature value to thermostats
this.mapping[entity.ID].forEach(
thermostatName => {
this.mqtt.onMessage(`${this.baseTopic}/${thermostatName}/set`, JSON.stringify({ external_temperature_input: temperature }));
this.logger.info(`The external_temperature_input of ${thermostatName} was set to ${temperature}`);
}
)
}
async onMQTTMessage(topic, message) {
}
async stop() {
this.eventBus.removeListeners(this.constructor.name);
}
}
module.exports = ExternalSensorThermostatExtension; |
Beta Was this translation helpful? Give feedback.
-
For me the external_temperature_input is unavailable in HA. Looks like it is fine in z2m. |
Beta Was this translation helpful? Give feedback.
-
At the same time, it works like this
|
Beta Was this translation helpful? Give feedback.
-
I was wondering if anyone is using the Xiaomi SRTS-A01 thermostat with an external temperature sensor. It is stated that this is supported by the device, but not sure how to implement it through Z2M. My main question is how to inform the device about the external temperature. Is it perhaps the away_preset_temperature the way to do it? Or perhaps this feature is not yet supported?
Beta Was this translation helpful? Give feedback.
All reactions