oukene / smartthings_customize

10 stars 7 forks source link

climate 전원 온 오프 기능이 작동하지 않습니다. #22

Closed yes2310 closed 11 months ago

yes2310 commented 11 months ago

`climate:

yes2310 commented 11 months ago

smartthings 사이트에서는 on, off 커맨드로 작동하는데 climate에서 switch 부분도 똑같이 on off로 적었는데 작동하지 않습니다.. 전원 말고는 전부 정상 작동 하고 있습니다. 제가 혹시 놓친 부분이 있을까요?

yes2310 commented 11 months ago

climate/set_hvac_mode 서비스를 호출하지 못했습니다. 'NoneType' object has no attribute 'get' 전원버튼을 누르면 이와 같은 메시지가 발생합니다. 감사합니다.

oukene commented 11 months ago

climate/set_hvac_mode 서비스를 호출하지 못했습니다. 'NoneType' object has no attribute 'get' 전원버튼을 누르면 이와 같은 메시지가 발생합니다. 감사합니다.

예시문 올리신거 보고 하셨나보네요, 보니까 switch 쪽에 state 가 빠져 있었군요

이렇게 state 도 추가해서 다시 한번 해보세요

yes2310 commented 11 months ago

추가하였는데 위와 같은 오류 발생합니다 혹시 제 에어컨이 mode에서 off 옵션이 없어서 그런걸까요?

oukene commented 11 months ago

추가하였는데 위와 같은 오류 발생합니다 혹시 제 에어컨이 mode에서 off 옵션이 없어서 그런걸까요?

동일 에러란 말씀이신가요? 에러가 난 파일과 라인번호가 우찌되나요

yes2310 commented 11 months ago

climate/set_hvac_mode 서비스를 호출하지 못했습니다. 'NoneType' object has no attribute 'get' 전원버튼을 누르면 이와 같은 메시지가 발생합니다. 이렇게 나오는데 어디서 에러났는지 알수있는 방법 있을까요?

oukene commented 11 months ago

climate/set_hvac_mode 서비스를 호출하지 못했습니다. 'NoneType' object has no attribute 'get' 전원버튼을 누르면 이와 같은 메시지가 발생합니다. 이렇게 나오는데 어디서 에러났는지 알수있는 방법 있을까요?

에러 메세지의 source 부분에 보면 파일명과 라인 번호가 있습니다

yes2310 commented 11 months ago

아 그런가요? 혹시 사용되는 버전 알수있을까요? 같은 오류실까요?

oukene commented 11 months ago

아 그런가요? 혹시 사용되는 버전 알수있을까요? 같은 오류실까요?

맞네요 버전문제... 저는 메인으로 사용하는 ha 는 버전을 잘 안올리는데, 거기서는 잘 되고 최신 버전 2023.9.2 에서는 문제가 있네요, 명령 내리면 최신버전인 HA 에서는 다시 꺼짐 상태로 돌아가는데

구버전 HA 에서는 켜짐 상태로 변경되어있구만요..

yes2310 commented 11 months ago

일단 구버전으로 내려서 확인해보겠습니다 감사합니다

oukene commented 11 months ago

일단 구버전으로 내려서 확인해보겠습니다 감사합니다

그냥 놔두세요,,, 오류 뜨는 라인번호 확인부탁드립니다..

oukene commented 11 months ago

일단 구버전으로 내려서 확인해보겠습니다 감사합니다

버전 문제 아닌거 같네요, 개발용 HA 에서 건드린게 있어서 그랬네요... 작동 잘 됩니다. 오류 부분만 확인해보면 될거 같은데, 설정 문제일거 같아요

yes2310 commented 11 months ago

ha를 막 시작해서 어떻게 보는지 잘 모르겠네요 ㅠ 일단 조금 더 공부해보고 다시 답글 남기겠습니다 감사합니다

oukene commented 11 months ago

ha를 막 시작해서 어떻게 보는지 잘 모르겠네요 ㅠ 일단 조금 더 공부해보고 다시 답글 남기겠습니다 감사합니다

설정->시스템->로그

에 있습니다

yes2310 commented 11 months ago

climate_custom.py:286 여기서 오류 발생합니다

yes2310 commented 11 months ago

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/smartthings_customize/climate_custom.py:286 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 오후 12:10:00 (11 occurrences) Last logged: 오후 1:36:20

[140405696614336] 'NoneType' object has no attribute 'get' [140405694960192] 'NoneType' object has no attribute 'get' [140405683978944] 'NoneType' object has no attribute 'get' [140405683713984] 'NoneType' object has no attribute 'get' [140405697483456] 'NoneType' object has no attribute 'get' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 227, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/smartthings_customize/climate_custom.py", line 242, in async_set_hvac_mode await self.async_turn_off() File "/config/custom_components/smartthings_customize/climate_custom.py", line 286, in async_turn_off await self.send_command(ATTR_SWITCH, self.get_command(ATTR_SWITCH).get(STATE_OFF), self.get_argument(ATTR_SWITCH).get(STATE_OFF, [])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get'

로그 전체입니다

oukene commented 11 months ago

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/smartthings_customize/climate_custom.py:286 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 오후 12:10:00 (11 occurrences) Last logged: 오후 1:36:20

[140405696614336] 'NoneType' object has no attribute 'get' [140405694960192] 'NoneType' object has no attribute 'get' [140405683978944] 'NoneType' object has no attribute 'get' [140405683713984] 'NoneType' object has no attribute 'get' [140405697483456] 'NoneType' object has no attribute 'get' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 227, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/smartthings_customize/climate_custom.py", line 242, in async_set_hvac_mode await self.async_turn_off() File "/config/custom_components/smartthings_customize/climate_custom.py", line 286, in async_turn_off await self.send_command(ATTR_SWITCH, self.get_command(ATTR_SWITCH).get(STATE_OFF), self.get_argument(ATTR_SWITCH).get(STATE_OFF, [])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get'

로그 전체입니다

이상하네요, 딱히 에러가 날 건덕지가 없는 부분인데,,, 에러 내용만 봤을때는 switch 에 대한 argument 설정 부분이 없다는 얘기인데... 설정하신거 보니 설정되어있는데...

oukene commented 11 months ago

climate_custom.py:286 여기서 오류 발생합니다

설정을 점검 한번 해보시구요,

switch 쪽 설정에 들여쓰기라던지 그런게 제대로 잘 되어있는지도 한번 확인해보세요

command 와 argument 는 같은 들여쓰기 레벨이어야 합니다.

yes2310 commented 11 months ago

넵 알겠습니다 감사합니다

oukene commented 11 months ago

넵 알겠습니다 감사합니다

정 안되면 방금 전 커밋한 최신 버전 ( HACS 에서 최신 버전으로 검색되는거 말고) 저장소 main 에꺼 받아서 해보세요

스위치 설정을 못찾을 경우에 스마트싱스에서 사용할 수 있는 기본값으로 처리 할 수 있도록 디폴트 값을 조금전에 추가해놨습니다.

yes2310 commented 11 months ago

퇴근후에 적용해봤는데 안되네요 ㅠ state의 위치를 맨 밑으로 수정하니 상태 반영은 잘 되고 끄고 키는 명령에 오류가 있습니다.

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/smartthings_customize/common.py:188 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 오후 9:19:44 (1 occurrences) Last logged: 오후 9:19:44

[140588922016832] Unprocessable Entity (422): {"requestId": "2161909783169037283", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "SizeError", "target": "commands[0].arguments", "message": "commands[0].arguments must have a size between 0 and 0.", "details": []}]}} Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 227, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/smartthings_customize/climate_custom.py", line 243, in async_set_hvac_mode await self.async_turn_off() File "/config/custom_components/smartthings_customize/climate_custom.py", line 286, in async_turn_off await self.send_command(ATTR_SWITCH, self.get_command(ATTR_SWITCH, {STATE_OFF: STATE_OFF}).get(STATE_OFF), self.get_argument(ATTR_SWITCH, {STATE_OFF: [STATE_OFF]}).get(STATE_OFF, [])) File "/config/custom_components/smartthings_customize/common.py", line 188, in send_command await self._device.command(self.get_component(platform), self.get_capability(platform), command, arg) File "/usr/local/lib/python3.11/site-packages/pysmartthings/device.py", line 842, in command response = await self._api.post_device_command( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 147, in post_device_command return await self.post(API_DEVICE_COMMAND.format(device_id=device_id), data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 395, in post return await self.request("post", self._api_base + resource, data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 368, in request raise APIResponseError( pysmartthings.errors.APIResponseError: Unprocessable Entity (422): {"requestId": "2161909783169037283", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "SizeError", "target": "commands[0].arguments", "message": "commands[0].arguments must have a size between 0 and 0.", "details": []}]}}

새로운 로그입니다.

oukene commented 11 months ago

퇴근후에 적용해봤는데 안되네요 ㅠ state의 위치를 맨 밑으로 수정하니 상태 반영은 잘 되고 끄고 키는 명령에 오류가 있습니다.

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/smartthings_customize/common.py:188 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 오후 9:19:44 (1 occurrences) Last logged: 오후 9:19:44

[140588922016832] Unprocessable Entity (422): {"requestId": "2161909783169037283", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "SizeError", "target": "commands[0].arguments", "message": "commands[0].arguments must have a size between 0 and 0.", "details": []}]}} Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 227, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/smartthings_customize/climate_custom.py", line 243, in async_set_hvac_mode await self.async_turn_off() File "/config/custom_components/smartthings_customize/climate_custom.py", line 286, in async_turn_off await self.send_command(ATTR_SWITCH, self.get_command(ATTR_SWITCH, {STATE_OFF: STATE_OFF}).get(STATE_OFF), self.get_argument(ATTR_SWITCH, {STATE_OFF: [STATE_OFF]}).get(STATE_OFF, [])) File "/config/custom_components/smartthings_customize/common.py", line 188, in send_command await self._device.command(self.get_component(platform), self.get_capability(platform), command, arg) File "/usr/local/lib/python3.11/site-packages/pysmartthings/device.py", line 842, in command response = await self._api.post_device_command( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 147, in post_device_command return await self.post(API_DEVICE_COMMAND.format(device_id=device_id), data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 395, in post return await self.request("post", self._api_base + resource, data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 368, in request raise APIResponseError( pysmartthings.errors.APIResponseError: Unprocessable Entity (422): {"requestId": "2161909783169037283", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "SizeError", "target": "commands[0].arguments", "message": "commands[0].arguments must have a size between 0 and 0.", "details": []}]}}

새로운 로그입니다.

yaml 구문에서 순서는 상관이 없습니다. 순서에 따라서 에러가 난다면 뭔가 문제가 있네요

설정한걸 스크린샷으로 한번 올려보세요

oukene commented 11 months ago

퇴근후에 적용해봤는데 안되네요 ㅠ state의 위치를 맨 밑으로 수정하니 상태 반영은 잘 되고 끄고 키는 명령에 오류가 있습니다. Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/smartthings_customize/common.py:188 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 오후 9:19:44 (1 occurrences) Last logged: 오후 9:19:44 [140588922016832] Unprocessable Entity (422): {"requestId": "2161909783169037283", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "SizeError", "target": "commands[0].arguments", "message": "commands[0].arguments must have a size between 0 and 0.", "details": []}]}} Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 227, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/smartthings_customize/climate_custom.py", line 243, in async_set_hvac_mode await self.async_turn_off() File "/config/custom_components/smartthings_customize/climate_custom.py", line 286, in async_turn_off await self.send_command(ATTR_SWITCH, self.get_command(ATTR_SWITCH, {STATE_OFF: STATE_OFF}).get(STATE_OFF), self.get_argument(ATTR_SWITCH, {STATE_OFF: [STATE_OFF]}).get(STATE_OFF, [])) File "/config/custom_components/smartthings_customize/common.py", line 188, in send_command await self._device.command(self.get_component(platform), self.get_capability(platform), command, arg) File "/usr/local/lib/python3.11/site-packages/pysmartthings/device.py", line 842, in command response = await self._api.post_device_command( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 147, in post_device_command return await self.post(API_DEVICE_COMMAND.format(device_id=device_id), data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 395, in post return await self.request("post", self._api_base + resource, data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 368, in request raise APIResponseError( pysmartthings.errors.APIResponseError: Unprocessable Entity (422): {"requestId": "2161909783169037283", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "SizeError", "target": "commands[0].arguments", "message": "commands[0].arguments must have a size between 0 and 0.", "details": []}]}} 새로운 로그입니다.

yaml 구문에서 순서는 상관이 없습니다. 순서에 따라서 에러가 난다면 뭔가 문제가 있네요

설정한걸 스크린샷으로 한번 올려보세요

아... 제가 뭘 하나 놓치고 있었네요, switch 의 on off 명령에는 argument 가 비어있어야 합니다. 예시문을 잘못 올려놨었네요,

argument 부분을

argument: "on": [] "off": []

이렇게 한번 작성해 보세요

yes2310 commented 11 months ago

와 정상작동 됩니다 감사합니다!!