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

Feature request: TH16 trigger auto mode #311

Closed
alexyr opened this issue Dec 13, 2020 · 12 comments
Closed

Feature request: TH16 trigger auto mode #311

alexyr opened this issue Dec 13, 2020 · 12 comments
Labels
enhancement New feature or request

Comments

@alexyr
Copy link

alexyr commented Dec 13, 2020

Is it possible to enable/disable auto mode for TH16?

@alexyr
Copy link
Author

alexyr commented Dec 15, 2020

As I see from debug, my settings for auto mode are listed as targets:

    "targets": [
        {
            "targetHigh": 21,
            "reaction": {
                "switch": "off"
            }
        },
        {
            "targetLow": 20,
            "reaction": {
                "switch": "on"
            }
        }
    ],

But how can I enable/disable the usage of that targets?

@rozza-m
Copy link
Contributor

rozza-m commented Jan 19, 2021

So I just had a play with this on mine.

With the switch completely off it looks like this:

   "params":{
      "sledOnline":"on",
      "targets":[
         {
            "targetHigh":"1",
            "reaction":{
               "switch":"off"
            }
         },
         {
            "targetLow":"1",
            "reaction":{
               "switch":"on"
            }
         }
      ],
      "mainSwitch":"off",
      "deviceType":"normal"

And with temperature control on it looks like this:

   "params":{
      "sledOnline":"on",
      "targets":[
         {
            "targetHigh":"1",
            "reaction":{
               "switch":"off"
            }
         },
         {
            "targetLow":"1",
            "reaction":{
               "switch":"on"
            }
         }
      ],
      "mainSwitch":"on",
      "deviceType":"temperature"

The difference being the last two lines.
+1, it would be awesome to have temp/humidity auto modes. For me, I just need to know status ("I can see that it's off now, but will it turn on before my pipes freeze?") but I guess others would want full control.

@AlexxIT
Copy link
Owner

AlexxIT commented Jan 20, 2021

You can try send raw command - instruction

device: 1000123456
switch: 'on'
mainSwitch: 'on'
deviceType: temperature

@AlexxIT AlexxIT added the enhancement New feature or request label Jan 20, 2021
@alexyr
Copy link
Author

alexyr commented Jan 20, 2021

Thanks, this is exactly what I need:

Turn auto on command:

device: 1000123456
switch: 'on'
mainSwitch: 'on'
deviceType: temperature

Turn auto off command:

device: 1000123456
switch: 'off'
mainSwitch: 'off'
deviceType: normal

But I see now that I cannot toggle it's state from HASS in local mode, only in cloud mode or from ewelink app

@AlexxIT
Copy link
Owner

AlexxIT commented Jan 20, 2021

Check logs for errors. Enable component debug mode

@alexyr
Copy link
Author

alexyr commented Jan 20, 2021

2021-01-20 12:13:53 DEBUG main SysInfo: {'version': '0.118.5', 'dev': False, 'hassio': False, 'virtualenv': True, 'python_version': '3.7.5', 'docker': False, 'arch': 'armv7l', 'os_name': 'Linux', 'os_version': '5.3.0-1030-raspi2'}
2021-01-20 12:13:53 DEBUG main LOCAL mode start
2021-01-20 12:13:55 DEBUG sonoff_cloud Redirect to region: as
2021-01-20 12:14:02 DEBUG sonoff_cloud 1 devices loaded from the Cloud Server
2021-01-20 12:14:02 DEBUG main Init force_update for attributes: {'humidity', 'temperature'}
2021-01-20 12:14:02 DEBUG main Init auto sensors for: ['temperature', 'humidity']
2021-01-20 12:20:08 DEBUG sonoff_local 1000fde35f <= Local1 | {'mainSwitch': 'on', 'deviceType': 'normal', 'targets': [{'targetHigh': 21.5, 'reaction': {'switch': 'off'}}, {'targetLow': 21, 'reaction': {'switch': 'on'}}], 'switch': 'on', 'startup': 'off', 'pulse': 'off', 'pulseWidth': 500, 'sledOnline': 'on', 'sensorType': 'AM2301', 'humidity': 66, 'temperature': 19.25} | 30
2021-01-20 12:20:08 DEBUG main 1000fde35f == Init | {'uiid': 15, 'extra': {'manufacturer': 'SONOFF', 'model': 'TH16', 'sw_version': 'PSA-BHA-GL v3.4.1'}, 'params': {'mainSwitch': 'on', 'deviceType': 'normal', 'targets': [{'targetHigh': 21.5, 'reaction': {'switch': 'off'}}, {'targetLow': 21, 'reaction': {'switch': 'on'}}], 'switch': 'on', 'startup': 'off', 'pulse': 'off', 'pulseWidth': 500, 'sledOnline': 'on', 'sensorType': 'AM2301', 'humidity': 66, 'temperature': 19.25, 'local': 'online'}}
2021-01-20 12:20:10 DEBUG sonoff_local 1000fde35f <= Local3 | {'mainSwitch': 'off', 'deviceType': 'normal', 'targets': [{'targetHigh': 21.5, 'reaction': {'switch': 'off'}}, {'targetLow': 21, 'reaction': {'switch': 'on'}}], 'switch': 'off', 'startup': 'off', 'pulse': 'off', 'pulseWidth': 500, 'sledOnline': 'on', 'sensorType': 'AM2301', 'humidity': 66, 'temperature': 19.25} | 31
2021-01-20 12:20:39 DEBUG switch Refresh device state 1000fde35f
2021-01-20 12:20:42 DEBUG sonoff_local 1000fde35f => Local4 | {'sledonline': 'on'} !! (ConnectionKey(host='...', port=8081, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-1918319295), OSError(113, "Connect call failed ('...', 8081)"))
2021-01-20 12:20:42 DEBUG sonoff_local 1000fde35f => Local4 | Check offline with timeout 20s
2021-01-20 12:20:45 DEBUG sonoff_local 1000fde35f => Local4 | {'cmd': 'info'} !! (ConnectionKey(host='...', port=8081, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-1918319295), OSError(113, "Connect call failed ('...', 8081)"))
2021-01-20 12:21:02 DEBUG sonoff_local 1000fde35f => Local4 | Check offline with timeout 40s
2021-01-20 12:21:05 DEBUG sonoff_local 1000fde35f => Local4 | {'cmd': 'info'} !! (ConnectionKey(host='...', port=8081, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-1918319295), OSError(113, "Connect call failed ('...', 8081)"))
2021-01-20 12:21:09 DEBUG switch Refresh device state 1000fde35f
2021-01-20 12:21:12 DEBUG sonoff_local 1000fde35f => Local4 | {'sledonline': 'on'} !! (ConnectionKey(host='...', port=8081, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-1918319295), OSError(113, "Connect call failed ('...', 8081)"))
2021-01-20 12:21:12 DEBUG sonoff_local 1000fde35f => Local4 | Skip parallel checks
2021-01-20 12:21:31 DEBUG sonoff_local 1000fde35f => Local4 | {'switch': 'on', 'mainSwitch': 'on', 'deviceType': 'normal'} !! (ConnectionKey(host='...', port=8081, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-1918319295), OSError(113, "Connect call failed ('...', 8081)"))
2021-01-20 12:21:31 DEBUG sonoff_local 1000fde35f => Local4 | Skip parallel checks
2021-01-20 12:21:31 DEBUG switch Refresh device state 1000fde35f
2021-01-20 12:21:34 DEBUG sonoff_local 1000fde35f => Local4 | {'sledonline': 'on'} !! (ConnectionKey(host='...', port=8081, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-1918319295), OSError(113, "Connect call failed ('...', 8081)"))
2021-01-20 12:21:34 DEBUG sonoff_local 1000fde35f => Local4 | Skip parallel checks
2021-01-20 12:21:39 DEBUG switch Refresh device state 1000fde35f
2021-01-20 12:21:42 DEBUG sonoff_local 1000fde35f => Local4 | {'sledonline': 'on'} !! (ConnectionKey(host='...', port=8081, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-1918319295), OSError(113, "Connect call failed ('...', 8081)"))
2021-01-20 12:21:42 DEBUG sonoff_local 1000fde35f => Local4 | Skip parallel checks
2021-01-20 12:21:42 DEBUG sonoff_local 1000fde35f => Local4 | Check offline with timeout 60s
2021-01-20 12:21:45 DEBUG sonoff_local 1000fde35f => Local4 | {'cmd': 'info'} !! (ConnectionKey(host='...', port=8081, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-1918319295), OSError(113, "Connect call failed ('...', 8081)"))
2021-01-20 12:21:45 DEBUG sonoff_local 1000fde35f => Local4 | Device offline
2021-01-20 12:21:45 DEBUG sonoff_local 1000fde35f => Local4 | {'switch': 'on', 'mainSwitch': 'on', 'deviceType': 'normal'} !! (ConnectionKey(host='...', port=8081, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-1918319295), OSError(113, "Connect call failed ('...', 8081)"))
2021-01-20 12:21:45 DEBUG sonoff_local 1000fde35f => Local4 | Skip parallel checks
2021-01-20 12:21:45 DEBUG switch Refresh device state 1000fde35f
2021-01-20 12:22:09 DEBUG switch Refresh device state 1000fde35f

@rozza-m
Copy link
Contributor

rozza-m commented Jan 20, 2021

@AlexxIT ❤❤❤ thanks so much!

I'm guessing there's still no way to show this status in the UI, right? If so then to do so would be a great enhancement 👍

@warksit
Copy link

warksit commented Mar 5, 2021

This is the switch template I am using to be able to trigger Auto mode on and off.

You will need to change

switch.sonoff_office to the device name of your sonoff th10/16

and 1000abcd12 to the device id of the same which I worked out by using debug mode and checking the logs.

and set the unique_id to what you would like this entity to be called.

switch:
  - platform: template
    switches:
      office_heater_auto:
        unique_id: **switch.office_heater_auto**
        value_template: "{{ is_state('**switch.sonoff_office**', 'on') }}"
        turn_on:
          service: sonoff.send_command
          data:
            device: **1000abcd12**
            switch: 'on'
            mainSwitch: 'on'
            deviceType: temperature
            targets: 
            - { targetHigh: 21, reaction: { switch: 'off' }}
            - { targetLow: 20, reaction: { switch: 'on' }}
        turn_off:
          service: sonoff.send_command
          data:
            device: **1000abcd12**
            switch: 'off'
            mainSwitch: 'off'
            deviceType: normal

I did try without the targets and it did use the previously set ones but also sometimes turned on even if already above the high. Not had this problem since I started sending the targets.

Also the status shown is whether the relay is on or off rather whether the TH10/16 is set to auto or not. That information is available in debug 'deviceType': 'temperature' but I can't figure out how to use that as the value. Any idea @AlexxIT?

@AlexxIT
Copy link
Owner

AlexxIT commented Mar 7, 2021

I don't research how work deviceType: temperature

@alexyr
Copy link
Author

alexyr commented Mar 7, 2021

@warksit I think you need only one of them:
switch: 'on'
mainSwitch: 'on'
One will turn on the "auto" and another will turn on the switch itself...
May be you will need additional logic to decide if the switch must be turned on when "auto" enabled

@warksit
Copy link

warksit commented Mar 8, 2021

@warksit I think you need only one of them:
switch: 'on'
mainSwitch: 'on'
One will turn on the "auto" and another will turn on the switch itself...
May be you will need additional logic to decide if the switch must be turned on when "auto" enabled

I tried without one or other of these settings and couldn't get consistent results. The switch does not get turned on with

switch: 'on'
mainSwitch: 'on'

when the tempearture is alreadt within the range you send which is my expected behaviour.

@AlexxIT
Copy link
Owner

AlexxIT commented Apr 24, 2022

Added to latest master-version. Will be in next release.

@AlexxIT AlexxIT closed this as completed Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants