Skip to content
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

BTH-RM230Z - Missing Cooling Mode #7357

Closed
l3rdy opened this issue Apr 7, 2024 · 54 comments · Fixed by #7484
Closed

BTH-RM230Z - Missing Cooling Mode #7357

l3rdy opened this issue Apr 7, 2024 · 54 comments · Fixed by #7484

Comments

@l3rdy
Copy link

l3rdy commented Apr 7, 2024

The same goes for the BTH-RM - Room thermostat II (Battery model). I don't have one but looking at the Manual it also should have a Cooling Mode.

I got the Bosch Room Thermostat II (230V) and I noticed there's no option for switching to cooling mode currently.
When factory resetting the Device and setting it up without a connection, I can choose between Cooling or Heating on the Device, but it doesn't expose the Mode nor does it let me switch it in Z2MQTT.

I can see the correct running state & cooling setpoint when changing it on the Device (since I can't change it in Z2MQTT)

"occupied_cooling_setpoint": 21,
"occupied_heating_setpoint": 22.5,
"pi_heating_demand": 100,
"running_state": "cool",
"setpoint_change_source": "schedule",
"system_mode": "auto",

EDIT: To give a bit more context (if needed)
There are a few Different Operation Modes and how you can run it.

A short excerpt from the Manual

"In the event that an initial start-up is required without
a Smart Home system (e.g. new build), basic settings
can be made on the device via an installer mode.
To this end, press and hold the rotary knob for
at least 3 seconds until the display shows “INS”. By
turning the knob you can make a selection and
confirm the selection by pressing it."

image

Once you manually set it, you're locked in and can only change the temperature (Basically). With the Bosch Smart Home Controller, you can change between the Operation Modes (not necessarily relevant here) and between Cooling/Heating, which unfortunately is not possible on the device itself. (Only has Status LEDs)

@burmistrzak
Copy link
Contributor

@l3rdy 👋
I've been doing some work on the Bosch converters recently. Slowly validating and (hopefully) improving them, while migrating my entire setup to Z2M.
I don't have a use for the cooling mode personally, but I'll try looking into it, when finally validating the BTH-RM230Z.
But feel free to give it a shot yourself. 😊

@burmistrzak
Copy link
Contributor

burmistrzak commented Apr 7, 2024

@l3rdy You're talking about the "Climate Manager" settings, right?

Edit: Relevant threads (in German)

@l3rdy
Copy link
Author

l3rdy commented Apr 7, 2024

I've seen your work. 😁 I also tried looking in as much as I can, but my knowledge is limited when it comes to the deep end of this.

I will happily contribute with some Help. I would absolutely love to try to fix it.
I'm not sure if there's a way where I can locally test and tweak things (would I do it with the external_converter, just like when adding a new unsupported Device or how to I tweak/test configs?)

@burmistrzak
Copy link
Contributor

burmistrzak commented Apr 7, 2024

I will happily contribute with some Help. I would absolutely love to try to fix it. I'm not sure if there's a way where I can locally test and tweak things (would I do it with the external_converter, just like when adding a new unsupported Device or how to I tweak/test configs?)

Honestly, easiest thing is just editing the bosch.js (not .ts) file directly and restarting Z2M. 😅
Depending on your setup, you'll find that file here: <Z2M_ROOT>/node_modules/zigbee-herdsman-converters/devices/bosch.js

Edit: You can try adding cool here and here. Might be enough, but you'll probably also need to patch the fzLocal.bosch_thermostat converter to get the correct state.

@l3rdy
Copy link
Author

l3rdy commented Apr 7, 2024

ahhh I see. Awesome. Will try :)

@burmistrzak
Copy link
Contributor

ahhh I see. Awesome. Will try :)

Have fun! Also see my edit for some unseful hints. 😉

@l3rdy
Copy link
Author

l3rdy commented Apr 9, 2024

Ahh. I Should've looked at your comment earlier. (Would've known I'm on the right track then)
I had a config ready, it got me closer. Added the cool everywhere and made the occupied_heating_setpoint expose, so I can control it

I also looked at the converter after seeing your edits and added the mode there.. Tho, I'm not sure if that did anything yet.

It exposes everything I need, I can control the Cooling Temperature on the Device I reset and put into cooling mode.
I can toggle the System Modes in Z2MQTT, but It doesn't change it on the Device yet.

After I toggle everything, the Device always returns to Heat System Mode in Z2MQTT and the running state also changes to Heat, but when refreshing the State changes back to cool.

2024-04-09-09-47-33

I suppose that might be the Issue?

When I look in the Dev console, I get:
Read result of 'hvacThermostat': {"runningState":2} no matter what, unless I go System Mode - off then it's 0. Not sure if that correlates.

@burmistrzak
Copy link
Contributor

I suppose that might be the Issue?

