Skip to content

sebastien-lb/chirospython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Chirospython

How to use

import chirospython as chp 


@chp.app.route('/off')
def off():
    chp.save_local_state(0, "state")
    led.off()
    chp.send_status(0, "state")

    return chp.Response(
        status=200
    )


@chp.app.route('/switch', methods=['POST'])
def switch():
    state = 1 - chp.get_saved_state("state")
    if state:
        led.on()
    else:
        led.off()

    chp.save_local_state(state, "state")

    chp.send_status(state, "state")
    return chp.Response(
        "status: {}".format(data['value']),
        status=200
    )


chp.launch_app(5006)

About

Python and Flask implementation for Chiros objects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages