[Beta] ) Edge Driver Zigbee Temp Sensor and Thermostat Mc:

(NEW RELEASE): Edge Driver Zigbee TempSensor and Thermostat Mc:

This new Edge Driver allows you to convert a sensor that has the capability of Temperature into a fully programmable Thermostat that runs locally and usable with Routines and Scenes.

My thanks to @milandjurovic71 for his debugging work and for his always useful ideas and suggestions that it do possible build his idea of a fully operational virtual thermostat on the same driver.
Thanks also to @TAustin for helping me how make code for select which thermostat modes I want use and display.

Zigbee devices that have at least the Capability of TemperatureMesurement can be used.

This capability and all the others that the sensor has, motion, humidity, atmospheric pressure, contact … They have to use the Edge default libraries.

One Driver can control all sensors paired independently

For example, it has been tested with a SmartThings (Samjin) motion Sensor and Aqara Weather sensor.

Thermostat Default Capabilities:
1. thermostatMode:
1.1. Asleep: Control Heat and Cool with Presets in Preferences for Heat and Cool Temperature
1.2. Away: Control Heat and Cool with Presets in Preferences for Heat and Cool Temperature
1.3. Auto: Control Heat and Cool with Presets in Heat Preferences for and Cool Temperature
1.4. Rush Hour: Control Heat and Cool with Presets in Preferences for Heat and Cool Temperature
1.5. Cool: Controls the temperature for Cooling with the set point entered manually.
1.6. Eco: Heat and Cool Control without Presets in Preferences for Heat and Cool Temperature
1.7. Heat: Controls the temperature for Heating with the set point entered manually.
1.8. Manual: Heat and Cool Control without Presets in Preferences for Heat and Cool Temperature
1.9. Off: Thermostat off. You can use fan On, Circulate, Scheduled modes

2. thermostatOperatingState:
2.1. Idle: Thermostat off, no temperature control
2.2. Heating: The current temperature is below the HeatSetPoint – Differential Temp
2.3. Pending Heat: The current temperature is above the HeatSetPoint – Temp Differential / 2
2.4. Cooling: The current temperature is above the CoolSetPoint + Temp Differential
2.5. Pending Cool: The current temperature is below the CoolSetPoint + Temp Differential / 2
2.6. Fan Only: Active Fan is selected and thermostat mode is Off
2.7. Vent economizer: Fan Circulate has been selected and the Thermostat Mode is Off.

3. thermostatFanMode:

3.1. Auto: Indicates that the fan will be activated automatically in the climate control.

  • If thermostat state are Pending Heat or Pending Cool then Fan Current status go to OFF.
  • If thermostat state are Heating or Cooling then Fan Current status go to ON.

3.2. On: The Fan will always be running in On mode.

  • Fan Only will be displayed under Thermostat Status If Thermostat Mode is Off.
    if thermostat mode is different from off the status for heat or cool is displayed

3.3. Circulate: The Fan will always be running in Circulate mode.

  • Vent economizer: will be displayed under Thermostat Status if Thermostat Mode is Off.
    if thermostat mode is different from off the heat or cool status is displayed

3.4. Followschedule: The Fan works with the on and off schedule according to the values, in minutes, chosen in preferences for Time On and Time Off. (Range between 1 and 60 min).

4. The Information Panels (Custom Capabilities):
4.1. Fan Current State: Indicates the Fan current Status On or Off, and can be used in Routines to activate fans, etc …
4.2. Fan Next State Change: Indicates the time at which the next scheduled Fan state change will occur.
To match your local time: Adjust the time difference with UTC time in preferences

In preferences you can program the temperature preset values for 4 thermostat modes.
This allows you to program with simple routines to vary the desired target temperatures for different Hours of the Day or for situations such as, I am away or vacation.

How to Use the Preferences Start Stop Differential Temperature Setting:

  1. It is used to adjust the desired temperature comfort and take advantage of the thermal inertia of your heating or cooling system.
  2. This simulates the acceleration resistance of real mechanical thermostats.
  3. The target temperature is subtracted the half of differential temperature (default 0.5) to stop the heating and in this way with the thermal inertia of the heat emitters the target temperature is not exceeded excessively.
  4. The differential temperature (default 0.5) is subtracted of the target temperature to start the heating again. In this way a comfortable temperature difference is achieved without exceeding the target temperature.
  5. For refrigeration it is the same but the temperature difference is added to the target temperature.
  6. How to calculate our optimal differential temperature? :
    With the minimum differential temperature (0.1º) we will observe the history of events and look for the temperature of the change to “Pending Heat” state and then we will look for the maximum temperature following that event.
    The difference between the maximum temperature reached and that of the event of change to “Pending Heat” is approximately equivalent to the thermal inertia of our heating system with the temperature conditions that we have fixed in the electric emitters or water radiators.
    That difference multiplied by 2 is the Differential Start-Stop temperature to be introduced in preferences.
    Or any other that gives us the comfort we want.
  7. For cooling in summer, we will perform the same operation.

In Next Picture an Example of calculate Thermal Inertia for Heat set Point 19ºC and Differential temp Start-Stop 0.5º:

Temperature for Pending Heat state= 18.8ºC
Max. Temperature after Temperature for Pending Heat state= 19.1ºC
Heat Thermal Inertia with Radiator water Temp 55ºC= 0.3ºC
Temperature differential for Start-Stop 0.6º aprox

Can see complete day temperature graphics in device detaills, and you can see the result of your automations and Temperature Set Points, in order to correct them if necessary to adjust the control to your needs.

When the device is installed for the first time:

  1. It may be necessary to restart the Hub as it has custom capabilities.
  2. The thermostat will not control the temperature until a first event of the current temperature is received. You can force an event by heating the sensor a little with your hand.
  3. The sensor works with the default settings of temperature reports:
    Minimum Interval: 30 sec
    Maximum Interval: 300 sec
    Reportable temperature change: 0.1ºC

Important considerations:

  1. All sensors emit their reports inºC. As the maximum precision is 0.1ºC, the maximum precision in ºF will be 0.18ºF, which when rounded to 1 decimal place will be approximately 0.2ºF.
  2. The values of the temperature presets have no units and the defaults are equivalent to ºC.
  3. If your location use ºF, change the units to ºF in preferences and change the Heat and Cool values to equivalent values ºF.
  4. The range for entering temperature in preferences is -50.0 to 250.0.
  5. Decimal values can be used. this range covers the values required for ºC and ºF adjustments
  6. The range to change the set point temperature in the thermostat and automations is from 0ºC to 40ºC and from 32ºF to 104ºF, with increments of +/-1º. This is due to the default presentation of the capability. If smartThings changes it to be able to enter decimals and expand the range it would be an improvement.

Every 15 seconds it does the temperature calculations for each paired sensor independently.
Therefore when making manual changes it may take a maximum of 15 sec to update the results and display them.

In the logcat you can check what data it is handling for the calculations:

