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

Template for custom device #21

Open
livello opened this issue May 22, 2018 · 2 comments
Open

Template for custom device #21

livello opened this issue May 22, 2018 · 2 comments

Comments

@livello
Copy link
Contributor

livello commented May 22, 2018

I want to have
"custom_device_type":{
"custom_device_name1":[param1,param2,param3],
"custom_device_name2":[param1,param2,param3]
}
In config file (DHT11,DHT22, BMP280, Analog sensors, Encoders). It will be much better to have well designed template to make support of new devices.
Associated build flag, config parsing, device initialization, send values using mqtt.

@anklimov
Copy link
Owner

There are two kind of devices now: sensors and actuators
Sensors places to "input"
Actuators placed to "items"

Item parameters:

#define I_TYPE 0 //Type of item
#define I_ARG  1 //Chanel-type depended argument or array of arguments (pin, address etc)
#define I_VAL  2 //Latest preset (int or array of presets)
#define I_CMD  3 //Latest CMD received
#define I_EXT  4 //Chanell-depended extension - array 

So this format is extendable for adding new types of actuator

input template:

"pin": { "T":"N", "emit":"MQTT emit topic", item:"out_item", "scmd": "ON,OFF,TOGGLE,INCREASE,DECREASE or value", "rcmd": "ON,OFF,TOGGLE,INCREASE,DECREASE or value", "rcmd":"repeat_command" }

T is bitmask from values:

#define IN_ACTIVE_HIGH   2      // High level = PUSHED/ CLOSED/ ON othervise :Low Level
#define IN_ANALOG         64     // Analog input (for further use)
#define IN_RE                   32     // Rotary Encoder (for further use)
#define IN_PUSH_ON        0      // PUSH - ON, Release - OFF (overrided by pcmd/rcmd) - DEFAULT
#define IN_PUSH_TOGGLE   1      // Every physicall push toggle logical switch  on/off (for further use)

Here some extension needed to threat "generic sensors" like DHT, BMP, NRF24, and even timers

@livello
Copy link
Contributor Author

livello commented Jun 9, 2018

Lazyhome.ru LightHub controller 12a4cd9 _2018-06-09

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

No branches or pull requests

2 participants