def patch(self, node_id): node = zwave[node_id] for key, val in request.args.items(): if key in [ "name", "location", "product_name", "manufacturer_name" ]: node.set_field(key, val) return ret_ajax(dict(node.to_dict()))
def get(self, node_id): my_groups = {} for idx, grp in zwave[node_id].groups.items(): my_groups[idx] = grp.to_dict() my_groups[idx]["index"] = idx actions = [ "assign_return_route", "heal", "network_update", "neighbor_update", "refresh_info", "request_state", "send_information", "test" ] return ret_ajax({ "values": zwave[node_id].values, "actions": actions, "groups": my_groups, "stats": zwave[node_id].stats })
def get(self, node_id): """ @TODO: avoid sending ALL information here, only minimal data like ????? other data shall then be acquired via calls to node/<node_id>/[groups,values,stats,...] """ node = zwave.get_node(node_id) is_ctrl = node.role == "Central Controller" and "primaryController" in node.capabilities return ret_ajax({ "values": dict((v.value_id, v.to_dict()) for v in node.values.values()), "actions": NODE_ACTIONS, "groups": dict((g.index, g.to_dict()) for g in node.groups.values()), "stats": node.stats, "is_ctrl": is_ctrl, "ctrl_stats": zwave.ctrl[0].stats if is_ctrl else "" })
def get(self, node_id, value_id): return ret_ajax(zwave.get_node(node_id).values.get(value_id).to_dict())
def get(self, node_id, index): grp = zwave.get_node(node_id).groups.get(index).to_dict() if grp is not None: return ret_ajax(grp) return ret_err( 404, f"group at index: {index} in node_id: {node_id}, not found")
def get(self, node_id, value_id): return ret_ajax(zwave[node_id].values[value_id])