Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the code actuator of virtual-device #385

Open
hjlarry opened this issue Jul 13, 2022 · 0 comments
Open

the code actuator of virtual-device #385

hjlarry opened this issue Jul 13, 2022 · 0 comments

Comments

@hjlarry
Copy link

hjlarry commented Jul 13, 2022

Hi guys, I found the code in lesson 3(senors-and-actuators) not work in my browser.

I tried both in win10 and macOS, and both old version or new version of counterfit.

The situation is when you open your chrome dev tools and lookup the websocket messages, it always 2 and 3, no other messages like actuators data or connection data send to the browser. So the led on/off is not change.

I try to modify the source code of counterfit like following, then it works.

@socketio.event
def set_and_send_connected(connected:bool = True) -> None:
    global is_connected
    is_connected = connected
    emit('device_connect', {'connected' : is_connected}, namespace='/', broadcast=True)

I am not familiar with websocket, I don't know why, but I hope this can help other guys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant