コード例 #1
0
ファイル: util.py プロジェクト: jbouwh/core
def _set_time(device: CommonThermostat) -> None:
    """Set device time."""
    # Calling this clears any local temperature override and
    # reverts to the scheduled temperature.
    now = dt_util.now()
    device.time = {
        "day": now.weekday(),
        "hour": now.hour,
        "minute": now.minute,
    }
コード例 #2
0
 def test_calls_post(self, mock_post):
     tstat = CommonThermostat('192.168.0.1')
     tstat.set_day_program('cool', 'tue', PROGRAM)
     mock_post.assert_called_once_with('/tstat/program/cool/tue',
                                       json.dumps(PROGRAM).encode('utf-8'))
コード例 #3
0
 def test_calls_validate_response(self, mock_validate_response):
     tstat = CommonThermostat(IP)
     tstat.reboot()
     mock_validate_response.assert_called_once_with(RESPONSE_VALUE)
コード例 #4
0
 def test_calls_post(self, mock_post):
     tstat = CommonThermostat('192.168.0.1')
     tstat.set_day_program('cool', 'tue', PROGRAM)
     mock_post.assert_called_once_with('/tstat/program/cool/tue', json.dumps(PROGRAM).encode('utf-8'))
コード例 #5
0
 def test_calls_post(self, mock_validate_response, mock_post):
     tstat = CommonThermostat(IP)
     tstat.reboot()
     mock_post.assert_called_once_with(COMMAND, JSON_VALUE)