diff options
-rw-r--r-- | cethcan/cethcan.json | 8 | ||||
-rw-r--r-- | cethcan/rpc.c | 8 |
2 files changed, 9 insertions, 7 deletions
diff --git a/cethcan/cethcan.json b/cethcan/cethcan.json index 229f55e..25aaea8 100644 --- a/cethcan/cethcan.json +++ b/cethcan/cethcan.json @@ -8,14 +8,14 @@ { "addr": 1091, "name": "dali.lounge_bar" }, { "addr": 1092, "name": "dali.lounge_durchreiche" }, - { "addr": 1093, "name": "dali.hacklab.east.outer" }, + { "addr": 1093, "name": "dali.flur" }, + + { "addr": 1099, "name": "dali.hacklab.east.outer" }, { "addr": 1094, "name": "dali.hacklab.east.middle" }, { "addr": 1095, "name": "dali.hacklab.west.inner" }, { "addr": 1096, "name": "dali.hacklab.west.middle" }, { "addr": 1097, "name": "dali.hacklab.east.inner" }, - { "addr": 1098, "name": "dali.hacklab.west.outer" }, - - { "addr": 1099, "name": "dali.flur" } + { "addr": 1098, "name": "dali.hacklab.west.outer" } ], "beans": [ { "addr": 256, "name": "door.right", "values": [ "open", "closed" ] }, diff --git a/cethcan/rpc.c b/cethcan/rpc.c index ef0414f..fa11ecc 100644 --- a/cethcan/rpc.c +++ b/cethcan/rpc.c @@ -35,9 +35,11 @@ static int rpc_light_set(void *apparg, json_t *json_params, json_t **result) unsigned r, g, b; json_t *val = json_array_get(json_params, 1); - if (json_is_integer(val)) - r = g = b = json_integer_value(val); - else if (json_is_array(val)) { + if (json_is_integer(val)) { + r = json_integer_value(val); + g = (r * 180) / 255; + b = (r * 144) / 255; + } else if (json_is_array(val)) { if (json_unpack(val, "[iii]", &r, &g, &b)) { emsg = "failed to parse value array"; goto out_err; |