Git Product home page Git Product logo

tinytuya2mqtt's Introduction

tinytuya2mqtt

A bridge between jasonacox/tinytuya and Home Assistant via MQTT.

Leveraging Home Assistant's autodiscovery means there is no configuration required on the HA side. Once this is setup, your devices will just appear, and will be controllable from HA.

┌───────────┐      ┌──────┐      ┌───────────────┐
│ Home      │      │ MQTT │      │ tinytuya2mqtt │
│ Assistant │◀────▶│      │◀────▶│               │
└───────────┘      └──────┘      └──┬────────┬───┘
                                   ┌┘        └──┐
                                   ▼            ▼
                               ┌───────┐    ┌───────┐
                               │ Tuya  │    │ Tuya  │
                               │ Fan   │    │ Light │
                               └───────┘    └───────┘

Running

Ensure tinytuya2mqtt.ini and snapshot.json are in the current directory. Ensure your broker IP has been set in docker-compose.yml:

docker compose up

Or, without docker:

tinytuya2mqtt

Setup

docker compose build

Or, without docker:

python3 -m venv venv && source venv/bin/activate
pip install -e .

Config

Two things are required:

  1. snapshot.json
  2. tinytuya2mqtt.ini

snapshot.json

Follow the setup process for tinytuya using the wizard which is part of that project. This will create a file snapshot.json which is used by tinytuya2mqtt.

python -m tinytuya wizard

tinytuya2mqtt.ini

Create a tinytuya2mqtt.ini config file, mapping your device pins to the named capabilities. Also ensure to include your MQTT broker hostname. For example:

[broker]
hostname = 192.168.1.198

[device bf7bf4939779bbd9afllck]
fan_state = 1
fan_speed = 3
fan_speed_steps = 1,2,3,4,5,6
light_state = 15
light_brightness = 16
light_brightness_steps = 25,125,275,425,575,725,900,1000
light_temp = 17

[device bf66790922f582082fao6p]
fan_state = 1
fan_speed = 3
fan_speed_steps = 1,2,3,4,5,6

Devices

Device types and capabilities supported by tinytuya2mqtt:

Type Subtype Name Example
Fan Fan fan_state 1
Fan Fan fan_speed 3
Fan Fan fan_speed_steps 1,2,3,4,5,6
Fan Light light_state 15
Fan Light light_brightness 16
Fan Light light_brightness_steps 25,125,275,425,575,725,900,1000
Fan Light light_temp 17

tinytuya2mqtt's People

Contributors

mafrosis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.