Trying to do this example but getting the errors:
`23:35:35.538 Connection failed module 'ssl' has no attribute 'wrap_socket', retrying after 1.0s
C:\Python312\Lib\site-packages\cbor2\decoder.py:7: UserWarning: The cbor.decoder module has been deprecated. Instead import everything directly from cbor2.
warn("The cbor.decoder module has been deprecated. Instead import everything directly from cbor2.")
in Python.
``
import time
import logging
import sys
sys.path.append("lib")
from arduino_iot_cloud import ArduinoCloudClient
DEVICE_ID = b"words"
SECRET_KEY = b"words"
def logging_func():
logging.basicConfig(
datefmt="%H:%M:%S",
format="%(asctime)s.%(msecs)03d %(message)s",
level=logging.INFO,
)
This function is executed each time the "test_switch" variable changes
def on_switch_changed(client, value):
print("Switch Pressed! Status is: ", value)
if name == "main":
logging_func()
client = ArduinoCloudClient(device_id=DEVICE_ID, username=DEVICE_ID, password=SECRET_KEY)
client.register("test_value")
client["test_value"] = 20
client.register("test_switch", value=None, on_write=on_switch_changed)
client.start()