Skip to content

Commit

Permalink
manifest.json, number.py, select.py, switch.py: fix handling http res…
Browse files Browse the repository at this point in the history
…ponse thx to hmmbob
  • Loading branch information
dingo35 committed Jun 8, 2023
1 parent 4d52447 commit 9c490c0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/smartevse/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"documentation": "https://github.com/dingo35/ha-SmartEVSEv3",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/dingo35/ha-SmartEVSEv3/issues",
"version": "1.0.9",
"version": "1.0.10",
"zeroconf": ["_http._tcp.local."]
}
2 changes: 1 addition & 1 deletion custom_components/smartevse/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ async def async_set_native_value(self, value: float) -> None:

def write(self):
res = requests.post(self.api_url, {})
if (res == "<Response [200]>"):
if res.status_code == 200:
self.async_write_ha_state()

6 changes: 3 additions & 3 deletions custom_components/smartevse/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ async def async_select_option(self, option: str) -> None:
self.api_url = "http://" + self._client.host + "/settings?enable_C2=" + str(optionlist.index(value))
else:
return None
await self.hass.async_add_executor_job(self.write)
await self.hass.async_add_executor_job(self.write, option)

def write(self):
def write(self, option):
res = requests.post(self.api_url, {})
if (res == "<Response [200]>"):
if res.status_code == 200:
self._attr_current_option = option
self.async_write_ha_state()
2 changes: 1 addition & 1 deletion custom_components/smartevse/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ async def async_turn_off(self, **kwargs: Any) -> None:

def write(self):
res = requests.post(self.api_url, {})
if (res == "<Response [200]>"):
if res.status_code == 200:
self.async_write_ha_state()

0 comments on commit 9c490c0

Please sign in to comment.