Yes, you're on the right track! 💪
You'll also have to figure out, which of these unknown modes actually represents the cooling mode.
And lastly, make sure the cool opMode gets passed along correctly.

@l3rdy
Copy link
Author

l3rdy commented Apr 16, 2024

Just a little Update

with following in the Dev console, I can actually change between Heating & Cooling

Wrote '{"ctrlSeqeOfOper":0}' to 'hvacThermostat' //cooling only
Wrote '{"ctrlSeqeOfOper":2}' to 'hvacThermostat' //heating only

It successfully switches on the Device

So it actually isn't a opMode
So this also make more sense to me, I guess

const opModes: KeyValue = {0: 'auto', 1: 'heat', 2: 'unknown_2', 3: 'unknown_3', 4: 'unknown_4', 5: 'off'};

actually is more like

const opModes: KeyValue = {0: 'auto', 1: 'heat/cool' or 'manual', 2: 'unknown_2', 3: 'unknown_3', 4: 'unknown_4', 5: 'off'};

and you switch with the ctrlSeqeOfOper

@burmistrzak
Copy link
Contributor

burmistrzak commented May 2, 2024

@l3rdy Just did my first bit of research on the device.
Here're all the supported default attributes:

{
"occupiedCoolingSetpoint":2300,
"occupiedHeatingSetpoint":450,
"systemMode":0,
"occupancy":0,
"ctrlSeqeOfOper":2,
"setpointChangeSource":2,
"tempSetpointHold":0,
"programingOperMode":0,
"minHeatSetpointLimit":500,
"maxHeatSetpointLimit":3000,
"minSetpointDeadBand":25,
"minCoolSetpointLimit":500,
"maxCoolSetpointLimit":3000,
"localTemperatureCalibration":0,
"localTemp":2160
}

As you can see, ctrlSeqeOfOper and systemMode are among them. So quite a few default attributes have been implemented by Bosch.

Regarding ControlSequenceOfOperation you've used, let me quote the ZCL spec:

The ControlSequenceOfOperation attribute specifies the overall operating environment of the thermostat, and thus the possible system modes that the thermostat can operate in. It SHALL be set to one of the non-reserved values in Table 6-15. (Note: it is not mandatory to support all values).

Value Description Possible Values of SystemMode
0x00 Cooling Only Heat and Emergency are not possible
0x01 Cooling With Reheat Heat and Emergency are not possible
0x02 Heating Only Cool and precooling (see 6.1.2) are not possible
0x03 Heating With Reheat Cool and precooling are not possible
0x04 Cooling and Heating 4-pipes (see 1.3.2) All modes are possible
0x05 Cooling and Heating 4-pipes with Reheat All modes are possible

And SystemMode:

The SystemMode attribute specifies the current operating mode of the thermostat, It SHALL be set to one of the non-reserved values in Table 6-16, as limited by Table 6-17. (Note: It is not mandatory to support all values).

Attribute Value Description
0x00 Off
0x01 Auto
0x03 Cool
0x04 Heat
0x05 Emergency heating
0x06 Precooling (see 6.1.2)
0x07 Fan only
0x08 Dry
0x09 Sleep

The interpretation of the Heat, Cool and Auto values of SystemMode is shown in Table 6-17.

Attribute Values Temperature Below Heat Setpoint Temperature Between Heat Setpoint and Cool Setpoint Temperature Above Cool Setpoint
Heat Temperature below target Temperature on target Temperature on target
Cool Temperature on target Temperature on target Temperature above target
Auto Temperature below target Temperature on target Temperature above target

I guess, we'll have to set ControlSequenceOfOperation first during setup, before changing SystemMode?
Never mind, Bosch is obviously not using the attributes according to spec... Probably the reason why their devices aren't certified. 😬
I'll likely have to do some sniffing to find the manufacturer-specific commands to switch modes.

@burmistrzak
Copy link
Contributor

burmistrzak commented May 2, 2024

<rant>
Actually, it's more effort to develop Zigbee devices that aren't following the ZCL specification. You'll have to come up with custom clusters, strip out existing attributes, and so forth.
I can only assume, but it's highly likely that this is done in a deliberate effort to limit compatibility across vendors, and lock you into a manufacturer's system.

Enabling manufacturer-specific clusters is the worst mistake the Zigbee Alliance has ever made, it's effectively hurting the entire Zigbee ecosystem. 99% of use-cases and device types are already covered by ZCL, there's no reason to reinvent the wheel, except turning your devices into e-waste in case you have the wrong bridge.
</rant>

Edit: @l3rdy Obviously, this little rant wasn't directed at you. I'm just amazed by the amount of work that gets done, simply to ensure products aren't interoperable. 🙃

@l3rdy
Copy link
Author

l3rdy commented May 2, 2024

Sorry for leaving you in the dark for a bit.
I tried some stuff and basically just went to removing/uncommenting everything and see what works and what doesn't at some point since I unfortunately can't sniff traffic currently.

I have the following configs that kinda work rn

Here

bosch_thermostat: {
    cluster: 'hvacThermostat',
    type: ['attributeReport', 'readResponse'],
    convert: (model, msg, publish, options, meta) => {
        const result = {};
        const data = msg.data;
        if (data.hasOwnProperty(0x4040)) {
            result.remote_temperature = utils.precisionRound(data[0x4040] / 100, 1);
        }
        if (data.hasOwnProperty(0x4042)) {
            result.window_detection = (Object.keys(stateOffOn)[data[0x4042]]);
        }
        if (data.hasOwnProperty(0x4043)) {
            result.boost = (Object.keys(stateOffOn)[data[0x4043]]);
        }
        //if (data.hasOwnProperty(0x4007)) {
        //    const opModes = { 0: 'auto', 1: 'heat', 2: 'unknown_2', 3: 'unknown_3', 4: 'unknown_4', 5: 'off' };
        //    result.system_mode = opModes[data[0x4007]];
        //}
        //if (data.hasOwnProperty(0x4020)) {
        //    const demand = data[0x4020];
        //    result.pi_heating_demand = demand;
        //    result.running_state = demand > 0 ? 'heat' : 'idle';
        //}
        if (data.hasOwnProperty(0x4022)) {
            result.valve_adapt_status = utils.getFromLookupByValue(data[0x4022], adaptationStatus);
            if (data[0x4022] === adaptationStatus.calibration_in_progress) {
                result.valve_adapt_process = true;
            }
            else {
                result.valve_adapt_process = false;
            }
        }
        return result;
    }

Here

    {
        zigbeeModel: ['RBSH-RTH0-ZB-EU'],
        model: 'BTH-RM230Z',
        vendor: 'Bosch',
        description: 'Room thermostat II 230V',
        fromZigbee: [
            fromZigbee_1.default.humidity,
            fromZigbee_1.default.thermostat,
            fzLocal.bosch_thermostat,
            fzLocal.bosch_userInterface,
        ],
        toZigbee: [
            toZigbee_1.default.thermostat_occupied_heating_setpoint,
            toZigbee_1.default.thermostat_control_sequence_of_operation,
            toZigbee_1.default.thermostat_occupied_cooling_setpoint,
            toZigbee_1.default.thermostat_local_temperature_calibration,
            toZigbee_1.default.thermostat_local_temperature,
            toZigbee_1.default.thermostat_keypad_lockout,
            toZigbee_1.default.thermostat_running_state,
            tzLocal.bosch_thermostat,
            tzLocal.bosch_userInterface,
        ],
        exposes: [
            e.climate()
                .withLocalTemperature()
                .withSetpoint('occupied_heating_setpoint', 5, 30, 0.5)
                .withSetpoint('occupied_cooling_setpoint', 5, 30, 0.5)
                .withLocalTemperatureCalibration(-12, 12, 0.5)
                .withSystemMode(['off', 'heat', 'cool', 'auto'])
                .withRunningState(['idle', 'heat', 'cool'], ea.STATE_GET)
                .withControlSequenceOfOperation(['cooling_only', 'heating_only'], ea.ALL),
            e.humidity(),
            e.binary('boost', ea.ALL, 'ON', 'OFF').withDescription('Activate Boost heating'),
            e.binary('window_detection', ea.ALL, 'ON', 'OFF').withDescription('Window open'),
            e.child_lock().setAccess('state', ea.ALL),
            e.numeric('display_ontime', ea.ALL).withValueMin(5).withValueMax(30).withDescription('Specifies the display On-time'),
            e.numeric('display_brightness', ea.ALL).withValueMin(0).withValueMax(10).withDescription('Specifies the brightness value of the display'),
            e.enum('setpoint_change_source', ea.STATE, Object.keys(setpointSource))
                .withDescription('States where the current setpoint originated'),
            //e.enum('valve_adapt_status', ea.STATE, Object.keys(adaptationStatus))
            //    .withLabel('Adaptation status')
            //    .withDescription('Specifies the current status of the valve adaptation')
            //    .withCategory('diagnostic'),
            //e.binary('valve_adapt_process', ea.ALL, true, false)
            //    .withLabel('Trigger adaptation process')
            //    .withDescription('Trigger the valve adaptation process. Only possible when adaptation status ' +
            //    'is "ready_to_calibrate" or "error".')
            //    .withCategory('config'),
        ],
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'hvacThermostat', 'hvacUserInterfaceCfg', 'msRelativeHumidity']);
            await reporting.thermostatOccupiedHeatingSetpoint(endpoint);
            //await reporting.thermostatOccupiedCoolingSetpoint(endpoint); //maybe not neeeded
            await reporting.thermostatTemperature(endpoint);
            await reporting.thermostatKeypadLockMode(endpoint);
            await reporting.humidity(endpoint);
            // Report setpoint_change_source
            await endpoint.configureReporting('hvacThermostat', [{
                attribute: 'setpointChangeSource',
                minimumReportInterval: 0,
                maximumReportInterval: constants.repInterval.HOUR * 12,
                reportableChange: null,
            }]);
            // report operating_mode (system_mode)
            await endpoint.configureReporting('hvacThermostat', [{
                    attribute: { ID: 0x4007, type: zigbee_herdsman_1.Zcl.DataType.enum8 },
                    minimumReportInterval: 0,
                    maximumReportInterval: constants.repInterval.HOUR,
                    reportableChange: 1,
                }], manufacturerOptions);
            // report pi_heating_demand (valve opening)
            await endpoint.configureReporting('hvacThermostat', [{
                    attribute: { ID: 0x4020, type: zigbee_herdsman_1.Zcl.DataType.enum8 },
                    minimumReportInterval: 0,
                    maximumReportInterval: constants.repInterval.HOUR,
                    reportableChange: 1,
                }], manufacturerOptions);
            // report window_detection
            await endpoint.configureReporting('hvacThermostat', [{
                    attribute: { ID: 0x4042, type: zigbee_herdsman_1.Zcl.DataType.enum8 },
                    minimumReportInterval: 0,
                    maximumReportInterval: constants.repInterval.HOUR,
                    reportableChange: 1,
                }], manufacturerOptions);
            //// Report valve_adapt_status (adaptation status)
            //await endpoint.configureReporting('hvacThermostat', [{
            //    attribute: { ID: 0x4022, type: zigbee_herdsman_1.Zcl.DataType.enum8 },
            //    minimumReportInterval: 0,
            //    maximumReportInterval: constants.repInterval.HOUR * 12,
            //    reportableChange: null,
            //    }], manufacturerOptions);
            // report boost as it's disabled by thermostat after 5 minutes
            await endpoint.configureReporting('hvacThermostat', [{
                    attribute: { ID: 0x4043, type: zigbee_herdsman_1.Zcl.DataType.enum8 },
                    minimumReportInterval: 0,
                    maximumReportInterval: constants.repInterval.HOUR,
                    reportableChange: 1,
                }], manufacturerOptions);
            await endpoint.read('hvacThermostat', ['localTemperatureCalibration', 'setpointChangeSource']);
            await endpoint.read('hvacThermostat', [0x4007, 0x4020, 0x4042, 0x4043], manufacturerOptions);
            //await endpoint.read('hvacThermostat', [0x4007, 0x4020, 0x4022, 0x4042, 0x4043], manufacturerOptions);            
            await endpoint.read('hvacUserInterfaceCfg', ['keypadLockout']);
            await endpoint.read('hvacUserInterfaceCfg', [0x403a, 0x403b], manufacturerOptions);
        },
    },

