andrewsayre / pysmartthings Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED: A python library for interacting with the SmartThings cloud API build with asyncio and aiohttp.
License: Apache License 2.0
DEPRECATED: A python library for interacting with the SmartThings cloud API build with asyncio and aiohttp.
License: Apache License 2.0
Any idea how to format the color map data type? I've tried the following:
result = await light.command("main", "colorControl", "setColor", ["hue: 50", "saturation: 60"]) assert result == True
result = await light.command("main", "colorControl", "setColor", ["[hue: 50, saturation: 60]"]) assert result == True
and
result = await light.command("main", "colorControl", "setColor", ["hue: 50, saturation: 60"]) assert result == True
All of which have given the error:
pysmartthings.errors.APIResponseError: Unprocessable Entity (422): {"requestId": "C8731E93-C14F-4B9C-A3F3-33567D788575", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "SizeError", "target": "[0].arguments", "message": "[0].arguments must have a size between 1 and 1.", "details": []}, {"code": "UnprocessableEntityError", "target": "[0].arguments.[0]", "message": "invalid COLOR_MAP type", "details": []}]}}
When attempting to change the colour of a LED light strip I receive the following:
pysmartthings.errors.APIResponseError: Unprocessable Entity (422): {"requestId": "6295EEDA-00BE-4FD4-B38F-6A00406DE356", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "SizeError", "target": "commands[0].arguments", "message": "commands[0].arguments must have a size between 1 and 1.", "details": []}]}}
this is generated from the following command:
result = await LED.command("main", "colorControl", "setColor", [10,10])
assert result == True
I have a problem with the command execution (Samsung TV)
async def some_function():
async with aiohttp.ClientSession() as session:
api = pysmartthings.SmartThings(session, token)
locations = await api.locations()
print(len(locations))
devices = await api.devices()
print(len(devices))
device = devices[0]
print(device.device_id)
print(device.name)
print(device.label)
print(device.capabilities)
print ("status --->>")
await device.status.refresh()
print(device.status.values)
print(device.status.switch)
result = await device.command("switch", "on")
assert result == True
asyncio.get_event_loop().run_until_complete(some_function())
Out:
[TV] Samsung 7 Series (49)
Samsung 7 Series (49)
['switch', 'refresh', 'ocf', 'audioVolume', 'execute', 'tvChannel', 'mediaInputSource']
True
Traceback (most recent call last):
File "smartth.py", line 43, in <module>
asyncio.get_event_loop().run_until_complete(some_function())
File "/usr/lib/python3.5/asyncio/base_events.py", line 466, in run_until_complete
return future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "smartth.py", line 40, in some_function
result = await device.command("switch", "on")
TypeError: command() missing 1 required positional argument: 'command'
What argument is required? The shutdown\shutdown command is standard for all devices
result = await device.command("main","setCode",99,["9999"]) is not properly formatted. Any examples? TIA!
Recently, Samsung is beta testing its Galaxy home mini, which includes features with IR remocon control. When the device is added and linked to the home adjuster, the entire device is not connected as shown below.
It looks like the IR_OCF item is needed for Device Type.
2019-11-11 07:50:19 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 우리집 for smartthings
ValueError: 'IR_OCF' is not a valid DeviceType
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 190, in async_setup
hass, self
File "/usr/src/homeassistant/homeassistant/components/smartthings/init.py", line 116, in async_setup_entry
devices = await api.devices(location_ids=[installed_app.location_id])
File "/usr/local/lib/python3.7/site-packages/pysmartthings/smartthings.py", line 77, in devices
return [DeviceEntity(self._service, entity) for entity in resp]
File "/usr/local/lib/python3.7/site-packages/pysmartthings/smartthings.py", line 77, in
return [DeviceEntity(self._service, entity) for entity in resp]
File "/usr/local/lib/python3.7/site-packages/pysmartthings/device.py", line 651, in init
self.apply_data(data)
File "/usr/local/lib/python3.7/site-packages/pysmartthings/device.py", line 94, in apply_data
self._type = DeviceType(data['type'])
File "/usr/local/lib/python3.7/enum.py", line 310, in call
return cls.new(cls, value)
File "/usr/local/lib/python3.7/enum.py", line 564, in new
raise exc
File "/usr/local/lib/python3.7/enum.py", line 548, in new
result = cls.missing(value)
File "/usr/local/lib/python3.7/enum.py", line 577, in missing
raise ValueError("%r is not a valid %s" % (value, cls.name))
ValueError: 'IR_OCF' is not a valid DeviceType
In addition, IR_OCF can not be used even after adding a device type.
Because there is no type, there is a problem that cannot be connected entirely.
If the device's property does not have a type, Exception processing is required.
2019-11-11 22:04:29 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 우리집 for smartthings
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 190, in async_setup
hass, self
File "/usr/src/homeassistant/homeassistant/components/smartthings/init.py", line 116, in async_setup_entry
devices = await api.devices(location_ids=[installed_app.location_id])
File "/usr/local/lib/python3.7/site-packages/pysmartthings/smartthings.py", line 77, in devices
return [DeviceEntity(self._service, entity) for entity in resp]
File "/usr/local/lib/python3.7/site-packages/pysmartthings/smartthings.py", line 77, in
return [DeviceEntity(self._service, entity) for entity in resp]
File "/usr/local/lib/python3.7/site-packages/pysmartthings/device.py", line 651, in init
self.apply_data(data)
File "/usr/local/lib/python3.7/site-packages/pysmartthings/device.py", line 94, in apply_data
self._type = DeviceType(data['type'])
KeyError: 'type'
I have a working SmartThings (new version, not classic) hub setup working.
I have tried several variants of software using pysmartthings (0.6.9)
https://pypi.org/project/pysmartthings/
And clues from this page. All cases complete without printing anything. Not sure if the problem is my token, python, hub setup, etc.
Would it be possible post a single file that has the two async function (for location) structure correct, and needing the proper token. That would be helpful to rule out where my software is failing.
Thanks,
Dave
Hi @andrewsayre
Thank you for your great work of pysmartthings and Homeassistant ST integration.
Recently, ST decided to use Edge drivers as default.
https://community.smartthings.com/t/hub-connected-devices-now-use-edge-drivers/241868
One problem might occur when using the stock Edge driver for window shades.
The Edge driver no longer uses switchLevel capability, but now uses windowShadeLevel capability.
https://github.com/SmartThingsCommunity/SmartThingsEdgeDrivers/blob/main/drivers/SmartThings/zigbee-window-treatment/profiles/window-treatment-profile.yml
It seems that pysmartthings and Homeassistant ST integration is not ready for this transition.
I hope you could help on this problem of windowShadeLevel capability.
Thank you.
Would it be possible to have support for windfree AC?
I've checked the Smarthings "console", and it seems as it only a simple on/off switch there.
I would also want to add it to Home Assistant later
I am familiar with HA codebase, so I can help there with the implementation and with the testing.
supportedAcOptionalMode:
[off, windFree]
acOptionalMode: windFree
I have two RGB lights and a script to read the color of one and set the color of another in a loop. The problem I am having is that I have to have a delay in the loop or I get rate limited. I would love to automatically change the color of the other light when the first light's color changes
Hello:
Calling the following code on my Samsung TV:
await device.status.refresh()
print(device.status.values)
it is always returning the exact same values, even though, I change the channel, the volume, etc
{
"supportedPlaybackCommands": [
"play",
"pause",
"stop",
"fastForward",
"rewind"
],
"playbackStatus": null,
"volume": 7,
"supportedInputSources": [
"digitalTv"
],
"inputSource": "digitalTv",
"supportsPowerOnByOcf": "true",
"error": null,
"data": null,
"switch": "on",
"tvChannel": "5",
"tvChannelName": "Telecinco HD",
"firmwareVersion": "2.1.0",
"st": "2020-03-23T21:42:21Z",
"mndt": "2018-01-01",
"mnfv": "T-KTM2DEUC-1294.1",
"mnhw": "0-0",
"di": "5d906145-e6d2-47d7-b9cd-44e2075e0338",
"mnsl": "http://www.samsung.com/sec/tv/overview/",
"dmv": "res.1.1.0,sh.1.1.0",
"n": "[TV] Samsung Q6 Series (55)",
"mnmo": "QE55Q6FNA",
"vid": "VD-STV_2018_K",
"mnmn": "Samsung Electronics",
"mnml": "http://www.samsung.com",
"mnpv": "Tizen 4.0",
"mnos": "4.1.10",
"pi": "5d906145-e6d2-47d7-b9cd-44e2075e0338",
"icv": "core.1.1.0",
"pictureMode": "Estándar",
"supportedPictureModes": [
"Dinámico",
"Estándar",
"Natural",
"Película"
],
"soundMode": "Optimizado",
"supportedSoundModes": [
"Estándar",
"Optimizado",
"Amplificar"
],
"mute": "muted",
"supportedTrackControlCommands": null
}
Why is this?
Thanks ;)
Would it be possible to add support for media devices (TVs, soundbars, etc,)?
It seems that there already is some basic support for them (appropriate capabilities and attribute names), but there are no dedicated methods for executing commands nor attributes to retrieve current value.
https://smartthings.developer.samsung.com/docs/api-ref/capabilities.html#Media-Playback
Various tests are failing with aiohttp>=3.9.0, and home-assistant 2023.12.0 pins aiohttp=3.9.1
.
An example traceback, they all look the same:
pysmartthings> _____________________ TestSmartThings.test_generate_tokens _____________________
pysmartthings>
pysmartthings> smartthings = <pysmartthings.smartthings.SmartThings object at 0x7ffff4f71ab0>
pysmartthings>
pysmartthings> @staticmethod
pysmartthings> @pytest.mark.asyncio
pysmartthings> async def test_generate_tokens(smartthings):
pysmartthings> """Tests the generate_tokens method."""
pysmartthings> # Act
pysmartthings> > token = await smartthings.generate_tokens(
pysmartthings> CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN
pysmartthings> )
pysmartthings>
pysmartthings> tests/test_smartthings.py:347:
pysmartthings> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pysmartthings> pysmartthings/smartthings.py:209: in generate_tokens
pysmartthings> result = await self._service.generate_tokens(
pysmartthings> pysmartthings/api.py:410: in generate_tokens
pysmartthings> async with self._session.request(
pysmartthings> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pysmartthings>
pysmartthings> self = <aiohttp.client._RequestContextManager object at 0x7ffff4f72b00>
pysmartthings> exc_type = None, exc = None, tb = None
pysmartthings>
pysmartthings> async def __aexit__(
pysmartthings> self,
pysmartthings> exc_type: Optional[Type[BaseException]],
pysmartthings> exc: Optional[BaseException],
pysmartthings> tb: Optional[TracebackType],
pysmartthings> ) -> None:
pysmartthings> # We're basing behavior on the exception as it can be caused by
pysmartthings> # user code unrelated to the status of the connection. If you
pysmartthings> # would like to close a connection you must do that
pysmartthings> # explicitly. Otherwise connection error handling should kick in
pysmartthings> # and close/recycle the connection as required.
pysmartthings> self._resp.release()
pysmartthings> > await self._resp.wait_for_close()
pysmartthings> E AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings>
pysmartthings> /nix/store/glq1cn6g1sh7c6avqmg0y2bsmxsfg58c-python3.11-aiohttp-3.9.1/lib/python3.11/site-packages/aiohttp/client.py:1206: AttributeError
pysmartthings> _____________________ TestSubscriptionEntity.test_refresh ______________________
pysmartthings>
pysmartthings> api = <pysmartthings.api.Api object at 0x7ffff52771c0>
pysmartthings>
pysmartthings> @staticmethod
pysmartthings> @pytest.mark.asyncio
pysmartthings> async def test_refresh(api):
pysmartthings> """Tests the refresh method."""
pysmartthings> # Arrange
pysmartthings> app = SubscriptionEntity(api)
pysmartthings> app.apply_data(
pysmartthings> {
pysmartthings> "id": "7bdf5909-57c4-41f3-9089-e520513bd92a",
pysmartthings> "installedAppId": INSTALLED_APP_ID,
pysmartthings> "sourceType": "UNKNOWN",
pysmartthings> }
pysmartthings> )
pysmartthings> # Act
pysmartthings> > await app.refresh()
pysmartthings>
pysmartthings> tests/test_subscription.py:133:
pysmartthings> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pysmartthings> pysmartthings/subscription.py:213: in refresh
pysmartthings> data = await self._api.get_subscription(
pysmartthings> pysmartthings/api.py:295: in get_subscription
pysmartthings> return await self.get(
pysmartthings> pysmartthings/api.py:380: in get
pysmartthings> return await self.request("get", self._api_base + resource, params)
pysmartthings> pysmartthings/api.py:353: in request
pysmartthings> async with self._session.request(
pysmartthings> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pysmartthings>
pysmartthings> self = <aiohttp.client._RequestContextManager object at 0x7ffff50c1de0>
pysmartthings> exc_type = None, exc = None, tb = None
pysmartthings>
pysmartthings> async def __aexit__(
pysmartthings> self,
pysmartthings> exc_type: Optional[Type[BaseException]],
pysmartthings> exc: Optional[BaseException],
pysmartthings> tb: Optional[TracebackType],
pysmartthings> ) -> None:
pysmartthings> # We're basing behavior on the exception as it can be caused by
pysmartthings> # user code unrelated to the status of the connection. If you
pysmartthings> # would like to close a connection you must do that
pysmartthings> # explicitly. Otherwise connection error handling should kick in
pysmartthings> # and close/recycle the connection as required.
pysmartthings> self._resp.release()
pysmartthings> > await self._resp.wait_for_close()
pysmartthings> E AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings>
pysmartthings> /nix/store/glq1cn6g1sh7c6avqmg0y2bsmxsfg58c-python3.11-aiohttp-3.9.1/lib/python3.11/site-packages/aiohttp/client.py:1206: AttributeError
This is the full list:
pysmartthings> FAILED tests/test_app.py::TestAppSettingsEntity::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_app.py::TestAppSettingsEntity::test_save - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_app.py::TestAppEntity::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_app.py::TestAppEntity::test_save - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_app.py::TestAppEntity::test_oauth - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_app.py::TestAppEntity::test_settings - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_app.py::TestOAuthEntity::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_app.py::TestOAuthEntity::test_save - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_switch_on - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_switch_on_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_switch_off - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_switch_off_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_lock - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_lock_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_unlock - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_unlock_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_level - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_level_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_fan_speed - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_fan_speed_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_color_temperature - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_color_temperature_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_hue - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_hue_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_saturation - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_saturation_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_color - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_color_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_color_hex - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_color_update_hex - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_thermostat_fan_mode_legacy - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_thermostat_fan_mode - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_thermostat_fan_mode_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_thermostat_mode_legacy - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_thermostat_mode - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_thermostat_mode_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_cooling_setpoint_legacy - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_cooling_setpoint_mode - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_cooling_setpoint_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_heating_setpoint_legacy - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_heating_setpoint_mode - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_heating_setpoint_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_open - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_open_legacy - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_close - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_close_legacy - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_open_window_shade - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_close_window_shade - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_request_drlc_action - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_override_drlc_action - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_execute - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_preset_position - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_air_conditioner_mode - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_fan_mode - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_fan_oscillation_mode - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_air_flow_direction - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_mute - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_mute_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_unmute - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_unmute_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_volume - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_volume_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_volume_up - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_volume_up_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_volume_down - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_volume_down_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_play - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_play_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_pause - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_pause_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_stop - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_stop_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_fast_forward - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_fast_forward_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_rewind - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_rewind_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_input_source - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_input_source_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_playback_shuffle - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_playback_shuffle_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_repeat - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_repeat_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_tv_channel - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_tv_channel_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_channel_up - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_channel_down - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_window_shade_level - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceEntity::test_set_window_shade_level_update - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_device.py::TestDeviceStatus::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_installedapp.py::TestInstalledAppEntity::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_installedapp.py::TestInstalledAppEntity::test_subscriptions - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_location.py::TestLocationEntity::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_location.py::TestLocationEntity::test_rooms - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_oauthtoken.py::TestOAuthToken::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_room.py::TestRoomEntity::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_room.py::TestRoomEntity::test_save - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_scenes.py::TestSceneEntity::test_execute - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_devices - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_devices_with_filter - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_device - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_locations - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_location - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_rooms - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_create_room - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_update_room - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_room - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_delete_room - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_apps - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_app - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_create_app - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_delete_app - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_app_settings - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_update_app_settings - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_app_oauth - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_update_app_oauth - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_generate_app_oauth - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_installed_apps - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_installed_app - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_delete_installed_app - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_subscriptions - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_delete_subscriptions - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_delete_subscription - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_create_subscription - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_scenes - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_scenes_with_location_filter - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_execute_scene - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_smartthings.py::TestSmartThings::test_generate_tokens - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
pysmartthings> FAILED tests/test_subscription.py::TestSubscriptionEntity::test_refresh - AttributeError: 'MockResponse' object has no attribute 'wait_for_close'
I have a set-up with multiple indoor split air conditioning units.
They are all connected to a SAMSUNG MIM-H03 and able to be individually controlled.
With this library, they show up as 1 'System Air Conditioner' and are not individually exposed.
Any chance to add this functionality?
Hi,
would be nice to have not only TvChannel as number but also TvChannelName as string.
Extract from SmartThings API site:
tvChannel: 5
tvChannelName: Canale5 HD
Simone
Hello,
Is such a thing possible? I want to expose my own devices into SmartThings. ATM I use virtual switches in ST and read those (which I sync to in my automations). However as the number of devices grows automations become unwieldy. Is it possible to "create" ST devices from local devices?
Thanks.
Sam.
Python 3.6.6
aiohttp: 3.5.4
pysmarthings: 0.4.2
I have a virtualised 3.6 environment and pretty much followed the code in your example but I keep getting :
async with aiohttp.ClientSession() as session:
^
SyntaxError: invalid syntax
My code :
def main():
async with aiohttp.ClientSession() as session:
api = pysmartthings.SmartThings(session, MyToken)
locations = await api.locations()
print(len(locations))
I tried removing the async and await (as I'm not familiar with using those) and got :
raise TypeError("Use async with instead")
TypeError: Use async with instead
Thanks
I seem to be having issues with using the location API. Sample code snippet from what was attempted below. Given that other API functions do work, e.g. I can use the devices() calls for listing devices, and the device.command() calls to turn things off/on, etc. successfully.
I do only have a single location configured in my SmartThings environment. Perhaps that has something to do with it? Though, I am wondering if something has changed about the ST implementation of the Locations API somehow?
try:
locations = await api.locations()
print(len(locations))
location = locations[0]
print(location.name)
print(location.location_id)
except Exception as e:
print("\n# Location API FAIL: %s\n" % e)
The locations API call attempts consistently fail with a 403:
Location API FAIL: 403, message='Forbidden', url=URL('https://api.smartthings.com/v1/locations')
If I'm not missing something obvious, this appears to be a bug -- as it should just work based on what's shown here:
https://developer-preview.smartthings.com/api/public/#operation/listLocations
Thoughts?
Hello,
With smartthings removing the custom device handlers in the future, it would be very nice if it were possible to create and update devices.
Creation of devices would be ideal, but at the very least updating devices is really needed. Commands are fine, but not enough.
For example a motion sensor or a presence sensor cannot be updated using pysmartthings.
Thanks and regards,
Sam.
Hello
I am using very simple code on my mac using python 3 as below
**#!/usr/bin/env python3
import websockets
import json
import pandas as pd
import asyncio
import ta
stream =
websockets.connect('wss://stream.biannce.com:9443/stream?streams=adausdt@miniTicker')
async with stream as receiver:
while True:
data = await receiver.recv()
data = json.loads(data)['data']
df = createframe(data)
print(df)
def createframe(msg):
df = pd.DataFrame([msg])
df = df.loc[:,['s','E','c']]
df.columns = ['symbol','Time','Price']
df.Price = df.Price.astype(float)
f.Time = pd.to_datetime(df.Time, unit='ms')
return df**
but i am getting below error
sync with stream as receiver:
^
SyntaxError: 'async with' outside async function
Kindly please help
Thanks
['switch', 'audioVolume', 'audioMute', 'tvChannel', 'mediaInputSource', 'mediaPlayback', 'custom.picturemode', 'custom.error', 'custom.soundmode', 'custom.accessibility', 'custom.launchapp', 'custom.recording', 'custom.tvsearch', 'samsungtv.firmwareVersion', 'samsungtv.supportsPowerOnByOcf', 'refresh', 'execute', 'ocf', 'mediaTrackControl']
Traceback (most recent call last):
File "C:\Users\matth\OneDrive\Desktop\samsung api.py", line 32, in
main()
File "C:\Users\matth\OneDrive\Desktop\samsung api.py", line 30, in main
loop.run_until_complete(locations(token))
File "C:\Users\matth\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 584, in run_until_complete
return future.result()
File "C:\Users\matth\OneDrive\Desktop\samsung api.py", line 21, in locations
await device.switch_on()
File "C:\Users\matth\AppData\Local\Programs\Python\Python37\lib\site-packages\pysmartthings\device.py", line 990, in switch_on
result = await self.command(component_id, Capability.switch, Command.on)
File "C:\Users\matth\AppData\Local\Programs\Python\Python37\lib\site-packages\pysmartthings\device.py", line 794, in command
self._device_id, component_id, capability, command, args
File "C:\Users\matth\AppData\Local\Programs\Python\Python37\lib\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 "C:\Users\matth\AppData\Local\Programs\Python\Python37\lib\site-packages\pysmartthings\api.py", line 395, in post
return await self.request("post", self._api_base + resource, data=data)
File "C:\Users\matth\AppData\Local\Programs\Python\Python37\lib\site-packages\pysmartthings\api.py", line 376, in request
resp.raise_for_status()
File "C:\Users\matth\AppData\Local\Programs\Python\Python37\lib\site-packages\aiohttp\client_reqrep.py", line 946, in raise_for_status
headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 409, message='Conflict', url=URL('https://api.smartthings.com/v1/devices/0b722b22-8cd5-4028-b407-1b397bb24b9d/commands')
I'm getting Error Code 403 when I try to get Status Refresh from SmartThings HUB Devices, the others works properly and the solution was exclude status from HUB. Is there anyone having the same issue?
I can't get ONLINE or OFFLINE status from hub anymore.
await device.status.refresh()
File "C:\Users\Thales Greco\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pysmartthings\device.py", line 641, in refresh
data = await self._api.get_device_status(self.device_id)
File "C:\Users\Thales Greco\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pysmartthings\api.py", line 125, in get_device_status
return await self.get(API_DEVICE_STATUS.format(device_id=device_id))
File "C:\Users\Thales Greco\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pysmartthings\api.py", line 380, in get
return await self.request("get", self._api_base + resource, params)
File "C:\Users\Thales Greco\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pysmartthings\api.py", line 376, in request
resp.raise_for_status()
File "C:\Users\Thales Greco\AppData\Local\Programs\Python\Python37-32\lib\site-packages\aiohttp\client_reqrep.py", line 946, in raise_for_status
headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url=URL('https://api.smartthings.com/v1/devices/4e649CENSORED8-e7f7862d3b44/status')
`
I have been working on a piece of code that will set my lights to a certain color when I run it, and even though this code fully dose work, I get a ton of errors after I run it. Any ideas where the errors are coming from?
import aiohttp
import pysmartthings
import asynciotoken = '...'
async def turn_blue():
async with aiohttp.ClientSession() as session:
api = pysmartthings.SmartThings(session, token)
devices = await api.devices()
device = devices[1]
result = await device.command("main", "colorControl", "setColor", [{"hue": 50, "saturation": 100}])
#result = await device.command("main", "colorControl", "setHue", 50)
assert result == Truedef main():
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(turn_blue())if name == 'main':
main()
(Yes, I know the way I call a certain device is finicky but it's sad to say but it's the way I found easiest)
Here are the errors I receive:
Traceback (most recent call last):
File "C:\Users\jones\Desktop\Smart Thing\help.py", line 22, in
main()
File "C:\Users\jones\Desktop\Smart Thing\help.py", line 19, in main
asyncio.run(turn_blue())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\jones\Desktop\Smart Thing\help.py", line 13, in turn_blue
result = await device.command("main", "colorControl", "setColor", [{"hue": 50, "saturation": 100}])
File "C:\Users\jones\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pysmartthings\device.py", line 825, in command
response = await self._api.post_device_command(
File "C:\Users\jones\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\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 "C:\Users\jones\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pysmartthings\api.py", line 395, in post
return await self.request("post", self._api_base + resource, data=data)
File "C:\Users\jones\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pysmartthings\api.py", line 376, in request
resp.raise_for_status()
File "C:\Users\jones\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiohttp\client_reqrep.py", line 1000, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 424, message='Failed Dependency', url=URL('https://api.smartthings.com/v1/devices/[MY-TOKEN-GOES-HERE]/commands')
It appears the "subscription.py" file has functionality to have the ST Hub to notify the python program that some event (e.g. motion detector tripped) had occurred? Assuming that is true, is there an example, or other clues on how to get started with subscriptions?
Hello,
It's possible to release v0.7.8 ?
Because PR 62 is merge but not yet released.
It would help to have a better integration of smart-things in home-assistant.
Thanks
Does anyone have an example of how to subscribe to a capability?
Hello (I hope this is OK to post a question here, I couldn't find a better place for it),
I was hoping someone could give me an idea on how I can execute custom commands on a device using this library. Specifically, I am talking about custom commands that are defined in a custom device handler. From the available documentation and studying the source code, the only commands the library seems to allow execution on are those that are default/required by the declared capabilities of a given device.
For example, I have a custom virtual presence sensor on Smartthings with switch, presence and battery capabilities. I am trying to use this python library to execute a custom command I have written into the device handler called "setBattery(value)", which sets the battery percentage for that device. Looking at ST documentation, battery capability has no defined commands, hence why I had to create a custom command. But now I am not really sure how to go about executing the custom command and passing an argument to it using this library.
Any suggestions are welcome! Thanks!
The example for setting a switch status does not work as written.
This line...
result = await device.command("switch", "on")
...gives the following error.
TypeError: command() missing 1 required positional argument: 'command'
To resolve the issue I had to account for the component in the call by passing an empty string (or "main" which is the default)
result = await device.command("","switch", "on")
Hi @andrewsayre ,
Thanks for developing this awesome repository.
I am trying to develop some automation capabilities for my Samsung Smart TV NU7100 model. I would like to launch the Youtube TV app on command.
I would like to seek guidance as to where can I get additional documentations on the 'command' parameter:
device.command(component_id: str, capability, command, args=None) -> bool
Source:
The link in Readme is no longer valid:
See the SmartThings Capability Reference for more information.
The visited the new documentation site: New Site but did not point me how.
Hello
I am using very simple code on raspberry pi using python 3 as below
import aiohttp
import pysmartthings
token = 'xxxxxxx'
async with aiohttp.ClientSession() as session:
api = pysmarthings.SmartThings(session,token)
devices = await api.devices()
print(len(devices))
but i am getting below error
SyntaxError: 'async with' outside async function
Kindly please help
Thanks
Adnan
Hello and thanks for this awesome work! I'm trying to learn how to use it... I was following the example you have here:
#20 (comment)
I've done some googling around, and can't seem to find anything to give me a hint. But I get this syntax error when just trying to test the example you had in that linked post.
Traceback (most recent call last):
File "smartthings.py", line 5, in <module>
import pysmartthings
File "/usr/local/lib/python3.5/dist-packages/pysmartthings/__init__.py", line 44, in <module>
from .installedapp import (
File "/usr/local/lib/python3.5/dist-packages/pysmartthings/installedapp.py", line 13
return f"https://account.smartthings.com/login?redirect=https%3A%2F%2Fstrongman-regional.api.smartthings.com%2F%3FappId%3D{app_id}%26locationId%3D{location_id}%26appType%3DENDPOINTAPP%26language%3Den%26clientOS%3Dweb%26theme%3Dsmartthings"
^
SyntaxError: invalid syntax
Any thoughts? Thanks!
Hello,
Lately I changed my oven to a Samsung smart oven. It is compatible with SmartThing.
this is what the app shows me:
Firmware Version 02144A210802 20121100 FFFFFFFF
Controller Version RG.ST.0.2-2/IOS.NEX.0010.021
I hoped to see all the sensors in the app in the library. But in my case, it seems that the 5 Boolean sensors representing the state of the cooktop burners are not visible. The same goes for the oven lighting.
So, I was wondering if this was normal.
Thank you for all the information you can give me on this subject.
I'd like to be able to manipulate/read the individual device components exposed via the API if possible in Home Assistant.
ie: toggle the icemaker, adjust the freezer/fridge setpoint, monitor the contact sensors separately.
If there's anything I can do to assist please let me know.
Example /v1/devices/{deviceID}/status:
{
"components": {
"icemaker": {
"custom.dthVersion": {
"versionNumber": {
"value": 19061701,
"timestamp": "2020-01-19T19:04:16.085+0000"
}
},
"switch": {
"switch": {
"value": "on",
"timestamp": "2020-03-23T22:18:53.534+0000"
}
}
},
"cooler": {
"custom.fridgeMode": {
"fridgeModeValue": {
"value": null,
"timestamp": "2020-06-08T16:43:51.174+0000"
},
"fridgeMode": {
"value": null,
"timestamp": "2020-06-07T03:10:59.253+0000"
}
},
"contactSensor": {
"contact": {
"value": "closed",
"timestamp": "2020-10-09T01:46:29.366+0000"
}
},
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": [
"custom.fridgeMode"
],
"timestamp": "2020-01-19T18:58:40.057+0000"
}
},
"temperatureMeasurement": {
"temperature": {
"value": 37,
"unit": "F",
"timestamp": "2020-09-10T01:40:52.084+0000"
}
},
"sensor": {},
"custom.dthVersion": {
"versionNumber": {
"value": 19061701,
"timestamp": "2020-01-19T19:04:16.138+0000"
}
},
"thermostatCoolingSetpoint": {
"coolingSetpoint": {
"value": 37,
"unit": "F",
"timestamp": "2020-09-10T01:40:52.450+0000"
}
}
},
"freezer": {
"custom.fridgeMode": {
"fridgeModeValue": {
"value": null,
"timestamp": "2020-06-07T02:50:56.927+0000"
},
"fridgeMode": {
"value": null,
"timestamp": "2020-06-07T02:16:12.076+0000"
}
},
"contactSensor": {
"contact": {
"value": "closed",
"timestamp": "2020-10-09T01:40:48.072+0000"
}
},
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": [
"custom.fridgeMode"
],
"timestamp": "2020-01-19T18:58:40.049+0000"
}
},
"temperatureMeasurement": {
"temperature": {
"value": 0,
"unit": "F",
"timestamp": "2020-09-10T01:40:52.051+0000"
}
},
"sensor": {},
"custom.dthVersion": {
"versionNumber": {
"value": 19061701,
"timestamp": "2020-01-19T19:04:16.157+0000"
}
},
"thermostatCoolingSetpoint": {
"coolingSetpoint": {
"value": 0,
"unit": "F",
"timestamp": "2020-09-10T01:40:52.689+0000"
}
}
},
"cvroom": {
"custom.fridgeMode": {
"fridgeModeValue": {
"value": null,
"timestamp": "2020-06-03T00:49:53.835+0000"
},
"fridgeMode": {
"value": "CV_FDR_DELI",
"timestamp": "2020-05-26T05:21:29.579+0000"
}
},
"contactSensor": {
"contact": {
"value": "closed",
"timestamp": "2020-10-09T01:40:05.514+0000"
}
},
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": [
"temperatureMeasurement",
"thermostatCoolingSetpoint"
],
"timestamp": "2020-01-19T18:58:40.067+0000"
}
},
"temperatureMeasurement": {
"temperature": {
"value": null,
"timestamp": "2020-06-02T23:30:52.792+0000"
}
},
"sensor": {},
"custom.dthVersion": {
"versionNumber": {
"value": 19061701,
"timestamp": "2020-01-19T19:04:16.182+0000"
}
},
"thermostatCoolingSetpoint": {
"coolingSetpoint": {
"value": null,
"timestamp": "2020-06-02T23:21:21.353+0000"
}
}
},
"main": {
"contactSensor": {
"contact": {
"value": "closed",
"timestamp": "2020-10-09T01:46:29.304+0000"
}
},
"powerConsumptionReport": {
"powerConsumption": {
"value": null,
"timestamp": "2020-06-07T02:08:23.783+0000"
}
},
"refresh": {},
"filterStatus": {
"filterStatus": {
"value": "normal",
"timestamp": "2020-07-11T21:15:14.059+0000"
}
},
"custom.dthVersion": {
"versionNumber": {
"value": 20081001,
"timestamp": "2020-09-09T23:33:30.223+0000"
}
},
"execute": {
"data": {
"value": {
"payload": {
"if": [
"oic.if.s"
],
"rt": [
"x.com.samsung.da.rm.wifi"
],
"x.com.samsung.rm.rssi": [
-47
]
}
},
"data": {},
"timestamp": "2020-10-09T02:37:45.373+0000"
}
},
"custom.error": {
"error": {
"value": null,
"timestamp": "2020-06-07T02:03:05.577+0000"
}
},
"ocf": {
"st": {
"value": "2020-09-05T09:10:13Z",
"timestamp": "2020-09-09T23:34:23.794+0000"
},
"mndt": {
"value": "",
"timestamp": "2020-01-19T18:58:37.233+0000"
},
"mnfv": {
"value": "PRODUCT",
"timestamp": "2020-05-26T05:19:45.440+0000"
},
"mnhw": {
"value": "",
"timestamp": "2020-01-19T18:58:37.354+0000"
},
"di": {
"value": "7d3feb98-8a36-4351-c362-5e21ad3a78dd",
"timestamp": "2020-01-19T18:58:37.158+0000"
},
"mnsl": {
"value": "",
"timestamp": "2020-01-19T19:04:16.101+0000"
},
"dmv": {
"value": "res.1.1.0,sh.1.1.0",
"timestamp": "2020-01-19T18:58:37.175+0000"
},
"n": {
"value": "[refrigerator] Samsung (LCD)",
"timestamp": "2020-01-19T18:58:37.166+0000"
},
"mnmo": {
"value": "20K_REF_LCD_FHUB5.0|00113141|0002034e051324200103000000000000",
"timestamp": "2020-05-26T05:19:45.273+0000"
},
"vid": {
"value": "DA-REF-NORMAL-000001",
"timestamp": "2020-01-19T18:58:37.331+0000"
},
"mnmn": {
"value": "Samsung Electronics",
"timestamp": "2020-01-19T18:58:37.262+0000"
},
"mnml": {
"value": "",
"timestamp": "2020-01-19T18:58:37.300+0000"
},
"mnpv": {
"value": "4.0",
"timestamp": "2020-05-26T05:19:45.357+0000"
},
"mnos": {
"value": "Tizen",
"timestamp": "2020-01-19T18:58:37.286+0000"
},
"pi": {
"value": "7d3feb98-8a36-4351-c362-5e21ad3a78dd",
"timestamp": "2020-01-19T18:58:37.342+0000"
},
"icv": {
"value": "core.1.1.0",
"timestamp": "2020-01-19T18:58:37.146+0000"
}
},
"refrigeration": {
"defrost": {
"value": "on",
"timestamp": "2020-01-19T18:58:40.000+0000"
},
"rapidCooling": {
"value": "Off",
"timestamp": "2020-01-19T18:58:39.962+0000"
},
"rapidFreezing": {
"value": "Off",
"timestamp": "2020-01-19T18:58:39.970+0000"
}
},
"custom.deodorFilter": {
"deodorFilterCapacity": {
"value": null,
"timestamp": "2020-06-06T23:48:58.146+0000"
},
"deodorFilterStatus": {
"value": null,
"timestamp": "2020-06-05T01:44:01.569+0000"
},
"deodorFilterResetType": {
"value": null,
"timestamp": "2020-06-04T16:57:51.803+0000"
},
"deodorFilterUsage": {
"value": null,
"timestamp": "2020-06-04T16:52:10.609+0000"
},
"deodorFilterUsageStep": {
"value": null,
"timestamp": "2020-06-04T14:38:01.693+0000"
}
},
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": [
"powerConsumptionReport",
"custom.deodorFilter",
"custom.waterFilter"
],
"timestamp": "2020-01-19T18:58:40.082+0000"
}
},
"temperatureMeasurement": {
"temperature": {
"value": 37,
"unit": "F",
"timestamp": "2020-09-10T01:40:52.100+0000"
}
},
"custom.deviceReportStateConfiguration": {
"reportStateRealtimePeriod": {
"value": null,
"timestamp": "2020-06-03T23:30:32.065+0000"
},
"reportStateRealtime": {
"value": null,
"timestamp": "2020-06-03T22:23:05.392+0000"
},
"reportStatePeriod": {
"value": null,
"timestamp": "2020-06-03T16:38:57.341+0000"
}
},
"custom.waterFilter": {
"waterFilterUsageStep": {
"value": null,
"timestamp": "2020-06-03T16:05:36.116+0000"
},
"waterFilterResetType": {
"value": null,
"timestamp": "2020-06-03T15:12:04.032+0000"
},
"waterFilterCapacity": {
"value": null,
"timestamp": "2020-06-03T15:06:12.006+0000"
},
"waterFilterUsage": {
"value": null,
"timestamp": "2020-06-03T14:43:47.526+0000"
},
"waterFilterStatus": {
"value": null,
"timestamp": "2020-06-03T13:34:18.505+0000"
}
}
}
}
}
Can the possibility to retrieve device profiles be added to pysmartthings?
https://developer.smartthings.com/docs/api/public/#tag/Profiles
I think this is how to figure out the device settings and in my case I'd like to be able to see which child device temperature sensor has been selected (for heatit ztrm2fx)
Thanks
Hello,
There seems to be no way to update a presence sensor using pysmartthings. Do not understand why exactly. Can Presence be updated? Seems like the presence attribute does not exist in the states dictionary. Even after adding and a refresh seems like nothing is updated.
Thanks and regards,
Sam.
How can I change the mediaInputSource on my SmartTV?
Im new in programming with smartthings, so i don't get your doku.
Regards,
Felix
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.