39882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  <<< Cheking Temp >>>
2021-11-08T14:33:06.666034882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  device:        <ZigbeeDevice: 9b6380e3-7155-4d74-85f6-0878a92e0a85 [0x68A5] (Sensor Mov-2)>
2021-11-08T14:33:06.672302882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostat_Run =       running
2021-11-08T14:33:06.678173882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostatOperatingState Before =      heating
2021-11-08T14:33:06.684129549+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostat_Mode =      manual
2021-11-08T14:33:06.690717549+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostatFan_Mode =   auto
2021-11-08T14:33:06.697209882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  cycleCurrent = stop
2021-11-08T14:33:06.703396549+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  device.preferences.floorRadaint =      HeatCool
2021-11-08T14:33:06.709641215+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  device.preferences.temperature DiffStarStop =  0.8
2021-11-08T14:33:06.715798882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  *** Current_temp ***   16.5    Celsius
2021-11-08T14:33:06.721453882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  ## heating_Setpoint ## 20
2021-11-08T14:33:06.727510549+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  tempChangeToHeating <= 19.542857142857
2021-11-08T14:33:06.733371215+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  tempChangeToPendingHeat >      19.6
2021-11-08T14:33:06.739948882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  ## cooling_Setpoint ## 27.0
2021-11-08T14:33:06.745869215+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  tempChangeToCooling >= 27.457142857143
2021-11-08T14:33:06.751975215+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  tempChangeToPendingCool <      27.4
2021-11-08T14:33:06.757758215+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostatOperatingState ****  heating ****
2021-11-08T14:33:06.765301215+00:00 INFO Zigbee Temp Sensor with Thermostat v2  <ZigbeeDevice: 9b6380e3-7155-4d74-85f6-0878a92e0a85 [0x68A5] (Sensor Mov-2)> emitting event: {"capability_id":"thermostatOperatingState","state":{"value":"heating"},"attribute_id":"thermostatOperatingState","component_id":"main"}
2021-11-08T14:33:06.793176216+00:00 INFO Zigbee Temp Sensor with Thermostat v2  <ZigbeeDevice: 9b6380e3-7155-4d74-85f6-0878a92e0a85 [0x68A5] (Sensor Mov-2)> emitting event: {"capability_id":"legendabsolute60149.fanCyclicMode","state":{"value":"On"},"attribute_id":"fanCyclicMode","component_id":"main"}
2021-11-08T14:33:06.819226882+00:00 DEBUG Zigbee Temp Sensor with Thermostat v2  Sensor Mov-2 device thread event handled
2021-11-08T14:33:07.334253549+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  <<< Cheking Temp >>>
2021-11-08T14:33:07.363178882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  device:        <ZigbeeDevice: 075f38a5-5928-444b-ac8a-4563446777f4 [0x3F4D] (Sensor Mov-1)>
2021-11-08T14:33:07.381726216+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostat_Run =       running
2021-11-08T14:33:07.387930882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostatOperatingState Before =      pending heat
2021-11-08T14:33:07.418021216+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostat_Mode =      manual
2021-11-08T14:33:07.444130549+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostatFan_Mode =   auto
2021-11-08T14:33:07.480930882+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  cycleCurrent = stop
2021-11-08T14:33:07.507754883+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  device.preferences.floorRadaint =      No
2021-11-08T14:33:07.531750216+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  device.preferences.temperature DiffStarStop =  0.8
2021-11-08T14:33:07.572001216+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  *** Current_temp ***   19.2    Celsius
2021-11-08T14:33:07.598180549+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  ## heating_Setpoint ## 18
2021-11-08T14:33:07.643877883+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  tempChangeToHeating <= 17.2
2021-11-08T14:33:07.670585883+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  tempChangeToPendingHeat >      17.6
2021-11-08T14:33:07.723981216+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  ## cooling_Setpoint ## 25.0
2021-11-08T14:33:07.745488216+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  tempChangeToCooling >= 25.8
2021-11-08T14:33:07.763193549+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  tempChangeToPendingCool <      25.4
2021-11-08T14:33:07.785832883+00:00 PRINT Zigbee Temp Sensor with Thermostat v2  thermostatOperatingState ****  pending heat    ****
2021-11-08T14:33:07.800201883+00:00 INFO Zigbee Temp Sensor with Thermostat v2  <ZigbeeDevice: 075f38a5-5928-444b-ac8a-4563446777f4 [0x3F4D] (Sensor Mov-1)> emitting event: {"capability_id":"thermostatOperatingState","state":{"value":"pending heat"},"attribute_id":"thermostatOperatingState","component_id":"main"}
2021-11-08T14:33:07.845704216+00:00 INFO Zigbee Temp Sensor with Thermostat v2  <ZigbeeDevice: 075f38a5-5928-444b-ac8a-4563446777f4 [0x3F4D] (Sensor Mov-1)> emitting event: {"capability_id":"legendabsolute60149.fanCyclicMode","state":{"value":"Off"},"attribute_id":"fanCyclicMode","component_id":"main"}
2021-11-08T14:33:07.901099549+00:00 DEBUG Zigbee Temp Sensor with Thermostat v2  Sensor Mov-1 device thread event handled

My Beta Drivers Channel link

SmartThings. Add a little smartness to your things

List of supported devices (nov 18)

  • id: "SmartThings-Motion-Sensor"
    deviceLabel: ST Motion Sensor
    manufacturer: Samjin
    model: motion
    deviceProfileName: motion-temp-therm-battery
  • id: "lumi.weather"
    deviceLabel: Aqara Weather
    manufacturer: LUMI
    model: lumi.weather
    deviceProfileName: temp-humid-press-therm-battery
  • id: "TUYATEC/RH3052"
    deviceLabel: TUYATEC RH3052
    manufacturer: TUYATEC-prhs1rsd
    model: RH3052
    deviceProfileName: temp-humid-therm-battery
  • id: "eWeLink/66666"
    deviceLabel: Temp Humidity Sensor
    manufacturer: eWeLink
    model: 66666
    deviceProfileName: temp-humid-therm-battery
  • id: “eWeLink/TH01” (Sonoff SNZB-02)
    deviceLabel: Temp Humidity Sensor
    manufacturer: eWeLink
    model: TH01
    deviceProfileName: temp-humid-therm-battery
3 Likes

Just an idea on how I started using this.

As Garage HVAC, Aqara’s Temperature/Humidity sensor, set up through Automations to control plug with Heater, and plug with gable fan to bring fresh outdoor air. I could use old window A/C.
Now all I do to make adjustments is using Set Temperature +/- buttons. No need to change temperature in Automations.

Another Aqara’s temperature sensor is already used to control, Humidifier and Fans, and Heater, all plugged in smart plugs

1 Like

I have Panasonic hvac. But I can’t connect it straight to SmartThings. Only to Alexa or Google Assistant. I could use this driver to control my heating? :thinking:

I don’t use voice assistants and I do not know them in depth.

I figure it will depend on the level of integration and the actions you can run on your HVAC from Google or Alexa.

Thermostat actions are handled with rules and scenes that change switch states, fans, or other virtual devices.

All thermostat capabilities are accessible for conditions and actions of the rules and scenes.

  • If your integration with Google allows you to turn the hvac on and off:
    With a virtual device and two automations you could control the on and off.
    If thermostat mode = Off then switch HVAC = Off
    If thermostat mode = x or … Thermostat mode = y then switch HVAC = On
  • If it allows you to change the mode to heat, cool or fan:
    With automations that change the state of virtual devices according to the state of the Thermostat Mode.
    If thermostat mode = Cool then switch Cool HVAC mode = On
    If thermostat mode = Heat then switch Heat HVAC mode = On
    If mode Fan thermostat = On then switch Fan HVAC = On

    I guess then it’s goole home you have to do the automations with the states of the virtual devices.

Sure there are more options and it will depend on the level of actions accessible with google or alexia that your HVAC allows.

This is un example of the 24 Hours Automatic Heat Control with 5 Routines an 1 switch for heat On-Off.

If this switch were accessible by google home to control On-Off your HVAC it would be similar, taking into account that the thermal inertia of the air heating is 0º and you would have to set the Start-Stop differential temperature to 0.1º in preferences, the minimum.

@Sakari I have tried yesterday something just to see if can work. Used this driver to control ecobee thermostat. Pretty much instead of ecobee’s temperature sensor, I have used Aqara’s.
Worked

There is a lot possibilities.

2 Likes

Could you add Nedis Temp/humidity sensor to your driver and I can see if it works with this?

  • application: 4A
  • endpointId: 01
  • manufacturer: TUYATEC-prhs1rsd
  • model: RH3052
  • zigbeeNodeType: SLEEPY_END_DEVICE
    Raw Description 01 0104 0302 00 05 0000 0001 0003 0402 0405 03 0003 0402 0405
  - id: "TUYATEC/RH3052"
    deviceLabel: TUYATEC RH3052
    manufacturer: TUYATEC-prhs1rsd
    model: RH3052
    deviceProfileName: temp-humid-therm-battery

Try it and any questions you have, ask me

Couldn’t find it at all. Appears only as a thing. :thinking:

Sensor pairing with stock DTH or Custom DTH?

Stock. I haven’t any custom dth anymore installed. I tried to reboot hub, delete cache, but no luck. Just appears as a thing.

I could check CLI logs but it’d have to wait untill tomorrow.

@Sakari,

Is the driver installed in you hub Zigbee Temp Sensor with Thermostat Mc or Zigbee Temp Sensor with Thermostat?

Yes, I had wrong driver. Now it works. Thanks.

1 Like

@Sakari you can swap drivers back and forth, no problem. Only requirement is to restart the app, to refresh Detail view

(NEW RELEASE) Version 2.0 of Edge Driver Zigbee Temp Sensor and Thermostat Mc:

Improvements and bug fixes:

  1. As the driver runs locally, I have added corrections to prevent the temperature control Timer stopping, if a Reboot HUB occurs and the thermostat is running.
    When the Hub is back online, it will continue to work with the settings it had.
    This could happen unintentionally during a Hub firmware update.
  2. Added in preferences an adjustment for Underfloor Heating installation with the No, Heat (Heat only) and Heat & Cool options.
  3. With this option the temperatures of the change to the Heating and / or Cooling state are corrected, to bring them closer to the set point Heat and Cool. In this way it begins to heat or cool earlier than in other air conditioning systems, to compensate that the underfloor heating system has more thermal inertia and takes longer to heat and cool the floor.

To facilitate the update, I am going to change version 1.0 to the name Zigbee Temp Sensor and Thermostat Mc (OLD).
I will publish the new version 2.0 with the original name Zigbee Temp Sensor and Thermostat Mc.

In this way, your driver installed will have the name with (OLD), indicating that there is a new version available and you can install the new version with a driver change whenever you want.

Devices added to driver:

  - id: "SmartThings-Motion-Sensor"
    deviceLabel: ST Motion Sensor
    manufacturer: Samjin
    model: motion
    deviceProfileName: motion-temp-therm-battery
  - id: "lumi.weather"
    deviceLabel: Aqara Weather
    manufacturer: LUMI
    model: lumi.weather
    deviceProfileName: temp-humid-press-therm-battery
  - id: "TUYATEC/RH3052"
    deviceLabel: TUYATEC RH3052
    manufacturer: TUYATEC-prhs1rsd
    model: RH3052
    deviceProfileName: temp-humid-therm-battery
1 Like

@Mariano_Colmenarejo :Hello, first i want to thanks you for the driver.
I used it for the past two days for Aqara temp sensor. I have two issues with it:

  1. i set temperature offset “-0.2C” and at random time it display the offset temp instead the real temp.
  2. second issue is that is display the temp with to much decimals, see the attached photo.

Hi @Catalin_S,

Accoding your screenshot, If you can see the events in the IDE it is that your device is using a Groovy DTH. You are not using the Edge Driver.

Look at the details of the device, Memu 3 points, If you don’t have the Driver Option, you are not using it.
If you have it, look to see what driver you are using

Thanks for quick reply.
This is the driver version:

@Catalin_S,

Sorry, Effectively entering IDE, devices, you can see the events.

In the detaills screen of the device do you see same data too?

In IDE, decimals are seen when an offset temperature value has been entered in preferences, but in the app it is rounded by default to 1 decimal.

The device sends a value, that is divided by 100, which gives two decimal places.
The temperature offset value is added to prior value and then rounded to 1 decimal place. This is what is shown in the App.

In DTH groovy the last calcutation was this, I think in edge are similar but in Lua language:

		if (tempOffset) {
			map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
            log.debug " temperature" + "${value}"
		}
		map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'

The -0.2º event could occur if the device sent temperature 0º. This could happen during pairing, if the device has not sent temperature, but it is rare.
In fact when installed, the thermostat does not work until the device sends the first temperature event after installation.

The temperature and battery events are sent by the driver’s default libraries.
The thermostat code only sends events to the thermostat and custom capabilities, Fan Current State and Fan Next State Change.

@milandjurovic71 uses this Aqara Weather sensor. I don’t know if he has any of these problems

No problems at all. Only difference is that I am using Fahrenheit units.



Looking at those pictures i think the driver in not working correctly because mine is show 0 % battery and the device name is different (if @milandjurovic71 is using Version 2.0 of Edge Driver Zigbee Temp Sensor and Thermostat Mc)