With this, going into the DEV Console and writing the SystemMode to 3 changes the Mode to Cool and also changes the ControlSequenceOfOperation to cooling only & with Mode 4 to heat and heating only. (fixing the whole issues, just not as nice and clean as it should and not with the exposed button's haha)

System Mode 0 turns it off/pauses it

One thing that's now not working anymore is the pi_heating_demand always being at 0 and the pi_cooling_demand always is null, but I couldn't find the right attribute ID so far Is Probably the Problem here. At first, with the original config, it also showed values for pi_heating_demand even when in cooling mode.

@burmistrzak
Copy link
Contributor

@l3rdy No worries! Looks promising.
Just did a packet capture with a SHC Gen. I and the BTH-RM230Z. Wireshark is already running hot. 😉
I'll have some concrete answers in a bit.

@burmistrzak
Copy link
Contributor

burmistrzak commented May 2, 2024

@l3rdy There you go, fresh from the packet dump.

Sniffed values for 0x4007:

Value Meaning
0x00 Auto Mode
0x01 Manual Mode
0x05 Pause/Off

Sniffed values for SystemMode:

Value Meaning Notes
0x00 Off Not seen, but works
0x01 Auto Not supported
0x03 Cooling Seen
0x04 Heating Seen

Also, ThermostatRunningState (0x0029) gets reported regularly, so we'll use that for running_state instead, obviously.

@burmistrzak
Copy link
Contributor

All in all, the current bosch_thermostat converter just barely works for the BTH-RM230Z, probably because of an effort to reuse code from the Bosch TRV.

I'll probably write a dedicated converter, we'll see. 😉

@l3rdy
Copy link
Author

l3rdy commented May 3, 2024

ahh yeah.. I feared and figured it would be quite some work and probably not really possible without sniffing and going deep haha

Thanks for your Work @burmistrzak !!

@burmistrzak
Copy link
Contributor

I'll have something for you to try, in just a bit.
Shouldn't be that hard, and isn't far off from what you've hacked together. 😊

@burmistrzak
Copy link
Contributor

burmistrzak commented May 3, 2024

@l3rdy Give this a shot: master...burmistrzak:zigbee-herdsman-converters:improve-bth-rm230z

@burmistrzak
Copy link
Contributor

@l3rdy Give this a shot: master...burmistrzak:zigbee-herdsman-converters:improve-bth-rm230z

Just added the missing operating_mode enum.

@l3rdy
Copy link
Author

l3rdy commented May 3, 2024

Already on It :)

@burmistrzak
Copy link
Contributor

I really hope, selectively overriding default clusters by specifying a manufacturerCode in fzLocal actually works... 🤔

@l3rdy
Copy link
Author

l3rdy commented May 3, 2024

yeah, it seems like it doesn't work. The container Always crashes and pulls a new Image.

I used your config and kept those now and now it works. 🤔

fzLocal.bosch_thermostat,
fzLocal.bosch_userInterface,

@burmistrzak
Copy link
Contributor

burmistrzak commented May 3, 2024

yeah, it seems like it doesn't work. The container Always crashes and pulls a new Image.

I used your config and kept those now and now it works. 🤔

fzLocal.bosch_thermostat,
fzLocal.bosch_userInterface,

Can you try removing the line with options: manufacturerOptions from bosch_room_thermostat and bosch_room_thermostat_ui in fzLocal?
Also, can you provide any logs?

Edit: Make sure to copy the parts from tzLocal and fzLocal as well. It's all TypeScript, so you'll have to manually convert it.

@l3rdy
Copy link
Author

l3rdy commented May 3, 2024

I uncommented the options: manufacturerOptions and now it works. :)

@burmistrzak
Copy link
Contributor

burmistrzak commented May 3, 2024

I uncommented the options: manufacturerOptions and now it works. :)

Great!
Can you please play around with system_mode, operating_mode, etc. and see if everything is working as expected? Also try changing modes, temperature, etc. on the device itself.

Would be great to have some screenshots or similar to verify the behavior in the UI.
Oh, and don't forget to re-configure the thermostat to setup reporting for some additional attributes!

@l3rdy
Copy link
Author

l3rdy commented May 3, 2024

Okay so operating modes don't properly work yet.

I can do them on the device and I can see in the State Tab it reports following
"operating_mode": "off",
"operating_mode": "auto",

manual works and highlights the exposed button (I can't change it to manual in the UI only on the device)
gives me following error

Publish 'set' 'operating_mode' to 'StudioThermostat' failed: 'ReferenceError: Zcl is not defined'

And the Auto Mode in general doesn't work.
The Temperature changes when changing into Auto Mode on the Device, but the Button doesn't light up nor will it report the System Mode or Running State

Publish 'set' 'system_mode' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 hvacThermostat.write({"systemMode":1}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 62580 - 1 - 59 - 513 - 4 after 10000ms)'
No converter available for 'running_state' ("")

EDIT: To make it clear, the Running State works and exposes the right stuff. But when trying to refresh the running_state I occasionally get the error for some reason

I also just tried Window detection and Boost and both give me errors but tbh I never used it nor did it probably ever work

Publish 'set' 'boost' to 'StudioThermostat' failed: 'ReferenceError: Zcl is not defined'
Publish 'set' 'window_detection' to 'StudioThermostat' failed: 'ReferenceError: Zcl is not defined'

I hope I just didnt fuck up something 🤔😅

@burmistrzak
Copy link
Contributor

'ReferenceError: Zcl is not defined'

It's TypeScript, so you'll have to fix the imports manually.
So Zcl.DataType.ENUM8 becomes zigbee_herdsman_1.Zcl.DataType.ENUM8 when compiled to plain JavaScript.

@l3rdy
Copy link
Author

l3rdy commented May 4, 2024

Oh my.. Im too tired I think. Very sorry for that.

error 2024-05-04 02:16:17
Failed to configure 'StudioThermostat', attempt 1 (Error: ZCL command 0x001e5e09029fbd7f/1 hvacThermostat.configReport([{"attribute":{"ID":16391},"minimumReportInterval":0,"maximumReportInterval":3600,"reportableChange":1}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Don't know value type for 'undefined') at Object.IsDataTypeAnalogOrDiscrete (/app/node_modules/zigbee-herdsman/src/zcl/utils.ts:30:15) at /app/node_modules/zigbee-herdsman/src/zcl/zclFrame.ts:305:38 at Array.find (<anonymous>) at Function.conditionsValid (/app/node_modules/zigbee-herdsman/src/zcl/zclFrame.ts:289:58) at ZclFrame.writePayloadGlobal (/app/node_modules/zigbee-herdsman/src/zcl/zclFrame.ts:88:35) at ZclFrame.toBuffer (/app/node_modules/zigbee-herdsman/src/zcl/zclFrame.ts:70:18) at ZStackAdapter.sendZclFrameToEndpointInternal (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:386:22) at /app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:354:25 at Queue.execute (/app/node_modules/zigbee-herdsman/src/utils/queue.ts:35:26) at Request.send (/app/node_modules/zigbee-herdsman/src/controller/helpers/request.ts:79:20))
error 2024-05-04 02:17:18
Publish 'set' 'operating_mode' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 hvacThermostat.write({"16391":{"value":1}}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'
error 2024-05-04 02:17:46
No converter available for 'running_state' ("")
error 2024-05-04 02:18:00
Publish 'set' 'window_detection' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 hvacThermostat.write({"16450":{"value":1}}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'
Publish 'set' 'boost' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 hvacThermostat.write({"16451":{"value":1}}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'
error 2024-05-04 02:39:33
Publish 'set' 'system_mode' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 hvacThermostat.write({"systemMode":1}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 62580 - 1 - 5 - 513 - 4 after 10000ms)'

These are all the errors I'm getting. I hope I didn't mess anything up again. I'll leave them here and will look at it late again again

@burmistrzak
Copy link
Contributor

@l3rdy Just finished my PR utilizing modernExtend, AFAICT this is much better. 🤞

@l3rdy
Copy link
Author

l3rdy commented May 4, 2024

Lovely, I'll take a look :)

@l3rdy
Copy link
Author

l3rdy commented May 4, 2024

I seem to missing something here. I just can't get it to run 😅

[00:17:10] INFO: Starting Zigbee2MQTT...
[2024-05-05 00:17:10] info: 	z2m: Logging to console, file (filename: log.log)
TypeError: Cannot read properties of undefined (reading 'options')
    at prepareDefinition (/app/node_modules/zigbee-herdsman-converters/src/index.ts:211:23)
    at addDefinition (/app/node_modules/zigbee-herdsman-converters/src/index.ts:241:18)
    at Object.<anonymous> (/app/node_modules/zigbee-herdsman-converters/src/index.ts:259:5)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/app/lib/model/device.ts:3:1)

@burmistrzak
Copy link
Contributor

I seem to missing something here. I just can't get it to run 😅

[00:17:10] INFO: Starting Zigbee2MQTT...
[2024-05-05 00:17:10] info: 	z2m: Logging to console, file (filename: log.log)
TypeError: Cannot read properties of undefined (reading 'options')
    at prepareDefinition (/app/node_modules/zigbee-herdsman-converters/src/index.ts:211:23)
    at addDefinition (/app/node_modules/zigbee-herdsman-converters/src/index.ts:241:18)
    at Object.<anonymous> (/app/node_modules/zigbee-herdsman-converters/src/index.ts:259:5)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/app/lib/model/device.ts:3:1)

Hmm, I'd recommend pulling the PR commit, compile TypeScript to JS, and build a custom container image. Alternatively, just compile to JavaScript and replace the bosch.js in the container.

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

Yeah, not really sure what happened there.
Cloned your repo and compiled it. Now it works.

Few things (you probably already know, looking at your PR)

Operating mode works when changing on the Device, exposed buttons light up etc.
Operating mode cannot be set from Z2MQTT

error 2024-05-05 13:27:45: Publish 'set' 'operating_mode' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 boschRoomThermostat.write({"operatingMode":5}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'
error 2024-05-05 13:27:47: Publish 'set' 'operating_mode' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 boschRoomThermostat.write({"operatingMode":0}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'
error 2024-05-05 13:27:48: Publish 'set' 'operating_mode' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 boschRoomThermostat.write({"operatingMode":1}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'

The same goes for Child Lock.

error 2024-05-05 13:27:06: Publish 'set' 'child_lock' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 boschRoomThermostatUi.write({"childLock":1}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'
error 2024-05-05 13:27:07: Publish 'set' 'child_lock' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 boschRoomThermostatUi.write({"childLock":0}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'

Then for the following there's no Button on the Device, and they cannot be set (used to work before, including Child Lock)

Boost option is missing entirely.

Display Ontime

Publish 'set' 'display_ontime' to 'MainThermostat' failed: 'Error: ZCL command 0x001e5e09029fc4c5/1 boschRoomThermostatUi.write({"displayOntime":5}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'

Display Brightness

error 2024-05-05 14:07:15: Publish 'set' 'display_brightness' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 boschRoomThermostatUi.write({"displayBrightness":1}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'

Window Detection

error 2024-05-05 13:27:04: Publish 'set' 'window_detection' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 boschRoomThermostat.write({"windowDetection":1}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'
error 2024-05-05 13:27:05: Publish 'set' 'window_detection' to 'StudioThermostat' failed: 'Error: ZCL command 0x001e5e09029fbd7f/1 boschRoomThermostat.write({"windowDetection":0}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4617,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Write for 'BUFFER' not available)'

Everything else is working. Especially the System Mode where Off also if Off for Operating mode
Is it possible to do the same for the AUTO Mode down the Line?

@burmistrzak
Copy link
Contributor

Few things (you probably already know, looking at your PR)

Yea, likely because zigbee-herdsman isn't up-to-date yet. Try upgrading to ^0.46.0, should work. 👀

Boost option is missing entirely.

Woops. 😅

Everything else is working. Especially the System Mode where Off also if Off for Operating mode Is it possible to do the same for the AUTO Mode down the Line?

In theory, but system_mode represents what's actually supported by the thermostat.
Auto is not supported, I tried. You'll have to use operating_mode to switch to the internal schedule.

I'm not really comfortable with falsely exposing Auto because according to ZCL spec, this would indicate the device is capable of automatically switching between heating and cooling mode, which is not the case.

@burmistrzak
Copy link
Contributor

Regarding Boost Mode, this doesn't seem to do anything for underfloor heating. Yes, it lights up red for a moment, but that's it. 👀
For the battery-powered model, that's intended to be paired with a TRV, Boost Mode makes sense.
Underfloor heating is either on or off, no steps in between.

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

I just installed zigbee-herdsman 0.46.1

EVERYTHING works!!!!

I will use System mode cool & System mode heat interchangeably here
System mode cool to off works both states are off
vice versa too

when in System mode cool turning Operating mode to off works for the device but doesn't properly report to z2mqtt and keeps getting stuck on cool and seems to get a bit confused.
Even after Several Minutes it won't change and after a refresh changing the System mode to off and then cool helps it get unstuck and highlight the right Operating mode too again.
Same for when both Modes are off and you go to Operating mode Manual/Auto it will actually be turned on but reports as off

here the Thermostat is actually off
thermo_off_wrong_Mode
thermo_off_wrong_Mode_state

So as long as you don't turn it off or on with Operating mode everything works flawlessly.

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

In theory, but system_mode represents what's actually supported by the thermostat. Auto is not supported, I tried. You'll have to use operating_mode to switch to the internal schedule.

I'm not really comfortable with falsely exposing Auto because according to ZCL spec, this would indicate the device is capable of automatically switching between heating and cooling mode, which is not the case.

Well there you go. They fooled me 😅 So what is their Auto Mode actually doing? I guess just for their App where you can set schedules.. but we are not able to do that here right?

Regarding Boost. Also, interesting.. I already wondered how that would even Work haha

@burmistrzak
Copy link
Contributor

Well there you go. They fooled me 😅 So what is their Auto Mode actually doing? I guess just for their App where you can set schedules.. but we are not able to do that here right?

Yep, auto is their internal schedule. Maybe we should rename that operating_mode to schedule?
Support for customizing the schedule is planned, and has been done before:

weeklySchedule: (): ModernExtend => {

Regarding Boost. Also, interesting.. I already wondered how that would even Work haha

Yeah, doesn't make much sense for this specific model. 😊

@burmistrzak
Copy link
Contributor

EVERYTHING works!!!!

🥳

when in System mode cool turning Operating mode to off works for the device but doesn't properly report to z2mqtt and keeps getting stuck on cool and seems to get a bit confused. Even after Several Minutes it won't change and after a refresh changing the System mode to off and then cool helps it get unstuck and highlight the right Operating mode too again. Same for when both Modes are off and you go to Operating mode Manual/Auto it will actually be turned on but reports as off

I'll investigate. 🔬

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

Hmm.. schedule doesn't sound too bad, but I guess having the schedule on off is also a bit confusing, haha

Does it make sense or is it possible to not expose off at operating_mode?
Makes a bit more sense when called schedule and also with it getting stuck currently.. you got the System Mode anyway, and It wouldn't really make sense to turn it on or off with operating_mode / schedule 😅

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

Well there you go. They fooled me 😅 So what is their Auto Mode actually doing? I guess just for their App where you can set schedules.. but we are not able to do that here right?

Yep, auto is their internal schedule. Maybe we should rename that operating_mode to schedule? Support for customizing the schedule is planned, and has been done before:

weeklySchedule: (): ModernExtend => {

Regarding Boost. Also, interesting.. I already wondered how that would even Work haha

Yeah, doesn't make much sense for this specific model. 😊

Ohh.. that would be quite nice.. tho I think its not as useful as it sounds and looks quite complex haha

@burmistrzak
Copy link
Contributor

Hmm.. schedule doesn't sound too bad, but I guess having the schedule on off is also a bit confusing, haha

You mean schedule is active while system_mode is off?

Does it make sense or is it possible to not expose off at operating_mode? Makes a bit more sense when called schedule and also with it getting stuck currently.. you got the System Mode anyway, and It wouldn't really make sense to turn it on or off with operating_mode / schedule 😅

Certainly possible.
However, Bosch enables "Heating Pause" exclusively via operating_mode, fyi.

What do you think about schedule | manual | pause?

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

Hmm.. schedule doesn't sound too bad, but I guess having the schedule on off is also a bit confusing, haha

You mean schedule is active while system_mode is off?

Honestly, I'm not sure what I actually meant or found confusing at that moment. I think I just got something twisted in my mind haha

However, schedule | manual | pause sounds great :)

However, Bosch enables "Heating Pause" exclusively via operating_mode, fyi.

Yeah, I'm just thinking (especially since I also use Home Assistant) I would only use the System Mode off rather than turning it off with the operating mode even though in the background the pause is actually what turns it off. Espescially since it kinda makes "Problems" (at least currently)

@burmistrzak
Copy link
Contributor

Yeah, I'm just thinking (especially since I also use Home Assistant) I would only use the System Mode off rather than turning it off with the operating mode even though in the background the pause is actually what turns it off. Espescially since it kinda makes "Problems" (at least currently)

Well, both commands work equally good, AFAIK. ✌️

Can you elaborate a bit? What problems exactly?
Maybe we'll be able to address them here, before it's too late. 😉

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

Well just when you turn it to pause from manual or schedule or the other way around with Operating Mode the System Mode instead of going to off it keeps being Stuck in Z2MQTT not really a problem.

Or when going from manual or schedule to pause the Thermostat is in Pause but the System Mode is still reported as cool or heat falsely

When doing everything over System Mode everything works flawlessly and gets updated

But the only way to have the Device do what you want it to do and have everything report correctly in Z2MQTT is to go
System Mode off and only switch between Operating Mode manual or schedule but actually never touch off there

when in System mode cool turning Operating mode to off works for the device but doesn't properly report to z2mqtt and keeps getting stuck on cool and seems to get a bit confused. Even after Several Minutes it won't change and after a refresh changing the System mode to off and then cool helps it get unstuck and highlight the right Operating mode too again. Same for when both Modes are off and you go to Operating mode Manual/Auto it will actually be turned on but reports as off

I'll investigate. 🔬

EDIT: I've just seen you updated your PR. now it called Pause.

@burmistrzak
Copy link
Contributor

Or when going from manual or schedule to pause the Thermostat is in Pause but the System Mode is still reported as cool or heat falsely

Have you tried manually refreshing 🔄 the reported system_mode state?

@burmistrzak
Copy link
Contributor

@l3rdy Updated PR is ready. 😊

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

Oh I just uploaded a Video showcasing it haha

Ill take a look

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

So nothing changed besides the renames

When trying to reconfigure, I get following

info 2024-05-05 19:57:04Configuring 'StudioThermostat'
error 2024-05-05 19:57:06Exception while calling fromZigbee converter: Expected one of: 0, 1, 5, got: 'undefined'}
error 2024-05-05 19:57:06Exception while calling fromZigbee converter: Value is not a number, got undefined (undefined)}
info 2024-05-05 19:57:06Successfully configured 'StudioThermostat'

A (new and longer Video) to showcase what's going on. The Operating mode is always the true state of the Device.

Editor.54.mp4

@burmistrzak
Copy link
Contributor

@l3rdy Thanks for all the details! I'm on it. 🤝
Reworked some stuff and the PR is now merged.

Don't worry though, you and I will continue bug hunting. 🐛

@burmistrzak
Copy link
Contributor

When a new dev build is available, just update Z2M, and give it a try.
Will do myself, so we can compare logs.
Don't forget to enable debug logs! 🤓

@l3rdy
Copy link
Author

l3rdy commented May 5, 2024

@l3rdy Thanks for all the details! I'm on it. 🤝 Reworked some stuff and the PR is now merged.

Don't worry though, you and I will continue bug hunting. 🐛

Thank you so much @burmistrzak !
Pleasure helping and great learning experience as well. From not having any Idea about the deeper End of Zigbee, any of TypeScript, JavaScript, npm or whatever 😅

If I encounter some stuff, I'll guess I'd make a new Issue since Cooling Mode (Most likely) is done!? :)

@burmistrzak
Copy link
Contributor

Thank you so much @burmistrzak ! Pleasure helping and great learning experience as well. From not having any Idea about the deeper End of Zigbee, any of TypeScript, JavaScript, npm or whatever 😅

We're all just doing our part to keep homes smart & open. 🫡😊

If I encounter some stuff, I'll guess I'd make a new Issue since Cooling Mode (Most likely) is done!? :)

Please do! 👌

@burmistrzak
Copy link
Contributor

@l3rdy Error during setup is now fixed. ✌️ #7490

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants